LZ4_compressBound:
  779|    654|int LZ4_compressBound(int isize)  { return LZ4_COMPRESSBOUND(isize); }
  ------------------
  |  |  222|    654|#define LZ4_COMPRESSBOUND(isize)  ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
  |  |  ------------------
  |  |  |  |  221|    654|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  |  |  ------------------
  |  |  |  Branch (222:36): [True: 0, False: 654]
  |  |  ------------------
  ------------------
LZ4_compress_fast_extState_fastReset:
 1570|    654|{
 1571|    654|    LZ4_stream_t_internal* const ctx = &((LZ4_stream_t*)state)->internal_donotuse;
 1572|    654|    acceleration = LZ4_clampAcceleration(acceleration);
 1573|    654|    assert(ctx != NULL);
  ------------------
  |  |  273|    654|#    define assert(condition) ((void)0)
  ------------------
 1574|       |
 1575|    654|    if (dstCapacity >= LZ4_compressBound(srcSize)) {
  ------------------
  |  Branch (1575:9): [True: 0, False: 654]
  ------------------
 1576|      0|        return LZ4_compress_fastReset_generic(ctx, src, dst, srcSize, 0, notLimited, acceleration);
 1577|    654|    } else {
 1578|    654|        return LZ4_compress_fastReset_generic(ctx, src, dst, srcSize, dstCapacity, limitedOutput, acceleration);
 1579|    654|    }
 1580|    654|}
LZ4_createStream:
 1662|      4|{
 1663|      4|    LZ4_stream_t* const lz4s = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t));
  ------------------
  |  |  225|      4|# define ALLOC(s)          malloc(s)
  ------------------
 1664|      4|    LZ4_STATIC_ASSERT(sizeof(LZ4_stream_t) >= sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  277|      4|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 1665|      4|    DEBUGLOG(4, "LZ4_createStream %p", (void*)lz4s);
  ------------------
  |  |  289|      4|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1666|      4|    if (lz4s == NULL) return NULL;
  ------------------
  |  Branch (1666:9): [True: 0, False: 4]
  ------------------
 1667|      4|    LZ4_initStream(lz4s, sizeof(*lz4s));
 1668|      4|    return lz4s;
 1669|      4|}
LZ4_initStream:
 1683|      4|{
 1684|      4|    DEBUGLOG(5, "LZ4_initStream");
  ------------------
  |  |  289|      4|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1685|      4|    if (buffer == NULL) { return NULL; }
  ------------------
  |  Branch (1685:9): [True: 0, False: 4]
  ------------------
 1686|      4|    if (size < sizeof(LZ4_stream_t)) { return NULL; }
  ------------------
  |  Branch (1686:9): [True: 0, False: 4]
  ------------------
 1687|      4|    if (!LZ4_isAligned(buffer, LZ4_stream_t_alignment())) return NULL;
  ------------------
  |  Branch (1687:9): [True: 0, False: 4]
  ------------------
 1688|      4|    MEM_INIT(buffer, 0, sizeof(LZ4_stream_t_internal));
  ------------------
  |  |  236|      4|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|      4|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 1689|      4|    return (LZ4_stream_t*)buffer;
 1690|      4|}
LZ4_freeStream:
 1706|      4|{
 1707|      4|    if (!LZ4_stream) return 0;   /* support free on NULL */
  ------------------
  |  Branch (1707:9): [True: 0, False: 4]
  ------------------
 1708|      4|    DEBUGLOG(5, "LZ4_freeStream %p", (void*)LZ4_stream);
  ------------------
  |  |  289|      4|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1709|      4|    FREEMEM(LZ4_stream);
  ------------------
  |  |  227|      4|# define FREEMEM(p)        free(p)
  ------------------
 1710|      4|    return (0);
 1711|      4|}
LZ4_decompress_safe:
 2570|  1.26k|{
 2571|  1.26k|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2572|  1.26k|                                  decode_full_block, noDict,
 2573|       |                                  (BYTE*)dest, NULL, 0);
 2574|  1.26k|}
lz4.c:LZ4_clampAcceleration:
 1513|    654|{
 1514|    654|    if (acceleration < 1) return LZ4_ACCELERATION_DEFAULT;
  ------------------
  |  |  614|      0|#define LZ4_ACCELERATION_DEFAULT 1
  ------------------
  |  Branch (1514:9): [True: 0, False: 654]
  ------------------
 1515|    654|    if (acceleration > LZ4_ACCELERATION_MAX) return LZ4_ACCELERATION_MAX;
  ------------------
  |  |  615|    654|#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: 654]
  ------------------
 1516|    654|    return acceleration;
 1517|    654|}
lz4.c:LZ4_compress_fastReset_generic:
 1537|    654|{
 1538|    654|    if (srcSize < LZ4_64Klimit) {
  ------------------
  |  Branch (1538:9): [True: 654, False: 0]
  ------------------
 1539|    654|        LZ4_prepareTable(ctx, srcSize, byU16);
 1540|    654|        if (ctx->currentOffset) {  /* table re-used : stale entries must be rejected */
  ------------------
  |  Branch (1540:13): [True: 650, False: 4]
  ------------------
 1541|    650|            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, outputDirective, byU16, noDict, dictSmall, acceleration);
 1542|    650|        } else {
 1543|      4|            return LZ4_compress_generic(ctx, src, dst, srcSize, NULL, dstCapacity, outputDirective, byU16, noDict, noDictIssue, acceleration);
 1544|      4|        }
 1545|    654|    } 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|    654|}
lz4.c:LZ4_isAligned:
  293|      4|{
  294|      4|    return ((size_t)ptr & (alignment -1)) == 0;
  295|      4|}
lz4.c:LZ4_stream_t_alignment:
 1673|      4|{
 1674|      4|#if LZ4_ALIGN_TEST
 1675|      4|    typedef struct { char c; LZ4_stream_t t; } t_a;
 1676|      4|    return sizeof(t_a) - sizeof(LZ4_stream_t);
 1677|       |#else
 1678|       |    return 1;  /* effectively disabled */
 1679|       |#endif
 1680|      4|}
lz4.c:LZ4_prepareTable:
  942|    654|           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|    654|    if ((tableType_t)cctx->tableType != clearedTable) {
  ------------------
  |  Branch (947:9): [True: 650, False: 4]
  ------------------
  948|    650|        assert(inputSize >= 0);
  ------------------
  |  |  273|    650|#    define assert(condition) ((void)0)
  ------------------
  949|    650|        if ((tableType_t)cctx->tableType != tableType
  ------------------
  |  Branch (949:13): [True: 0, False: 650]
  ------------------
  950|    650|          || ((tableType == byU16) && cctx->currentOffset + (unsigned)inputSize >= 0xFFFFU)
  ------------------
  |  Branch (950:15): [True: 650, False: 0]
  |  Branch (950:39): [True: 0, False: 650]
  ------------------
  951|    650|          || ((tableType == byU32) && cctx->currentOffset > 1 GB)
  ------------------
  |  |  253|      0|#define GB *(1U<<30)
  ------------------
  |  Branch (951:15): [True: 0, False: 650]
  |  Branch (951:39): [True: 0, False: 0]
  ------------------
  952|    650|          || tableType == byPtr
  ------------------
  |  Branch (952:14): [True: 0, False: 650]
  ------------------
  953|    650|          || inputSize >= LZ4_CLEAR_TABLE_THRESHOLD)
  ------------------
  |  |  937|    650|#define LZ4_CLEAR_TABLE_THRESHOLD (LZ4_HASHTABLESIZE / 16)
  |  |  ------------------
  |  |  |  |  713|    650|#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  162|    650|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  167|    650|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (953:14): [True: 0, False: 650]
  ------------------
  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|    650|        } else {
  960|    650|            DEBUGLOG(4, "LZ4_prepareTable: Re-use hash table (no reset)");
  ------------------
  |  |  289|    650|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
  961|    650|        }
  962|    650|    }
  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|    654|    if (cctx->currentOffset != 0 && tableType == byU32) {
  ------------------
  |  Branch (969:9): [True: 650, False: 4]
  |  Branch (969:37): [True: 0, False: 650]
  ------------------
  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|    654|    cctx->dictCtx = NULL;
  976|       |    cctx->dictionary = NULL;
  977|    654|    cctx->dictSize = 0;
  978|    654|}
lz4.c:LZ4_hashPosition:
  852|  14.3k|{
  853|  14.3k|    if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
  ------------------
  |  Branch (853:9): [True: 14.3k, Folded]
  |  Branch (853:31): [True: 0, False: 14.3k]
  ------------------
  854|       |
  855|       |#ifdef LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT
  856|       |    return LZ4_hash4(LZ4_readLE32(p), tableType);
  857|       |#else
  858|  14.3k|    return LZ4_hash4(LZ4_read32(p), tableType);
  859|  14.3k|#endif
  860|  14.3k|}
lz4.c:LZ4_isLittleEndian:
  364|  13.3k|{
  365|  13.3k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  366|  13.3k|    return one.c[0];
  367|  13.3k|}
lz4.c:LZ4_read_ARCH:
  395|  16.3k|static reg_t LZ4_read_ARCH(const void* ptr) { return ((const LZ4_unalignST*)ptr)->uArch; }
lz4.c:LZ4_hash4:
  834|  14.3k|{
  835|  14.3k|    const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  712|  14.3k|#define LZ4_HASHLOG   (LZ4_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  162|  14.3k|# define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
  |  |  |  |  ------------------
  |  |  |  |  |  |  167|  14.3k|#define LZ4_MEMORY_USAGE_DEFAULT 14
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
  ------------------
  |  |  712|  14.3k|#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: 14.3k, False: 0]
  ------------------
  836|  14.3k|    return ((sequence * 2654435761U) >> ((MINMATCH*8)-hashLog));
  ------------------
  |  |  242|  14.3k|#define MINMATCH 4
  ------------------
  837|  14.3k|}
lz4.c:LZ4_read32:
  394|  21.8k|static U32 LZ4_read32(const void* ptr) { return ((const LZ4_unalign32*)ptr)->u32; }
lz4.c:LZ4_putIndexOnHash:
  875|  12.1k|{
  876|  12.1k|    switch (tableType)
  877|  12.1k|    {
  878|      0|    default: /* fallthrough */
  ------------------
  |  Branch (878:5): [True: 0, False: 12.1k]
  ------------------
  879|      0|    case clearedTable: /* fallthrough */
  ------------------
  |  Branch (879:5): [True: 0, False: 12.1k]
  ------------------
  880|      0|    case byPtr: { /* illegal! */ assert(0); return; }
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
  |  Branch (880:5): [True: 0, False: 12.1k]
  ------------------
  881|      0|    case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = idx; return; }
  ------------------
  |  Branch (881:5): [True: 0, False: 12.1k]
  ------------------
  882|  12.1k|    case byU16: { U16* hashTable = (U16*) tableBase; assert(idx < 65536); hashTable[h] = (U16)idx; return; }
  ------------------
  |  |  273|  12.1k|#    define assert(condition) ((void)0)
  ------------------
  |  Branch (882:5): [True: 12.1k, False: 0]
  ------------------
  883|  12.1k|    }
  884|  12.1k|}
lz4.c:LZ4_getIndexOnHash:
  914|  10.9k|{
  915|  10.9k|    LZ4_STATIC_ASSERT(LZ4_MEMORY_USAGE > 2);
  ------------------
  |  |  277|  10.9k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
  916|  10.9k|    if (tableType == byU32) {
  ------------------
  |  Branch (916:9): [True: 0, False: 10.9k]
  ------------------
  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|  10.9k|    if (tableType == byU16) {
  ------------------
  |  Branch (921:9): [True: 10.9k, False: 0]
  ------------------
  922|  10.9k|        const U16* const hashTable = (const U16*) tableBase;
  923|  10.9k|        assert(h < (1U << (LZ4_MEMORY_USAGE-1)));
  ------------------
  |  |  273|  10.9k|#    define assert(condition) ((void)0)
  ------------------
  924|  10.9k|        return hashTable[h];
  925|  10.9k|    }
  926|      0|    assert(0); return 0;  /* forbidden case */
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
  927|  10.9k|}
lz4.c:LZ4_compress_generic:
 1469|    654|{
 1470|    654|    DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i",
  ------------------
  |  |  289|    654|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1471|    654|                srcSize, dstCapacity);
 1472|       |
 1473|    654|    if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; }  /* Unsupported srcSize, too large (or negative) */
  ------------------
  |  |  221|    654|#define LZ4_MAX_INPUT_SIZE        0x7E000000   /* 2 113 929 216 bytes */
  ------------------
  |  Branch (1473:9): [True: 0, False: 654]
  ------------------
 1474|    654|    if (srcSize == 0) {   /* src == NULL supported if srcSize == 0 */
  ------------------
  |  Branch (1474:9): [True: 0, False: 654]
  ------------------
 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|    654|    assert(src != NULL);
  ------------------
  |  |  273|    654|#    define assert(condition) ((void)0)
  ------------------
 1487|       |
 1488|    654|    if ((dictDirective == usingExtDict) && (dictIssue == noDictIssue)) {
  ------------------
  |  Branch (1488:9): [True: 0, False: 654]
  |  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|    654|    return LZ4_compress_generic_validated(cctx, src, dst, srcSize,
 1505|    654|                inputConsumed, /* only written into if outputDirective == fillOutput */
 1506|    654|                dstCapacity, outputDirective,
 1507|    654|                tableType, dictDirective, dictIssue, acceleration, NULL, NULL);
 1508|    654|}
lz4.c:LZ4_compress_generic_validated:
 1015|    654|{
 1016|    654|    int result;
 1017|    654|    const BYTE* ip = resume ? resume->ip : (const BYTE*)source;
  ------------------
  |  Branch (1017:22): [True: 0, False: 654]
  ------------------
 1018|       |
 1019|    654|    U32 const startIndex = resume ? resume->startIndex : cctx->currentOffset;
  ------------------
  |  Branch (1019:28): [True: 0, False: 654]
  ------------------
 1020|    654|    const BYTE* base = (const BYTE*)source - startIndex;
 1021|    654|    const BYTE* lowLimit;
 1022|       |
 1023|    654|    const LZ4_stream_t_internal* dictCtx = (const LZ4_stream_t_internal*) cctx->dictCtx;
 1024|    654|    const BYTE* const dictionary =
 1025|    654|        dictDirective == usingDictCtx ? dictCtx->dictionary : cctx->dictionary;
  ------------------
  |  Branch (1025:9): [True: 0, False: 654]
  ------------------
 1026|    654|    const U32 dictSize =
 1027|    654|        dictDirective == usingDictCtx ? dictCtx->dictSize : cctx->dictSize;
  ------------------
  |  Branch (1027:9): [True: 0, False: 654]
  ------------------
 1028|    654|    const U32 dictDelta =
 1029|    654|        (dictDirective == usingDictCtx) ? startIndex - dictCtx->currentOffset : 0;   /* make indexes in dictCtx comparable with indexes in current context */
  ------------------
  |  Branch (1029:9): [True: 0, False: 654]
  ------------------
 1030|       |
 1031|    654|    int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx);
  ------------------
  |  Branch (1031:30): [True: 0, False: 654]
  |  Branch (1031:65): [True: 0, False: 654]
  ------------------
 1032|    654|    U32 const prefixIdxLimit = startIndex - dictSize;   /* used when dictDirective == dictSmall */
 1033|    654|    const BYTE* const dictEnd = dictionary ? dictionary + dictSize : dictionary;
  ------------------
  |  Branch (1033:33): [True: 0, False: 654]
  ------------------
 1034|    654|    const BYTE* anchor = resume ? resume->ip : (const BYTE*)source;
  ------------------
  |  Branch (1034:26): [True: 0, False: 654]
  ------------------
 1035|    654|    const BYTE* const iend = (const BYTE*)source + inputSize;
 1036|    654|    const BYTE* mflimitPlusOne;   /* set after the size check : would precede a small input */
 1037|    654|    const BYTE* matchlimit;
 1038|    654|    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|    654|    const BYTE* dictBase = (dictionary == NULL) ? NULL :
  ------------------
  |  Branch (1042:28): [True: 654, False: 0]
  ------------------
 1043|    654|                           (dictDirective == usingDictCtx) ?
  ------------------
  |  Branch (1043:28): [True: 0, False: 0]
  ------------------
 1044|      0|                            dictionary + dictSize - dictCtx->currentOffset :
 1045|      0|                            dictionary + dictSize - startIndex;
 1046|       |
 1047|    654|    BYTE* op = resume ? resume->op : (BYTE*)dest;
  ------------------
  |  Branch (1047:16): [True: 0, False: 654]
  ------------------
 1048|    654|    BYTE* const olimit = (BYTE*)dest + maxOutputSize;
 1049|       |
 1050|    654|    U32 offset = 0;
 1051|    654|    U32 forwardH;
 1052|    654|    const BYTE* filledIp = NULL;   /* fillOutput only ; set by catch up (resume : never with fillOutput) */
 1053|       |
 1054|    654|    DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType);
  ------------------
  |  |  289|    654|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1055|    654|    assert(ip != NULL);
  ------------------
  |  |  273|    654|#    define assert(condition) ((void)0)
  ------------------
 1056|    654|    if (tableType == byU16) assert(inputSize<LZ4_64Klimit);  /* Size too large (not within 64K limit) */
  ------------------
  |  |  273|    654|#    define assert(condition) ((void)0)
  ------------------
  |  Branch (1056:9): [True: 654, False: 0]
  ------------------
 1057|    654|    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: 654]
  ------------------
 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|    654|    if (outputDirective == fillOutput && maxOutputSize < 1) { return 0; } /* Impossible to store anything */
  ------------------
  |  Branch (1060:9): [True: 0, False: 654]
  |  Branch (1060:42): [True: 0, False: 0]
  ------------------
 1061|    654|    assert(acceleration >= 1);
  ------------------
  |  |  273|    654|#    define assert(condition) ((void)0)
  ------------------
 1062|       |
 1063|       |    /* resume : candidates are within source (see LZ4_compress_generic()) */
 1064|    654|    lowLimit = (const BYTE*)source - ((dictDirective == withPrefix64k) && !resume ? dictSize : 0);
  ------------------
  |  Branch (1064:39): [True: 0, False: 654]
  |  Branch (1064:75): [True: 0, False: 0]
  ------------------
 1065|       |
 1066|    654|    if (!resume) {   /* resume : context state already updated */
  ------------------
  |  Branch (1066:9): [True: 654, False: 0]
  ------------------
 1067|       |        /* Update context state */
 1068|    654|        if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1068:13): [True: 0, False: 654]
  ------------------
 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|    654|        } else {
 1074|    654|            cctx->dictSize += (U32)inputSize;
 1075|    654|        }
 1076|    654|        cctx->currentOffset += (U32)inputSize;
 1077|    654|        cctx->tableType = (U32)tableType;
 1078|       |
 1079|    654|        if (inputSize<LZ4_minLength) goto _last_literals;        /* Input too small, no compression (all literals) */
  ------------------
  |  Branch (1079:13): [True: 0, False: 654]
  ------------------
 1080|    654|    }
 1081|    654|    mflimitPlusOne = iend - MFLIMIT + 1;
  ------------------
  |  |  246|    654|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1082|    654|    matchlimit = iend - LASTLITERALS;
  ------------------
  |  |  245|    654|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 1083|    654|    seqLimit = mflimitPlusOne;
 1084|    654|    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: 654]
  |  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|    654|    if (resume) goto _resume;
  ------------------
  |  Branch (1087:9): [True: 0, False: 654]
  ------------------
 1088|       |
 1089|       |    /* First Byte */
 1090|    654|    LZ4_putPosition(ip, cctx->hashTable, tableType, base);
 1091|    654|    ip++; forwardH = LZ4_hashPosition(ip, tableType);
 1092|       |
 1093|       |    /* Main Loop */
 1094|  2.23k|    for ( ; ; ) {
 1095|  2.23k|        const BYTE* match;
 1096|  2.23k|        BYTE* token;
 1097|       |
 1098|       |        /* Find a match */
 1099|  2.23k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1099:13): [True: 0, False: 2.23k]
  ------------------
 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|  2.23k|        } else {   /* byU32, byU16 */
 1120|       |
 1121|  2.23k|            const BYTE* forwardIp = ip;
 1122|  2.23k|            int step = 1;
 1123|  2.23k|            int searchMatchNb = acceleration << LZ4_skipTrigger;
 1124|  5.64k|            do {
 1125|  5.64k|                U32 const h = forwardH;
 1126|  5.64k|                U32 const current = (U32)(forwardIp - base);
 1127|  5.64k|                U32 matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1128|  5.64k|                assert(matchIndex <= current);
  ------------------
  |  |  273|  5.64k|#    define assert(condition) ((void)0)
  ------------------
 1129|  5.64k|                assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
  ------------------
  |  |  273|  5.64k|#    define assert(condition) ((void)0)
  ------------------
 1130|  5.64k|                ip = forwardIp;
 1131|  5.64k|                forwardIp += step;
 1132|  5.64k|                step = (searchMatchNb++ >> LZ4_skipTrigger);
 1133|       |
 1134|  5.64k|                if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
  ------------------
  |  |  180|  5.64k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  5.64k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 212, False: 5.43k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1135|  5.43k|                assert(ip < mflimitPlusOne);
  ------------------
  |  |  273|  5.43k|#    define assert(condition) ((void)0)
  ------------------
 1136|       |
 1137|  5.43k|                if (dictDirective == usingDictCtx) {
  ------------------
  |  Branch (1137:21): [True: 0, False: 5.43k]
  ------------------
 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|  5.43k|                } else if (dictDirective == usingExtDict) {
  ------------------
  |  Branch (1149:28): [True: 0, False: 5.43k]
  ------------------
 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|  5.43k|                } else {   /* single continuous memory segment */
 1155|  5.43k|                    match = base + matchIndex;
 1156|  5.43k|                }
 1157|  5.43k|                forwardH = LZ4_hashPosition(forwardIp, tableType);
 1158|  5.43k|                LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1159|       |
 1160|  5.43k|                DEBUGLOG(7, "candidate at pos=%u  (offset=%u \n", matchIndex, current - matchIndex);
  ------------------
  |  |  289|  5.43k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1161|  5.43k|                if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; }    /* match outside of valid area */
  ------------------
  |  Branch (1161:21): [True: 5.39k, False: 39]
  |  Branch (1161:49): [True: 3.37k, False: 2.01k]
  ------------------
 1162|  2.05k|                assert(matchIndex < current);
  ------------------
  |  |  273|  2.05k|#    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|  2.05k|                assert((dictDirective != noDict) || (match >= (const BYTE*)source));
  ------------------
  |  |  273|  2.05k|#    define assert(condition) ((void)0)
  ------------------
 1166|  2.05k|                if ( (dictDirective != noDict)
  ------------------
  |  Branch (1166:22): [True: 0, False: 2.05k]
  ------------------
 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|  2.05k|                if (LZ4_read32(match) == LZ4_read32(ip)) {
  ------------------
  |  Branch (1172:21): [True: 2.01k, False: 36]
  ------------------
 1173|  2.01k|                    if ( (dictDirective == noDict)
  ------------------
  |  Branch (1173:26): [True: 2.01k, False: 0]
  ------------------
 1174|  2.01k|                      && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  691|  2.01k|#  define LZ4_DISTANCE_MAX 65535   /* set to maximum value by default */
  ------------------
                                    && ((tableType != byU16) || (LZ4_DISTANCE_MAX < LZ4_DISTANCE_ABSOLUTE_MAX))
  ------------------
  |  |  255|  2.01k|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
  |  Branch (1174:27): [True: 0, False: 2.01k]
  |  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|  2.01k|                    assert((current - matchIndex) <= LZ4_DISTANCE_MAX);  /* match now expected within distance */
  ------------------
  |  |  273|  2.01k|#    define assert(condition) ((void)0)
  ------------------
 1179|  2.01k|                    if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1179:25): [True: 0, False: 2.01k]
  ------------------
 1180|  2.01k|                    if (dictDirective == usingExtDict)   /* lowLimit : only needed once a match is found */
  ------------------
  |  Branch (1180:25): [True: 0, False: 2.01k]
  ------------------
 1181|      0|                        lowLimit = (matchIndex < startIndex) ? dictionary : (const BYTE*)source;
  ------------------
  |  Branch (1181:36): [True: 0, False: 0]
  ------------------
 1182|  2.01k|                    break;   /* match found */
 1183|  2.01k|                }
 1184|       |
 1185|  3.41k|            } while(1);
  ------------------
  |  Branch (1185:21): [True: 3.41k, Folded]
  ------------------
 1186|  2.23k|        }
 1187|       |
 1188|       |        /* Catch up */
 1189|  2.01k|        filledIp = ip;
 1190|  2.01k|        assert(ip > anchor); /* this is always true as ip has been advanced before entering the main loop */
  ------------------
  |  |  273|  2.01k|#    define assert(condition) ((void)0)
  ------------------
 1191|  2.01k|        if ((match > lowLimit) && unlikely(ip[-1] == match[-1])) {
  ------------------
  |  |  180|  1.65k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.65k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 405, False: 1.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1191:13): [True: 1.65k, False: 364]
  ------------------
 1192|    790|            do { ip--; match--; } while (((ip > anchor) & (match > lowLimit)) && (unlikely(ip[-1] == match[-1])));
  ------------------
  |  |  180|    669|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    669|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1192:42): [True: 669, False: 121]
  |  Branch (1192:82): [True: 385, False: 284]
  ------------------
 1193|    405|        }
 1194|       |
 1195|       |        /* Encode Literals */
 1196|  2.01k|        {   unsigned const litLength = (unsigned)(ip - anchor);
 1197|  2.01k|            token = op++;
 1198|  2.01k|            if ((outputDirective == limitedOutput) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1198:17): [True: 2.01k, False: 0]
  ------------------
 1199|  2.01k|                (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)) ) {
  ------------------
  |  |  180|  2.01k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.01k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1199:17): [True: 0, False: 2.01k]
  ------------------
 1200|      0|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1201|      0|            }
 1202|  2.01k|            if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1202:17): [True: 0, False: 2.01k]
  ------------------
 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|  2.01k|            if (litLength >= RUN_MASK) {
  ------------------
  |  |  263|  2.01k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  2.01k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  2.01k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1207:17): [True: 183, False: 1.83k]
  ------------------
 1208|    183|                unsigned len = litLength - RUN_MASK;
  ------------------
  |  |  263|    183|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    183|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    183|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1209|    183|                *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  263|    183|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    183|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    183|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                              *token = (RUN_MASK<<ML_BITS);
  ------------------
  |  |  260|    183|#define ML_BITS  4
  ------------------
 1210|    183|                for(; len >= 255 ; len-=255) *op++ = 255;
  ------------------
  |  Branch (1210:23): [True: 0, False: 183]
  ------------------
 1211|    183|                *op++ = (BYTE)len;
 1212|    183|            }
 1213|  1.83k|            else *token = (BYTE)(litLength<<ML_BITS);
  ------------------
  |  |  260|  1.83k|#define ML_BITS  4
  ------------------
 1214|       |
 1215|       |            /* Copy Literals */
 1216|  2.01k|            LZ4_wildCopy8(op, anchor, op+litLength);
 1217|  2.01k|            op+=litLength;
 1218|  2.01k|            DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  289|  2.01k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1219|  2.01k|                        (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source));
 1220|  2.01k|        }
 1221|       |
 1222|  3.45k|_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|  3.45k|        if ((outputDirective == fillOutput) &&
  ------------------
  |  Branch (1231:13): [True: 0, False: 3.45k]
  ------------------
 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|  3.45k|        if (maybe_extMem) {   /* static test */
  ------------------
  |  Branch (1239:13): [True: 0, False: 3.45k]
  ------------------
 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|  3.45k|        } else  {
 1244|  3.45k|            DEBUGLOG(6, "             with offset=%u  (same segment)", (U32)(ip - match));
  ------------------
  |  |  289|  3.45k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1245|  3.45k|            assert(ip-match <= LZ4_DISTANCE_MAX);
  ------------------
  |  |  273|  3.45k|#    define assert(condition) ((void)0)
  ------------------
 1246|  3.45k|            LZ4_writeLE16(op, (U16)(ip - match)); op+=2;
 1247|  3.45k|        }
 1248|       |
 1249|       |        /* Encode MatchLength */
 1250|  3.45k|        {   unsigned matchCode;
 1251|       |
 1252|  3.45k|            if ( (dictDirective==usingExtDict || dictDirective==usingDictCtx)
  ------------------
  |  Branch (1252:19): [True: 0, False: 3.45k]
  |  Branch (1252:50): [True: 0, False: 3.45k]
  ------------------
 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|  3.45k|            } else {
 1266|  3.45k|                matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  242|  3.45k|#define MINMATCH 4
  ------------------
                              matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
  ------------------
  |  |  242|  3.45k|#define MINMATCH 4
  ------------------
 1267|  3.45k|                ip += (size_t)matchCode + MINMATCH;
  ------------------
  |  |  242|  3.45k|#define MINMATCH 4
  ------------------
 1268|  3.45k|                DEBUGLOG(6, "             with matchLength=%u", matchCode+MINMATCH);
  ------------------
  |  |  289|  3.45k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1269|  3.45k|            }
 1270|       |
 1271|  3.45k|            if ((outputDirective) &&    /* Check output buffer overflow */
  ------------------
  |  Branch (1271:17): [True: 3.45k, False: 0]
  ------------------
 1272|  3.45k|                (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
  ------------------
  |  |  180|  3.45k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  3.45k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (1272:17): [True: 0, False: 3.45k]
  ------------------
 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|  3.45k|            if (matchCode >= ML_MASK) {
  ------------------
  |  |  261|  3.45k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  3.45k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (1297:17): [True: 508, False: 2.94k]
  ------------------
 1298|    508|                *token += ML_MASK;
  ------------------
  |  |  261|    508|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    508|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1299|    508|                matchCode -= ML_MASK;
  ------------------
  |  |  261|    508|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    508|#define ML_BITS  4
  |  |  ------------------
  ------------------
 1300|    508|                LZ4_write32(op, 0xFFFFFFFF);
 1301|    508|                while (matchCode >= 4*255) {
  ------------------
  |  Branch (1301:24): [True: 0, False: 508]
  ------------------
 1302|      0|                    op+=4;
 1303|      0|                    LZ4_write32(op, 0xFFFFFFFF);
 1304|      0|                    matchCode -= 4*255;
 1305|      0|                }
 1306|    508|                op += matchCode / 255;
 1307|    508|                *op++ = (BYTE)(matchCode % 255);
 1308|    508|            } else
 1309|  2.94k|                *token += (BYTE)(matchCode);
 1310|  3.45k|        }
 1311|       |        /* Ensure we have enough space for the last literals. */
 1312|  3.45k|        assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit));
  ------------------
  |  |  273|  3.45k|#    define assert(condition) ((void)0)
  ------------------
 1313|       |
 1314|  3.45k|        anchor = ip;
 1315|       |
 1316|       |        /* Test end of chunk */
 1317|  3.45k|        if (ip >= seqLimit) {
  ------------------
  |  Branch (1317:13): [True: 442, False: 3.01k]
  ------------------
 1318|    442|            if ((suspend == NULL) || (ip >= mflimitPlusOne)) break;
  ------------------
  |  Branch (1318:17): [True: 442, 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|    442|        }
 1326|       |
 1327|  3.01k|_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|  3.01k|        if (tableType == byPtr) {
  ------------------
  |  Branch (1331:13): [True: 0, False: 3.01k]
  ------------------
 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|  3.01k|        } else {   /* byU32, byU16 */
 1345|       |
 1346|  3.01k|            U32 const h = LZ4_hashPosition(ip, tableType);
 1347|  3.01k|            U32 const current = (U32)(ip-base);
 1348|  3.01k|            U32 const hPrev = LZ4_hashPosition(ip-1, tableType);
 1349|  3.01k|            U32 prevIndex = LZ4_getIndexOnHash(hPrev, cctx->hashTable, tableType);
 1350|  3.01k|            U32 matchIndex;
 1351|  3.01k|            LZ4_putIndexOnHash(current-1, hPrev, cctx->hashTable, tableType);
 1352|  3.01k|            if ((dictDirective == usingDictCtx) && (prevIndex < startIndex)) {
  ------------------
  |  Branch (1352:17): [True: 0, False: 3.01k]
  |  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|  3.01k|            {   /* 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|  3.01k|                int const usedTable = (dictDirective == noDict) && (dictIssue == dictSmall);
  ------------------
  |  Branch (1358:39): [True: 3.01k, False: 0]
  |  Branch (1358:68): [True: 3.00k, False: 8]
  ------------------
 1359|  3.01k|                U32 const ctxIndex = ((usedTable && (prevIndex < startIndex)) ? startIndex : prevIndex) + 1;
  ------------------
  |  Branch (1359:40): [True: 3.00k, False: 8]
  |  Branch (1359:53): [True: 1.74k, False: 1.26k]
  ------------------
 1360|  3.01k|                int const inDict = (dictDirective == usingExtDict || dictDirective == usingDictCtx) && (ctxIndex < startIndex);
  ------------------
  |  Branch (1360:37): [True: 0, False: 3.01k]
  |  Branch (1360:70): [True: 0, False: 3.01k]
  |  Branch (1360:104): [True: 0, False: 0]
  ------------------
 1361|  3.01k|                if ( ((dictIssue==dictSmall) ? (ctxIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1361:22): [True: 3.01k, False: 0]
  |  Branch (1361:23): [True: 3.00k, False: 8]
  ------------------
 1362|  3.01k|                  && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (ctxIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  691|  3.01k|#  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|  3.01k|#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: 3.01k, False: 0]
  |  Branch (1362:24): [True: 3.01k, False: 0]
  |  Branch (1362:46): [True: 0, Folded]
  ------------------
 1363|  3.01k|                  && (!inDict || (ctxIndex + 8 <= startIndex))   /* the 8 compared bytes are within the dictionary */
  ------------------
  |  Branch (1363:23): [True: 3.01k, False: 0]
  |  Branch (1363:34): [True: 0, False: 0]
  ------------------
 1364|  3.01k|                  && LZ4_match8(inDict ? dictBase + (ctxIndex - dictDelta) : base + ctxIndex, ip) ) {
  ------------------
  |  Branch (1364:22): [True: 762, False: 2.25k]
  |  Branch (1364:33): [True: 0, False: 3.01k]
  ------------------
 1365|    762|                    matchIndex = ctxIndex;
 1366|  2.25k|                } else {
 1367|  2.25k|                    matchIndex = LZ4_getIndexOnHash(h, cctx->hashTable, tableType);
 1368|  2.25k|                    if ((dictDirective == usingDictCtx) && (matchIndex < startIndex))
  ------------------
  |  Branch (1368:25): [True: 0, False: 2.25k]
  |  Branch (1368:60): [True: 0, False: 0]
  ------------------
 1369|      0|                        matchIndex = LZ4_getIndexOnHash(h, dictCtx->hashTable, byU32) + dictDelta;
 1370|  2.25k|                }
 1371|  3.01k|            }
 1372|  3.01k|            assert(matchIndex < current);
  ------------------
  |  |  273|  3.01k|#    define assert(condition) ((void)0)
  ------------------
 1373|  3.01k|            if (dictDirective == usingExtDict) {   /* select without branch */
  ------------------
  |  Branch (1373:17): [True: 0, False: 3.01k]
  ------------------
 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|  3.01k|            } else if ((dictDirective == usingDictCtx) && (matchIndex < startIndex)) {
  ------------------
  |  Branch (1376:24): [True: 0, False: 3.01k]
  |  Branch (1376:59): [True: 0, False: 0]
  ------------------
 1377|      0|                match = dictBase + (matchIndex - dictDelta);
 1378|      0|                lowLimit = dictionary;   /* required for match length counter */
 1379|  3.01k|            } else {
 1380|  3.01k|                match = base + matchIndex;
 1381|  3.01k|                if (dictDirective == usingDictCtx)
  ------------------
  |  Branch (1381:21): [True: 0, False: 3.01k]
  ------------------
 1382|      0|                    lowLimit = (const BYTE*)source;   /* required for match length counter */
 1383|  3.01k|            }
 1384|  3.01k|            LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType);
 1385|  3.01k|            assert(matchIndex < current);
  ------------------
  |  |  273|  3.01k|#    define assert(condition) ((void)0)
  ------------------
 1386|  3.01k|            if ( ((dictIssue==dictSmall) ? (matchIndex >= prefixIdxLimit) : 1)
  ------------------
  |  Branch (1386:18): [True: 1.44k, False: 1.56k]
  |  Branch (1386:19): [True: 3.00k, False: 8]
  ------------------
 1387|  1.44k|              && (((tableType==byU16) && (LZ4_DISTANCE_MAX == LZ4_DISTANCE_ABSOLUTE_MAX)) ? 1 : (matchIndex+LZ4_DISTANCE_MAX >= current))
  ------------------
  |  |  691|  1.44k|#  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|  1.44k|#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: 1.44k, False: 0]
  |  Branch (1387:20): [True: 1.44k, False: 0]
  |  Branch (1387:42): [True: 0, Folded]
  ------------------
 1388|  1.44k|              && (LZ4_read32(match) == LZ4_read32(ip)) ) {
  ------------------
  |  Branch (1388:18): [True: 1.43k, False: 8]
  ------------------
 1389|  1.43k|                token=op++;
 1390|  1.43k|                *token=0;
 1391|  1.43k|                if (maybe_extMem) offset = current - matchIndex;
  ------------------
  |  Branch (1391:21): [True: 0, False: 1.43k]
  ------------------
 1392|  1.43k|                if (dictDirective == usingExtDict)
  ------------------
  |  Branch (1392:21): [True: 0, False: 1.43k]
  ------------------
 1393|      0|                    lowLimit = (matchIndex < startIndex) ? dictionary : (const BYTE*)source;   /* required for match length counter */
  ------------------
  |  Branch (1393:32): [True: 0, False: 0]
  ------------------
 1394|  1.43k|                DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i",
  ------------------
  |  |  289|  1.43k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1395|  1.43k|                            (int)(anchor-(const BYTE*)source), 0, (int)(ip-(const BYTE*)source));
 1396|  1.43k|                goto _next_match;
 1397|  1.43k|            }
 1398|  3.01k|        }
 1399|       |
 1400|       |        /* Prepare next loop */
 1401|  1.57k|        forwardH = LZ4_hashPosition(++ip, tableType);
 1402|       |
 1403|  1.57k|    }
 1404|       |
 1405|    654|_last_literals:
 1406|       |    /* Encode Last Literals */
 1407|    654|    {   size_t lastRun = (size_t)(iend - anchor);
 1408|    654|        if ( (outputDirective) &&  /* Check output buffer overflow */
  ------------------
  |  Branch (1408:14): [True: 654, False: 0]
  ------------------
 1409|    654|            (op + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > olimit)) {
  ------------------
  |  |  263|    654|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    654|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    654|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1409:13): [True: 14, False: 640]
  ------------------
 1410|     14|            if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1410:17): [True: 0, False: 14]
  ------------------
 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|     14|            } else {
 1416|     14|                assert(outputDirective == limitedOutput);
  ------------------
  |  |  273|     14|#    define assert(condition) ((void)0)
  ------------------
 1417|     14|                return 0;   /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */
 1418|     14|            }
 1419|     14|        }
 1420|    640|        DEBUGLOG(6, "Final literal run : %i literals", (int)lastRun);
  ------------------
  |  |  289|    640|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1421|    640|        if (lastRun >= RUN_MASK) {
  ------------------
  |  |  263|    640|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    640|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    640|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1421:13): [True: 177, False: 463]
  ------------------
 1422|    177|            size_t accumulator = lastRun - RUN_MASK;
  ------------------
  |  |  263|    177|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    177|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    177|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1423|    177|            *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  263|    177|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    177|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    177|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          *op++ = RUN_MASK << ML_BITS;
  ------------------
  |  |  260|    177|#define ML_BITS  4
  ------------------
 1424|    177|            for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
  ------------------
  |  Branch (1424:19): [True: 0, False: 177]
  ------------------
 1425|    177|            *op++ = (BYTE) accumulator;
 1426|    463|        } else {
 1427|    463|            *op++ = (BYTE)(lastRun<<ML_BITS);
  ------------------
  |  |  260|    463|#define ML_BITS  4
  ------------------
 1428|    463|        }
 1429|    640|        LZ4_memcpy(op, anchor, lastRun);
  ------------------
  |  |  349|    640|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 1430|    640|        ip = anchor + lastRun;
 1431|    640|        op += lastRun;
 1432|    640|    }
 1433|       |
 1434|    640|    if (outputDirective == fillOutput) {
  ------------------
  |  Branch (1434:9): [True: 0, False: 640]
  ------------------
 1435|      0|        *inputConsumed = (int) (((const char*)ip)-source);
 1436|      0|    }
 1437|    640|    result = (int)(((char*)op) - dest);
 1438|    640|    assert(result > 0);
  ------------------
  |  |  273|    640|#    define assert(condition) ((void)0)
  ------------------
 1439|    640|    DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result);
  ------------------
  |  |  289|    640|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 1440|    640|    return result;
 1441|    654|}
lz4.c:LZ4_putPosition:
  898|    654|{
  899|    654|    U32 const h = LZ4_hashPosition(p, tableType);
  900|    654|    if (tableType == byPtr) {
  ------------------
  |  Branch (900:9): [True: 0, False: 654]
  ------------------
  901|      0|        LZ4_putPositionOnHash(p, h, tableBase, byPtr);
  902|    654|    } else {
  903|    654|        LZ4_putIndexOnHash((U32)(p - base), h, tableBase, tableType);
  904|    654|    }
  905|    654|}
lz4.c:LZ4_wildCopy8:
  466|  4.91k|{
  467|  4.91k|    BYTE* d = (BYTE*)dstPtr;
  468|  4.91k|    const BYTE* s = (const BYTE*)srcPtr;
  469|  4.91k|    BYTE* const e = (BYTE*)dstEnd;
  470|       |
  471|  7.21k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  349|  7.21k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (471:50): [True: 2.30k, False: 4.91k]
  ------------------
  472|  4.91k|}
lz4.c:LZ4_writeLE16:
  453|  3.45k|{
  454|  3.45k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (454:9): [True: 3.45k, False: 0]
  ------------------
  455|  3.45k|        LZ4_write16(memPtr, value);
  456|  3.45k|    } else {
  457|      0|        BYTE* p = (BYTE*)memPtr;
  458|      0|        p[0] = (BYTE) value;
  459|      0|        p[1] = (BYTE)(value>>8);
  460|      0|    }
  461|  3.45k|}
lz4.c:LZ4_write16:
  397|  3.45k|static void LZ4_write16(void* memPtr, U16 value) { ((LZ4_unalign16*)memPtr)->u16 = value; }
lz4.c:LZ4_count:
  709|  3.45k|{
  710|  3.45k|    const BYTE* const pStart = pIn;
  711|       |
  712|  3.45k|    if (likely(pIn < pInLimit-(STEPSIZE-1))) {
  ------------------
  |  |  177|  3.45k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  3.45k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 3.26k, False: 194]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  713|  3.26k|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  714|  3.26k|        if (!diff) {
  ------------------
  |  Branch (714:13): [True: 1.13k, False: 2.13k]
  ------------------
  715|  1.13k|            pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  706|  1.13k|#define STEPSIZE sizeof(reg_t)
  ------------------
                          pIn+=STEPSIZE; pMatch+=STEPSIZE;
  ------------------
  |  |  706|  1.13k|#define STEPSIZE sizeof(reg_t)
  ------------------
  716|  2.13k|        } else {
  717|  2.13k|            return LZ4_NbCommonBytes(diff);
  718|  2.13k|    }   }
  719|       |
  720|  1.90k|    while (likely(pIn < pInLimit-(STEPSIZE-1))) {
  721|  1.90k|        reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
  722|  1.90k|        if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  706|    977|#define STEPSIZE sizeof(reg_t)
  ------------------
                      if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
  ------------------
  |  |  706|    977|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (722:13): [True: 977, False: 927]
  ------------------
  723|    927|        pIn += LZ4_NbCommonBytes(diff);
  724|    927|        return (unsigned)(pIn - pStart);
  725|  1.90k|    }
  726|       |
  727|    397|    if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  |  706|    397|#define STEPSIZE sizeof(reg_t)
  ------------------
  |  Branch (727:9): [True: 397, Folded]
  |  Branch (727:26): [True: 276, False: 121]
  |  Branch (727:48): [True: 136, False: 140]
  ------------------
  728|    397|    if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (728:9): [True: 321, False: 76]
  |  Branch (728:31): [True: 214, False: 107]
  ------------------
  729|    397|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (729:9): [True: 304, False: 93]
  |  Branch (729:27): [True: 197, False: 107]
  ------------------
  730|    397|    return (unsigned)(pIn - pStart);
  731|  1.32k|}
lz4.c:LZ4_NbCommonBytes:
  608|  3.05k|{
  609|  3.05k|    assert(val != 0);
  ------------------
  |  |  273|  3.05k|#    define assert(condition) ((void)0)
  ------------------
  610|  3.05k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (610:9): [True: 3.05k, False: 0]
  ------------------
  611|  3.05k|        if (sizeof(val) == 8) {
  ------------------
  |  Branch (611:13): [True: 3.05k, 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|  3.05k|        } 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|  3.05k|    } 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|  3.05k|}
lz4.c:LZ4_read16:
  393|  7.51k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  398|  2.29k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_match8:
  982|  3.01k|{
  983|  3.01k|    if (sizeof(reg_t) == 8) return LZ4_read_ARCH(p) == LZ4_read_ARCH(q);
  ------------------
  |  Branch (983:9): [True: 3.01k, 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|  3.01k|}
lz4.c:LZ4_decompress_generic:
 2225|  1.26k|{
 2226|  1.26k|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2226:9): [True: 0, False: 1.26k]
  |  Branch (2226:26): [True: 0, False: 1.26k]
  ------------------
 2227|       |
 2228|  1.26k|    {   const BYTE* ip = (const BYTE*) src;
 2229|  1.26k|        const BYTE* const iend = ip + srcSize;
 2230|       |
 2231|  1.26k|        BYTE* op = (BYTE*) dst;
 2232|  1.26k|        BYTE* const oend = op + outputSize;
 2233|       |
 2234|  1.26k|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2234:37): [True: 1.26k, False: 0]
  ------------------
 2235|       |
 2236|       |        /* withPrefix64k : offset <= 65535 can't reach beyond the 64 KB prefix */
 2237|  1.26k|        const int checkOffset = (dict != withPrefix64k) && (dictSize < (int)(64 KB));
  ------------------
  |  |  251|  1.26k|#define KB *(1 <<10)
  ------------------
  |  Branch (2237:33): [True: 1.26k, False: 0]
  |  Branch (2237:60): [True: 1.26k, False: 0]
  ------------------
 2238|       |
 2239|       |
 2240|       |        /* Set up the "end" pointers for the shortcut. */
 2241|  1.26k|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2242|  1.26k|        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|  1.26k|        const BYTE* match;
 2246|  1.26k|        size_t offset;
 2247|  1.26k|        size_t ml;   /* match length */
 2248|       |
 2249|       |
 2250|  1.26k|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  289|  1.26k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2251|       |
 2252|       |        /* Special cases */
 2253|  1.26k|        assert(lowPrefix <= op);
  ------------------
  |  |  273|  1.26k|#    define assert(condition) ((void)0)
  ------------------
 2254|  1.26k|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  180|  1.26k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.26k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 1.26k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|  1.26k|        if (unlikely(srcSize<=0)) { return -1; }
  ------------------
  |  |  180|  1.26k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.26k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 1.26k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|  1.26k|#if LZ4_FAST_DEC_LOOP
 2267|  1.26k|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  1.26k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2267:13): [True: 0, False: 1.26k]
  ------------------
 2268|      0|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2269|      0|            goto safe_decode;
 2270|      0|        }
 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|  1.26k|        if ( (dict==usingExtDict)
  ------------------
  |  Branch (2276:14): [True: 0, False: 1.26k]
  ------------------
 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|  1.26k|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  289|  1.26k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2287|  2.98k|        while (1) {
  ------------------
  |  Branch (2287:16): [True: 2.98k, Folded]
  ------------------
 2288|  2.98k|            unsigned token;
 2289|  2.98k|            size_t ll;   /* literal length */
 2290|  2.98k|            BYTE* cpy;
 2291|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2292|  2.98k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  273|  2.98k|#    define assert(condition) ((void)0)
  ------------------
 2293|  2.98k|            assert(ip < iend);
  ------------------
  |  |  273|  2.98k|#    define assert(condition) ((void)0)
  ------------------
 2294|  2.98k|            token = *ip++;
 2295|  2.98k|            ll = token >> ML_BITS;
  ------------------
  |  |  260|  2.98k|#define ML_BITS  4
  ------------------
 2296|  2.98k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  289|  2.98k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2297|       |
 2298|       |            /* too close to input end : the safe loop restarts this sequence */
 2299|  2.98k|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { ip--; break; }
  ------------------
  |  Branch (2299:17): [True: 59, False: 2.93k]
  ------------------
 2300|       |
 2301|       |            /* decode literal length */
 2302|  2.93k|            if (ll == RUN_MASK) {
  ------------------
  |  |  263|  2.93k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  2.93k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  2.93k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2302:17): [True: 239, False: 2.69k]
  ------------------
 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|    239|                const BYTE* const tokenPos = ip-1;
 2306|    239|                size_t const addl = read_variable_length(&ip, iend - RUN_MASK);
  ------------------
  |  |  263|    239|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    239|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    239|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2307|    239|                if (addl == rvl_error) {
  ------------------
  |  Branch (2307:21): [True: 0, False: 239]
  ------------------
 2308|      0|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  289|      0|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2309|      0|                    goto _output_error;
 2310|      0|                }
 2311|    239|                ll += addl;
 2312|    239|                if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    239|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    239|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 239]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2313|    239|                if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    239|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    239|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 239]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|    239|                cpy = op+ll;
 2318|    239|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|    239|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2319|    239|              #if LZ4_WILDCOPY64
 2320|    239|                if ((cpy>oend-64) || (ip+ll>iend-64)) { ip = tokenPos; break; }
  ------------------
  |  Branch (2320:21): [True: 234, False: 5]
  |  Branch (2320:38): [True: 5, False: 0]
  ------------------
 2321|      0|                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|      0|                ip += ll; op = cpy;
 2327|  2.69k|            } else {
 2328|  2.69k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)ll);
  ------------------
  |  |  289|  2.69k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2329|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2330|  2.69k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|  2.69k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2331|  2.69k|                ip += ll; op += ll;
 2332|  2.69k|            }
 2333|       |
 2334|       |            /* get offset */
 2335|  2.69k|            offset = LZ4_readLE16(ip); ip+=2;
 2336|  2.69k|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  289|  2.69k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2337|  2.69k|            match = op - offset;
 2338|  2.69k|            assert(match <= op);  /* overflow check */
  ------------------
  |  |  273|  2.69k|#    define assert(condition) ((void)0)
  ------------------
 2339|       |
 2340|       |            /* get matchlength */
 2341|  2.69k|            ml = token & ML_MASK;
  ------------------
  |  |  261|  2.69k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  2.69k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2342|  2.69k|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)ml, (unsigned)ml+MINMATCH);
  ------------------
  |  |  289|  2.69k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2343|       |
 2344|  2.69k|            if (ml == ML_MASK) {
  ------------------
  |  |  261|  2.69k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  2.69k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2344:17): [True: 587, False: 2.10k]
  ------------------
 2345|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2346|    587|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  245|    587|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2347|    587|                if (addl == rvl_error) {
  ------------------
  |  Branch (2347:21): [True: 1, False: 586]
  ------------------
 2348|      1|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  289|      1|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2349|      1|                    goto _output_error;
 2350|      1|                }
 2351|    586|                ml += addl;
 2352|    586|                DEBUGLOG(7, "  long match length == %u", (unsigned)ml + MINMATCH);
  ------------------
  |  |  289|    586|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2353|    586|                if (unlikely((uptrval)(op)+ml<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    586|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    586|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 586]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2354|    586|            }
 2355|  2.69k|            ml += MINMATCH;
  ------------------
  |  |  242|  2.69k|#define MINMATCH 4
  ------------------
 2356|       |
 2357|  2.69k|            if (op + ml >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  2.69k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2357:17): [True: 966, False: 1.72k]
  ------------------
 2358|    966|                DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)ml);
  ------------------
  |  |  289|    966|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2359|    966|                goto safe_match_copy;
 2360|    966|            }
 2361|       |
 2362|       |            /* match length from token only (<= 18), no overlap, within prefix : copy 18 bytes */
 2363|  1.72k|            if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  261|  1.72k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  1.72k|#define ML_BITS  4
  |  |  ------------------
  ------------------
                          if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  261|  1.72k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  1.72k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2363:18): [True: 1.41k, False: 308]
  |  Branch (2363:52): [True: 782, False: 634]
  ------------------
 2364|    782|              && ((dict == withPrefix64k) || (match >= lowPrefix)) ) {
  ------------------
  |  Branch (2364:19): [True: 0, False: 782]
  |  Branch (2364:46): [True: 782, False: 0]
  ------------------
 2365|    782|                assert(match >= lowPrefix);
  ------------------
  |  |  273|    782|#    define assert(condition) ((void)0)
  ------------------
 2366|    782|                assert(match <= op);
  ------------------
  |  |  273|    782|#    define assert(condition) ((void)0)
  ------------------
 2367|    782|                assert(op + 18 <= oend);
  ------------------
  |  |  273|    782|#    define assert(condition) ((void)0)
  ------------------
 2368|    782|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|    782|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2369|    782|                LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  349|    782|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2370|    782|                LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  349|    782|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2371|    782|                op += ml;
 2372|    782|                continue;
 2373|    782|            }
 2374|       |
 2375|       |            /* match ends far from oend : no end-of-block condition to check */
 2376|    942|            assert(op + ml < oend - FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  273|    942|#    define assert(condition) ((void)0)
  ------------------
 2377|       |
 2378|    942|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  180|    942|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    942|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2378:18): [True: 942, False: 0]
  |  Branch (2378:33): [True: 1, False: 941]
  ------------------
 2379|      1|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  289|      1|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2380|      1|                goto _offset_error;
 2381|      1|            }
 2382|       |            /* match starting within external dictionary */
 2383|    941|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2383:17): [True: 0, False: 941]
  |  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|    941|            cpy = op + ml;
 2391|       |
 2392|    941|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  |  273|    941|#    define assert(condition) ((void)0)
  ------------------
 2393|    941|            if (unlikely(offset<16)) {
  ------------------
  |  |  180|    941|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    941|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 885, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2394|    885|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2395|    885|    #if LZ4_WILDCOPY64
 2396|    885|            } else if (offset >= 64) {
  ------------------
  |  Branch (2396:24): [True: 0, False: 56]
  ------------------
 2397|      0|                LZ4_wildCopy64(op, match, cpy);
 2398|      0|    #endif
 2399|     56|            } else {
 2400|     56|                LZ4_wildCopy32(op, match, cpy);
 2401|     56|            }
 2402|       |
 2403|    941|            op = cpy;   /* wildcopy correction */
 2404|    941|        }
 2405|    298|    safe_decode:
 2406|    298|#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|    298|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  289|    298|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2413|  5.44k|        while (1) {
  ------------------
  |  Branch (2413:16): [True: 5.44k, Folded]
  ------------------
 2414|  5.44k|            unsigned token;
 2415|  5.44k|            size_t ll;   /* literal length */
 2416|  5.44k|            BYTE* cpy;
 2417|  5.44k|            assert(ip < iend);
  ------------------
  |  |  273|  5.44k|#    define assert(condition) ((void)0)
  ------------------
 2418|  5.44k|            token = *ip++;
 2419|  5.44k|            ll = token >> ML_BITS;
  ------------------
  |  |  260|  5.44k|#define ML_BITS  4
  ------------------
 2420|  5.44k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  289|  5.44k|#  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|  5.44k|            if ( (ll != RUN_MASK)
  ------------------
  |  |  263|  5.44k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  5.44k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  5.44k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2430:18): [True: 4.75k, False: 685]
  ------------------
 2431|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2432|  4.75k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  177|  4.75k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  4.75k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 1.95k, False: 2.80k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2433|       |                /* Copy the literals */
 2434|  1.95k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|  1.95k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2435|  1.95k|                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|  1.95k|                offset = LZ4_readLE16(ip); ip += 2;
 2440|  1.95k|                match = op - offset;
 2441|  1.95k|                assert(match <= op); /* check overflow */
  ------------------
  |  |  273|  1.95k|#    define assert(condition) ((void)0)
  ------------------
 2442|  1.95k|                ml = token & ML_MASK;
  ------------------
  |  |  261|  1.95k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  1.95k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2443|  1.95k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)ml, (unsigned)ml + 4);
  ------------------
  |  |  289|  1.95k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2444|       |
 2445|       |                /* Do not deal with overlapping matches. */
 2446|  1.95k|                if ( (ml != ML_MASK)
  ------------------
  |  |  261|  1.95k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  1.95k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2446:22): [True: 1.85k, False: 100]
  ------------------
 2447|  1.85k|                  && (offset >= 8)
  ------------------
  |  Branch (2447:22): [True: 1.26k, False: 586]
  ------------------
 2448|  1.26k|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2448:23): [True: 0, False: 1.26k]
  |  Branch (2448:46): [True: 1.26k, False: 0]
  ------------------
 2449|       |                    /* Copy the match. */
 2450|  1.26k|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  349|  1.26k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2451|  1.26k|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  349|  1.26k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2452|  1.26k|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  349|  1.26k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2453|  1.26k|                    op += ml + MINMATCH;
  ------------------
  |  |  242|  1.26k|#define MINMATCH 4
  ------------------
 2454|       |                    /* Both stages worked, load the next token. */
 2455|  1.26k|                    continue;
 2456|  1.26k|                }
 2457|       |                /* The second stage didn't work out, but the info is ready for the match copy below. */
 2458|  3.49k|            } else {
 2459|       |                /* decode literal length */
 2460|  3.49k|                if (ll == RUN_MASK) {
  ------------------
  |  |  263|  3.49k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  3.49k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  3.49k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2460:21): [True: 685, False: 2.80k]
  ------------------
 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|    685|                    size_t const addl = read_variable_length(&ip, iend-RUN_MASK);
  ------------------
  |  |  263|    685|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    685|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    685|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2464|    685|                    if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2464:25): [True: 0, False: 685]
  ------------------
 2465|    685|                    ll += addl;
 2466|    685|                    if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    685|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    685|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 685]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2467|    685|                    if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    685|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    685|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 685]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2468|    685|                }
 2469|       |
 2470|       |                /* copy literals */
 2471|  3.49k|                cpy = op+ll;
 2472|  3.49k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|  3.49k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2473|  3.49k|                if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|  3.49k|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                              if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|  2.23k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2473:21): [True: 1.26k, False: 2.23k]
  |  Branch (2473:43): [True: 2, False: 2.22k]
  ------------------
 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|  1.26k|                    if (partialDecoding) {
  ------------------
  |  Branch (2476:25): [True: 0, False: 1.26k]
  ------------------
 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|  1.26k|                    } else if ((ip+ll != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2480:32): [True: 2, False: 1.26k]
  |  Branch (2480:51): [True: 0, False: 1.26k]
  ------------------
 2481|       |                        /* last literals must end exactly at input end, within output */
 2482|      2|                        DEBUGLOG(5, "invalid last literals : they end at iend%+zi and oend%+zi", (ip+ll)-iend, cpy-oend);
  ------------------
  |  |  289|      2|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2483|      2|                        if ((ip+ll <= iend) && (cpy > oend-MFLIMIT)) goto _dst_too_small;   /* output full, input left */
  ------------------
  |  |  246|      1|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2483:29): [True: 1, False: 1]
  |  Branch (2483:48): [True: 0, False: 1]
  ------------------
 2484|      2|                        goto _output_error;
 2485|      2|                    }
 2486|  1.26k|                    LZ4_memmove(op, ip, ll);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  357|  1.26k|#    define LZ4_memmove __builtin_memmove
  ------------------
 2487|  1.26k|                    ip += ll;
 2488|  1.26k|                    op += ll;
 2489|       |                    /* end of block, unless partialDecoding can go on : output not full, input left for a match */
 2490|  1.26k|                    if (!partialDecoding || (op == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2490:25): [True: 1.26k, False: 0]
  |  Branch (2490:45): [True: 0, False: 0]
  |  Branch (2490:61): [True: 0, False: 0]
  ------------------
 2491|  1.26k|                        break;
 2492|  1.26k|                    }
 2493|  2.22k|                } else {
 2494|  2.22k|                    LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2495|  2.22k|                    ip += ll; op = cpy;
 2496|  2.22k|                }
 2497|       |
 2498|       |                /* get offset */
 2499|  2.22k|                offset = LZ4_readLE16(ip); ip+=2;
 2500|  2.22k|                match = op - offset;
 2501|       |
 2502|       |                /* get matchlength */
 2503|  2.22k|                ml = token & ML_MASK;
  ------------------
  |  |  261|  2.22k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  2.22k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2504|  2.22k|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ml);
  ------------------
  |  |  289|  2.22k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2505|  2.22k|            }
 2506|       |
 2507|       |            /* literals copied, offset decoded, ml == match length token */
 2508|  2.91k|            if (ml == ML_MASK) {
  ------------------
  |  |  261|  2.91k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  2.91k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2508:17): [True: 426, False: 2.48k]
  ------------------
 2509|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2510|    426|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  245|    426|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2511|    426|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2511:21): [True: 0, False: 426]
  ------------------
 2512|    426|                ml += addl;
 2513|    426|                if (unlikely((uptrval)(op)+ml<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  180|    426|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    426|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 426]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2514|    426|            }
 2515|  2.91k|            ml += MINMATCH;
  ------------------
  |  |  242|  2.91k|#define MINMATCH 4
  ------------------
 2516|       |
 2517|  2.91k|#if LZ4_FAST_DEC_LOOP
 2518|  3.88k|        safe_match_copy:
 2519|  3.88k|#endif
 2520|       |            /* literals copied, match fully decoded (ml includes MINMATCH), offset not validated yet */
 2521|  3.88k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _offset_error;   /* Error : offset outside buffers */
  ------------------
  |  |  180|  3.88k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  3.88k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2521:17): [True: 3.88k, False: 0]
  |  Branch (2521:34): [True: 2, False: 3.87k]
  ------------------
 2522|       |
 2523|       |            /* end of block : the last LASTLITERALS bytes must be literals */
 2524|  3.87k|            assert(op <= oend);
  ------------------
  |  |  273|  3.87k|#    define assert(condition) ((void)0)
  ------------------
 2525|  3.87k|            if (unlikely(op+ml > oend-LASTLITERALS)) {
  ------------------
  |  |  180|  3.87k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  3.87k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 3.87k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2526|      0|                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: 0]
  ------------------
 2527|      0|                else goto _dst_too_small;
 2528|      0|            }
 2529|       |
 2530|       |            /* match starting within external dictionary */
 2531|  3.87k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2531:17): [True: 0, False: 3.87k]
  |  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|  3.87k|            assert(match >= lowPrefix);
  ------------------
  |  |  273|  3.87k|#    define assert(condition) ((void)0)
  ------------------
 2537|       |
 2538|       |            /* close to block end : no wild copy */
 2539|  3.87k|            if (unlikely(op+ml > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  180|  3.87k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  3.87k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 864, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2540|    864|                op = LZ4_copyMatchExact(op, match, ml);
 2541|    864|                if (op == oend) { break; }   /* partialDecoding : output buffer full */
  ------------------
  |  Branch (2541:21): [True: 0, False: 864]
  ------------------
 2542|    864|                continue;
 2543|    864|            }
 2544|       |
 2545|       |            /* copy match within block */
 2546|  3.01k|            cpy = op + ml;
 2547|  3.01k|            LZ4_memcpy_using_offset_base(op, match, cpy, offset);
 2548|  3.01k|            op = cpy;   /* wildcopy correction */
 2549|  3.01k|        }
 2550|       |
 2551|       |        /* end of decoding */
 2552|  1.26k|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  289|  1.26k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2553|  1.26k|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2554|       |
 2555|       |        /* errors : see LZ4_decompress_safe() in lz4.h */
 2556|      3|    _output_error:
 2557|      3|        return -1;
 2558|      0|    _dst_too_small:
 2559|      0|        return -2;
 2560|      3|    _offset_error:
 2561|      3|        return -3;
 2562|    298|    }
 2563|    298|}
lz4.c:read_variable_length:
 2132|  1.93k|{
 2133|  1.93k|    Rvl_t s, length = 0;
 2134|  1.93k|    assert(ipPtr != NULL);
  ------------------
  |  |  273|  1.93k|#    define assert(condition) ((void)0)
  ------------------
 2135|  1.93k|    assert(*ipPtr !=  NULL);
  ------------------
  |  |  273|  1.93k|#    define assert(condition) ((void)0)
  ------------------
 2136|  1.93k|    assert(ilimit != NULL);
  ------------------
  |  |  273|  1.93k|#    define assert(condition) ((void)0)
  ------------------
 2137|  1.93k|    if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  1.93k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.93k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 1, False: 1.93k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2138|      1|        return rvl_error;
 2139|      1|    }
 2140|  1.93k|    s = **ipPtr;
 2141|  1.93k|    (*ipPtr)++;
 2142|  1.93k|    length += s;
 2143|  1.93k|    if (likely(s != 255)) return length;
  ------------------
  |  |  177|  1.93k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  1.93k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 1.93k, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2144|      5|    do {
 2145|      5|        if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|      5|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|      5|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2146|      0|            return rvl_error;
 2147|      0|        }
 2148|      5|        s = **ipPtr;
 2149|      5|        (*ipPtr)++;
 2150|      5|        length += s;
 2151|       |        /* accumulator overflow detection (32-bit mode only) */
 2152|      5|        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: 5]
  ------------------
 2153|      0|            return rvl_error;
 2154|      0|        }
 2155|      5|    } while (s == 255);
  ------------------
  |  Branch (2155:14): [True: 2, False: 3]
  ------------------
 2156|       |
 2157|      3|    return length;
 2158|      3|}
lz4.c:LZ4_readLE16:
  431|  6.87k|{
  432|  6.87k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (432:9): [True: 6.87k, False: 0]
  ------------------
  433|  6.87k|        return LZ4_read16(memPtr);
  434|  6.87k|    } else {
  435|      0|        const BYTE* p = (const BYTE*)memPtr;
  436|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  437|      0|    }
  438|  6.87k|}
lz4.c:LZ4_memcpy_using_offset:
  564|    885|{
  565|    885|    BYTE v[8];
  566|       |
  567|    885|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  |  273|    885|#    define assert(condition) ((void)0)
  ------------------
  568|       |
  569|    885|    switch(offset) {
  570|    624|    case 1:
  ------------------
  |  Branch (570:5): [True: 624, False: 261]
  ------------------
  571|    624|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  236|    624|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|    624|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  572|    624|        break;
  573|    130|    case 2:
  ------------------
  |  Branch (573:5): [True: 130, False: 755]
  ------------------
  574|    130|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  349|    130|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  575|    130|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  349|    130|#    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|    130|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  349|    130|#    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|    130|        break;
  585|     17|    case 4:
  ------------------
  |  Branch (585:5): [True: 17, False: 868]
  ------------------
  586|     17|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  349|     17|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  587|     17|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  349|     17|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  588|     17|        break;
  589|    114|    default:
  ------------------
  |  Branch (589:5): [True: 114, False: 771]
  ------------------
  590|    114|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  591|    114|        return;
  592|    885|    }
  593|       |
  594|    771|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|    771|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  595|    771|    dstPtr += 8;
  596|  1.72k|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (596:12): [True: 949, False: 771]
  ------------------
  597|    949|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|    949|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  598|    949|        dstPtr += 8;
  599|    949|    }
  600|    771|}
lz4.c:LZ4_wildCopy32:
  551|     56|{
  552|     56|    BYTE* d = (BYTE*)dstPtr;
  553|     56|    const BYTE* s = (const BYTE*)srcPtr;
  554|     56|    BYTE* const e = (BYTE*)dstEnd;
  555|       |
  556|     60|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  349|     60|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
                  do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  349|     60|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (556:79): [True: 4, False: 56]
  ------------------
  557|     56|}
lz4.c:LZ4_copyMatchExact:
 2167|    864|{
 2168|    864|    if (unlikely(match == op)) {   /* invalid offset 0 : clear the match segment, see doc/lz4_Block_format.md */
  ------------------
  |  |  180|    864|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    864|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 864]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2169|      0|        MEM_INIT(op, 0, length);
  ------------------
  |  |  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))
  |  |  ------------------
  ------------------
 2170|      0|        return op + length;
 2171|      0|    }
 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|  1.51k|    while (length > (size_t)(op - match)) {
  ------------------
  |  Branch (2175:12): [True: 648, False: 864]
  ------------------
 2176|    648|        size_t const available = (size_t)(op - match);
 2177|    648|        LZ4_memcpy(op, match, available);
  ------------------
  |  |  349|    648|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2178|    648|        op += available;
 2179|    648|        length -= available;
 2180|    648|        if (available >= 2048) match += available;
  ------------------
  |  Branch (2180:13): [True: 0, False: 648]
  ------------------
 2181|    648|    }
 2182|    864|    LZ4_memcpy(op, match, length);
  ------------------
  |  |  349|    864|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2183|    864|    return op + length;
 2184|    864|}
lz4.c:LZ4_memcpy_using_offset_base:
  497|  3.12k|{
  498|  3.12k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  |  273|  3.12k|#    define assert(condition) ((void)0)
  ------------------
  499|  3.12k|    if (unlikely(offset < 8)) {
  ------------------
  |  |  180|  3.12k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  3.12k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 1.78k, False: 1.34k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  500|  1.78k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  501|  1.78k|        dstPtr[0] = srcPtr[0];
  502|  1.78k|        dstPtr[1] = srcPtr[1];
  503|  1.78k|        dstPtr[2] = srcPtr[2];
  504|  1.78k|        dstPtr[3] = srcPtr[3];
  505|  1.78k|        srcPtr += inc32table[offset];
  506|  1.78k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  349|  1.78k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  507|  1.78k|        srcPtr -= dec64table[offset];
  508|  1.78k|    } else {
  509|  1.34k|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|  1.34k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  510|  1.34k|        srcPtr += 8;
  511|  1.34k|    }
  512|  3.12k|    dstPtr += 8;
  513|       |
  514|       |    /* srcPtr is now at least 8 bytes behind dstPtr */
  515|  3.12k|    LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|  3.12k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  516|  3.12k|    if (dstEnd > dstPtr + 8) { LZ4_wildCopy8(dstPtr + 8, srcPtr + 8, dstEnd); }
  ------------------
  |  Branch (516:9): [True: 664, False: 2.46k]
  ------------------
  517|  3.12k|}

stream_size:
  189|    403|{
  190|    403|  return (size_t)(s->ptr - s->begin) * sizeof(bitstream_word);
  191|    403|}
stream_rtell:
  318|    268|{
  319|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize - s->bits;
  ------------------
  |  |  130|    268|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  320|    268|}
stream_rewind:
  332|  1.07k|{
  333|  1.07k|  s->ptr = s->begin;
  334|  1.07k|  s->buffer = 0;
  335|  1.07k|  s->bits = 0;
  336|  1.07k|}
stream_rseek:
  341|    268|{
  342|    268|  bitstream_count n = (bitstream_count)(offset % wsize);
  ------------------
  |  |  130|    268|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  343|    268|  s->ptr = s->begin + (size_t)(offset / wsize);
  ------------------
  |  |  130|    268|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  344|    268|  if (n) {
  ------------------
  |  Branch (344:7): [True: 0, False: 268]
  ------------------
  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|    268|  else {
  349|    268|    s->buffer = 0;
  350|    268|    s->bits = 0;
  351|    268|  }
  352|    268|}
stream_skip:
  375|    268|{
  376|    268|  stream_rseek(s, stream_rtell(s) + n);
  377|    268|}
stream_pad:
  382|    135|{
  383|    135|  bitstream_offset bits = s->bits;
  384|    270|  for (bits += n; bits >= wsize; bits -= wsize) {
  ------------------
  |  |  130|    270|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
                for (bits += n; bits >= wsize; bits -= wsize) {
  ------------------
  |  |  130|    135|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (384:19): [True: 135, False: 135]
  ------------------
  385|    135|    stream_write_word(s, s->buffer);
  386|    135|    s->buffer = 0;
  387|    135|  }
  388|    135|  s->bits = (bitstream_count)bits;
  389|    135|}
stream_align:
  394|    268|{
  395|    268|  bitstream_count bits = s->bits;
  396|    268|  if (bits)
  ------------------
  |  Branch (396:7): [True: 268, False: 0]
  ------------------
  397|    268|    stream_skip(s, bits);
  398|    268|  return bits;
  399|    268|}
stream_flush:
  404|    135|{
  405|    135|  bitstream_count bits = (wsize - s->bits) % wsize;
  ------------------
  |  |  130|    135|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
                bitstream_count bits = (wsize - s->bits) % wsize;
  ------------------
  |  |  130|    135|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  406|    135|  if (bits)
  ------------------
  |  Branch (406:7): [True: 135, False: 0]
  ------------------
  407|    135|    stream_pad(s, bits);
  408|    135|  return bits;
  409|    135|}
stream_open:
  443|    538|{
  444|    538|  bitstream* s = (bitstream*)malloc(sizeof(bitstream));
  445|    538|  if (s) {
  ------------------
  |  Branch (445:7): [True: 538, False: 0]
  ------------------
  446|    538|    s->begin = (bitstream_word*)buffer;
  447|    538|    s->end = s->begin + bytes / sizeof(bitstream_word);
  448|       |#ifdef BIT_STREAM_STRIDED
  449|       |    stream_set_stride(s, 0, 0);
  450|       |#endif
  451|    538|    stream_rewind(s);
  452|    538|  }
  453|    538|  return s;
  454|    538|}
stream_close:
  459|    538|{
  460|    538|  free(s);
  461|    538|}
bitstream.c:stream_write_word:
  162|    135|{
  163|    135|  *s->ptr++ = value;
  164|       |#ifdef BIT_STREAM_STRIDED
  165|       |  if (!((s->ptr - s->begin) & s->mask))
  166|       |    s->ptr += s->delta;
  167|       |#endif
  168|    135|}
encode3f.c:stream_write_bits:
  290|  1.38k|{
  291|       |  /* append bit string to buffer */
  292|  1.38k|  s->buffer += (bitstream_word)(value << s->bits);
  293|  1.38k|  s->bits += n;
  294|       |  /* is buffer full? */
  295|  1.38k|  if (s->bits >= wsize) {
  ------------------
  |  |  130|  1.38k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (295:7): [True: 874, False: 506]
  ------------------
  296|       |    /* 1 <= n <= 64; decrement n to ensure valid right shifts below */
  297|    874|    value >>= 1;
  298|    874|    n--;
  299|       |    /* assert: 0 <= n < 64; wsize <= s->bits <= wsize + n */
  300|    874|    do {
  301|       |      /* output wsize bits while buffer is full */
  302|    874|      s->bits -= wsize;
  ------------------
  |  |  130|    874|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  303|       |      /* assert: 0 <= s->bits <= n */
  304|    874|      stream_write_word(s, s->buffer);
  305|       |      /* assert: 0 <= n - s->bits < 64 */
  306|    874|      s->buffer = (bitstream_word)(value >> (n - s->bits));
  307|    874|    } 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: 874]
  |  Branch (307:51): [True: 0, False: 0]
  ------------------
  308|    874|  }
  309|       |  /* assert: 0 <= s->bits < wsize */
  310|  1.38k|  s->buffer &= ((bitstream_word)1 << s->bits) - 1;
  311|       |  /* assert: 0 <= n < 64 */
  312|  1.38k|  return value >> n;
  313|  1.38k|}
encode3f.c:stream_write_word:
  162|    957|{
  163|    957|  *s->ptr++ = value;
  164|       |#ifdef BIT_STREAM_STRIDED
  165|       |  if (!((s->ptr - s->begin) & s->mask))
  166|       |    s->ptr += s->delta;
  167|       |#endif
  168|    957|}
encode3f.c:stream_wtell:
  325|     78|{
  326|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize + s->bits;
  ------------------
  |  |  130|     78|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  327|     78|}
encode3f.c:stream_write_bit:
  242|  3.49k|{
  243|  3.49k|  s->buffer += (bitstream_word)bit << s->bits;
  244|  3.49k|  if (++s->bits == wsize) {
  ------------------
  |  |  130|  3.49k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (244:7): [True: 48, False: 3.45k]
  ------------------
  245|     48|    stream_write_word(s, s->buffer);
  246|     48|    s->buffer = 0;
  247|     48|    s->bits = 0;
  248|     48|  }
  249|  3.49k|  return bit;
  250|  3.49k|}
encode3f.c:stream_pad:
  382|      7|{
  383|      7|  bitstream_offset bits = s->bits;
  384|     42|  for (bits += n; bits >= wsize; bits -= wsize) {
  ------------------
  |  |  130|     42|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
                for (bits += n; bits >= wsize; bits -= wsize) {
  ------------------
  |  |  130|     35|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (384:19): [True: 35, False: 7]
  ------------------
  385|     35|    stream_write_word(s, s->buffer);
  386|     35|    s->buffer = 0;
  387|     35|  }
  388|      7|  s->bits = (bitstream_count)bits;
  389|      7|}
encode3d.c:stream_write_bits:
  290|  1.22k|{
  291|       |  /* append bit string to buffer */
  292|  1.22k|  s->buffer += (bitstream_word)(value << s->bits);
  293|  1.22k|  s->bits += n;
  294|       |  /* is buffer full? */
  295|  1.22k|  if (s->bits >= wsize) {
  ------------------
  |  |  130|  1.22k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (295:7): [True: 987, False: 234]
  ------------------
  296|       |    /* 1 <= n <= 64; decrement n to ensure valid right shifts below */
  297|    987|    value >>= 1;
  298|    987|    n--;
  299|       |    /* assert: 0 <= n < 64; wsize <= s->bits <= wsize + n */
  300|    987|    do {
  301|       |      /* output wsize bits while buffer is full */
  302|    987|      s->bits -= wsize;
  ------------------
  |  |  130|    987|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  303|       |      /* assert: 0 <= s->bits <= n */
  304|    987|      stream_write_word(s, s->buffer);
  305|       |      /* assert: 0 <= n - s->bits < 64 */
  306|    987|      s->buffer = (bitstream_word)(value >> (n - s->bits));
  307|    987|    } 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: 987]
  |  Branch (307:51): [True: 0, False: 0]
  ------------------
  308|    987|  }
  309|       |  /* assert: 0 <= s->bits < wsize */
  310|  1.22k|  s->buffer &= ((bitstream_word)1 << s->bits) - 1;
  311|       |  /* assert: 0 <= n < 64 */
  312|  1.22k|  return value >> n;
  313|  1.22k|}
encode3d.c:stream_write_word:
  162|  1.03k|{
  163|  1.03k|  *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.03k|}
encode3d.c:stream_wtell:
  325|     48|{
  326|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize + s->bits;
  ------------------
  |  |  130|     48|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  327|     48|}
encode3d.c:stream_write_bit:
  242|  2.64k|{
  243|  2.64k|  s->buffer += (bitstream_word)bit << s->bits;
  244|  2.64k|  if (++s->bits == wsize) {
  ------------------
  |  |  130|  2.64k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (244:7): [True: 50, False: 2.59k]
  ------------------
  245|     50|    stream_write_word(s, s->buffer);
  246|     50|    s->buffer = 0;
  247|     50|    s->bits = 0;
  248|     50|  }
  249|  2.64k|  return bit;
  250|  2.64k|}
decode3f.c:stream_read_bit:
  227|  6.95k|{
  228|  6.95k|  uint bit;
  229|  6.95k|  if (!s->bits) {
  ------------------
  |  Branch (229:7): [True: 176, False: 6.77k]
  ------------------
  230|    176|    s->buffer = stream_read_word(s);
  231|       |    s->bits = wsize;
  ------------------
  |  |  130|    176|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  232|    176|  }
  233|  6.95k|  s->bits--;
  234|  6.95k|  bit = (uint)s->buffer & 1u;
  235|  6.95k|  s->buffer >>= 1;
  236|  6.95k|  return bit;
  237|  6.95k|}
decode3f.c:stream_read_word:
  150|  1.88k|{
  151|  1.88k|  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|  1.88k|  return w;
  157|  1.88k|}
decode3f.c:stream_read_bits:
  255|  2.69k|{
  256|  2.69k|  uint64 value = s->buffer;
  257|  2.69k|  if (s->bits < n) {
  ------------------
  |  Branch (257:7): [True: 1.69k, False: 996]
  ------------------
  258|       |    /* keep fetching wsize bits until enough bits are buffered */
  259|  1.69k|    do {
  260|       |      /* assert: 0 <= s->bits < n <= 64 */
  261|  1.69k|      s->buffer = stream_read_word(s);
  262|  1.69k|      value += (uint64)s->buffer << s->bits;
  263|  1.69k|      s->bits += wsize;
  ------------------
  |  |  130|  1.69k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  264|  1.69k|    } while (sizeof(s->buffer) < sizeof(value) && s->bits < n);
  ------------------
  |  Branch (264:14): [Folded, False: 1.69k]
  |  Branch (264:51): [True: 0, False: 0]
  ------------------
  265|       |    /* assert: 1 <= n <= s->bits < n + wsize */
  266|  1.69k|    s->bits -= n;
  267|  1.69k|    if (!s->bits) {
  ------------------
  |  Branch (267:9): [True: 0, False: 1.69k]
  ------------------
  268|       |      /* value holds exactly n bits; no need for masking */
  269|      0|      s->buffer = 0;
  270|      0|    }
  271|  1.69k|    else {
  272|       |      /* assert: 1 <= s->bits < wsize */
  273|  1.69k|      s->buffer >>= wsize - s->bits;
  ------------------
  |  |  130|  1.69k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  274|       |      /* assert: 1 <= n <= 64 */
  275|  1.69k|      value &= ((uint64)2 << (n - 1)) - 1;
  276|  1.69k|    }
  277|  1.69k|  }
  278|    996|  else {
  279|       |    /* assert: 0 <= n <= s->bits < wsize <= 64 */
  280|    996|    s->bits -= n;
  281|    996|    s->buffer >>= n;
  282|    996|    value &= ((uint64)1 << n) - 1;
  283|    996|  }
  284|  2.69k|  return value;
  285|  2.69k|}
decode3f.c:stream_rtell:
  318|    166|{
  319|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize - s->bits;
  ------------------
  |  |  130|    166|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  320|    166|}
decode3f.c:stream_skip:
  375|     14|{
  376|     14|  stream_rseek(s, stream_rtell(s) + n);
  377|     14|}
decode3f.c:stream_rseek:
  341|     14|{
  342|     14|  bitstream_count n = (bitstream_count)(offset % wsize);
  ------------------
  |  |  130|     14|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  343|     14|  s->ptr = s->begin + (size_t)(offset / wsize);
  ------------------
  |  |  130|     14|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  344|     14|  if (n) {
  ------------------
  |  Branch (344:7): [True: 14, False: 0]
  ------------------
  345|     14|    s->buffer = stream_read_word(s) >> n;
  346|     14|    s->bits = wsize - n;
  ------------------
  |  |  130|     14|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  347|     14|  }
  348|      0|  else {
  349|      0|    s->buffer = 0;
  350|      0|    s->bits = 0;
  351|      0|  }
  352|     14|}
decode3d.c:stream_read_bit:
  227|  5.36k|{
  228|  5.36k|  uint bit;
  229|  5.36k|  if (!s->bits) {
  ------------------
  |  Branch (229:7): [True: 156, False: 5.20k]
  ------------------
  230|    156|    s->buffer = stream_read_word(s);
  231|       |    s->bits = wsize;
  ------------------
  |  |  130|    156|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  232|    156|  }
  233|  5.36k|  s->bits--;
  234|  5.36k|  bit = (uint)s->buffer & 1u;
  235|  5.36k|  s->buffer >>= 1;
  236|  5.36k|  return bit;
  237|  5.36k|}
decode3d.c:stream_read_word:
  150|  2.13k|{
  151|  2.13k|  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.13k|  return w;
  157|  2.13k|}
decode3d.c:stream_read_bits:
  255|  2.44k|{
  256|  2.44k|  uint64 value = s->buffer;
  257|  2.44k|  if (s->bits < n) {
  ------------------
  |  Branch (257:7): [True: 1.98k, False: 460]
  ------------------
  258|       |    /* keep fetching wsize bits until enough bits are buffered */
  259|  1.98k|    do {
  260|       |      /* assert: 0 <= s->bits < n <= 64 */
  261|  1.98k|      s->buffer = stream_read_word(s);
  262|  1.98k|      value += (uint64)s->buffer << s->bits;
  263|  1.98k|      s->bits += wsize;
  ------------------
  |  |  130|  1.98k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  264|  1.98k|    } while (sizeof(s->buffer) < sizeof(value) && s->bits < n);
  ------------------
  |  Branch (264:14): [Folded, False: 1.98k]
  |  Branch (264:51): [True: 0, False: 0]
  ------------------
  265|       |    /* assert: 1 <= n <= s->bits < n + wsize */
  266|  1.98k|    s->bits -= n;
  267|  1.98k|    if (!s->bits) {
  ------------------
  |  Branch (267:9): [True: 0, False: 1.98k]
  ------------------
  268|       |      /* value holds exactly n bits; no need for masking */
  269|      0|      s->buffer = 0;
  270|      0|    }
  271|  1.98k|    else {
  272|       |      /* assert: 1 <= s->bits < wsize */
  273|  1.98k|      s->buffer >>= wsize - s->bits;
  ------------------
  |  |  130|  1.98k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  274|       |      /* assert: 1 <= n <= 64 */
  275|  1.98k|      value &= ((uint64)2 << (n - 1)) - 1;
  276|  1.98k|    }
  277|  1.98k|  }
  278|    460|  else {
  279|       |    /* assert: 0 <= n <= s->bits < wsize <= 64 */
  280|    460|    s->bits -= n;
  281|    460|    s->buffer >>= n;
  282|    460|    value &= ((uint64)1 << n) - 1;
  283|    460|  }
  284|  2.44k|  return value;
  285|  2.44k|}
decode3d.c:stream_rtell:
  318|     96|{
  319|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize - s->bits;
  ------------------
  |  |  130|     96|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  320|     96|}
encode4f.c:stream_write_bits:
  290|     56|{
  291|       |  /* append bit string to buffer */
  292|     56|  s->buffer += (bitstream_word)(value << s->bits);
  293|     56|  s->bits += n;
  294|       |  /* is buffer full? */
  295|     56|  if (s->bits >= wsize) {
  ------------------
  |  |  130|     56|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (295:7): [True: 0, False: 56]
  ------------------
  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|     56|  s->buffer &= ((bitstream_word)1 << s->bits) - 1;
  311|       |  /* assert: 0 <= n < 64 */
  312|     56|  return value >> n;
  313|     56|}
encode4f.c:stream_write_word:
  162|  1.57k|{
  163|  1.57k|  *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.57k|}
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|   101k|{
  243|   101k|  s->buffer += (bitstream_word)bit << s->bits;
  244|   101k|  if (++s->bits == wsize) {
  ------------------
  |  |  130|   101k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  |  Branch (244:7): [True: 1.57k, False: 100k]
  ------------------
  245|  1.57k|    stream_write_word(s, s->buffer);
  246|  1.57k|    s->buffer = 0;
  247|  1.57k|    s->bits = 0;
  248|  1.57k|  }
  249|   101k|  return bit;
  250|   101k|}
decode4f.c:stream_read_bit:
  227|   203k|{
  228|   203k|  uint bit;
  229|   203k|  if (!s->bits) {
  ------------------
  |  Branch (229:7): [True: 3.26k, False: 200k]
  ------------------
  230|  3.26k|    s->buffer = stream_read_word(s);
  231|       |    s->bits = wsize;
  ------------------
  |  |  130|  3.26k|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  232|  3.26k|  }
  233|   203k|  s->bits--;
  234|   203k|  bit = (uint)s->buffer & 1u;
  235|   203k|  s->buffer >>= 1;
  236|   203k|  return bit;
  237|   203k|}
decode4f.c:stream_read_word:
  150|  3.26k|{
  151|  3.26k|  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.26k|  return w;
  157|  3.26k|}
decode4f.c:stream_read_bits:
  255|    112|{
  256|    112|  uint64 value = s->buffer;
  257|    112|  if (s->bits < n) {
  ------------------
  |  Branch (257:7): [True: 0, False: 112]
  ------------------
  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|    112|  else {
  279|       |    /* assert: 0 <= n <= s->bits < wsize <= 64 */
  280|    112|    s->bits -= n;
  281|    112|    s->buffer >>= n;
  282|    112|    value &= ((uint64)1 << n) - 1;
  283|    112|  }
  284|    112|  return value;
  285|    112|}
decode4f.c:stream_rtell:
  318|    144|{
  319|       |  return (bitstream_offset)(s->ptr - s->begin) * wsize - s->bits;
  ------------------
  |  |  130|    144|#define wsize ((bitstream_count)(sizeof(bitstream_word) * CHAR_BIT))
  ------------------
  320|    144|}

encode3f.c:with_maxbits:
    4|     47|{
    5|     47|  return (maxprec + 1) * size - 1 > maxbits;
    6|     47|}
encode3d.c:with_maxbits:
    4|     32|{
    5|     32|  return (maxprec + 1) * size - 1 > maxbits;
    6|     32|}
decode3f.c:with_maxbits:
    4|     92|{
    5|     92|  return (maxprec + 1) * size - 1 > maxbits;
    6|     92|}
decode3d.c:with_maxbits:
    4|     64|{
    5|     64|  return (maxprec + 1) * size - 1 > maxbits;
    6|     64|}
encode4f.c:with_maxbits:
    4|     56|{
    5|     56|  return (maxprec + 1) * size - 1 > maxbits;
    6|     56|}
decode4f.c:with_maxbits:
    4|    112|{
    5|    112|  return (maxprec + 1) * size - 1 > maxbits;
    6|    112|}

encode3f.c:precision:
    7|     47|{
    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|     47|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|     94|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 43, False: 4]
  |  |  |  Branch (4:27): [True: 0, False: 47]
  |  |  |  Branch (4:39): [True: 0, False: 4]
  |  |  ------------------
  ------------------
   12|     47|#endif
   13|     47|}
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|     92|{
    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|     92|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|    184|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 84, False: 8]
  |  |  |  Branch (4:27): [True: 0, False: 92]
  |  |  |  Branch (4:39): [True: 0, False: 8]
  |  |  ------------------
  ------------------
   12|     92|#endif
   13|     92|}
decode3f.c:inv_cast_float:
   25|     92|{
   26|       |  /* compute power-of-two scale factor s */
   27|     92|  Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    3|     92|#define Scalar float       /* floating-point type */
  ------------------
                Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    9|     92|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     92|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   28|       |  /* compute p-bit float x = s*y where |y| <= 2^(p-2) - 1 */
   29|     92|  do
   30|  5.88k|    *fblock++ = (Scalar)(s * *iblock++);
   31|  5.88k|  while (--n);
  ------------------
  |  Branch (31:10): [True: 5.79k, False: 92]
  ------------------
   32|     92|}
decode3f.c:dequantize_float:
   18|     92|{
   19|     92|  return LDEXP((Scalar)x, e - ((int)(CHAR_BIT * sizeof(Scalar)) - 2));
  ------------------
  |  |   15|     92|  #define LDEXP(x, e) ldexpf(x, e)
  ------------------
   20|     92|}
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|     56|{
    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|     56|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|    112|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 56, False: 0]
  |  |  |  Branch (4:27): [True: 0, False: 56]
  |  |  |  Branch (4:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   12|     56|#endif
   13|     56|}
decode4f.c:precision:
    7|    112|{
    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|    112|  return MIN(maxprec, (uint)MAX(0, maxexp - minexp + 2 * dims + 2));
  ------------------
  |  |    4|    224|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 112, False: 0]
  |  |  |  Branch (4:27): [True: 0, False: 112]
  |  |  |  Branch (4:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   12|    112|#endif
   13|    112|}
decode4f.c:inv_cast_float:
   25|    112|{
   26|       |  /* compute power-of-two scale factor s */
   27|    112|  Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    3|    112|#define Scalar float       /* floating-point type */
  ------------------
                Scalar s = _t1(dequantize, Scalar)(1, emax);
  ------------------
  |  |    9|    112|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    112|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   28|       |  /* compute p-bit float x = s*y where |y| <= 2^(p-2) - 1 */
   29|    112|  do
   30|  28.6k|    *fblock++ = (Scalar)(s * *iblock++);
   31|  28.6k|  while (--n);
  ------------------
  |  Branch (31:10): [True: 28.5k, False: 112]
  ------------------
   32|    112|}
decode4f.c:dequantize_float:
   18|    112|{
   19|    112|  return LDEXP((Scalar)x, e - ((int)(CHAR_BIT * sizeof(Scalar)) - 2));
  ------------------
  |  |   15|    112|  #define LDEXP(x, e) ldexpf(x, e)
  ------------------
   20|    112|}

zfp.c:compress_strided_float_3:
   61|     47|{
   62|     47|  const Scalar* data = (const Scalar*)field->data;
   63|     47|  size_t nx = field->nx;
   64|     47|  size_t ny = field->ny;
   65|     47|  size_t nz = field->nz;
   66|     47|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (66:18): [True: 0, False: 47]
  ------------------
   67|     47|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (67:18): [True: 0, False: 47]
  ------------------
   68|     47|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (68:18): [True: 0, False: 47]
  ------------------
   69|     47|  size_t x, y, z;
   70|       |
   71|       |  /* compress array one block of 4x4x4 values at a time */
   72|     94|  for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (72:15): [True: 47, False: 47]
  ------------------
   73|     94|    for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (73:17): [True: 47, False: 47]
  ------------------
   74|     94|      for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (74:19): [True: 47, False: 47]
  ------------------
   75|     47|        const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z;
   76|     47|        if (nx - x < 4 || ny - y < 4 || nz - z < 4)
  ------------------
  |  Branch (76:13): [True: 0, False: 47]
  |  Branch (76:27): [True: 0, False: 47]
  |  Branch (76:41): [True: 0, False: 47]
  ------------------
   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|     47|        else
   79|     47|          _t2(zfp_encode_block_strided, Scalar, 3)(stream, p, sx, sy, sz);
  ------------------
  |  |   10|     47|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     47|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   80|     47|      }
   81|     47|}
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|     56|{
   87|     56|  const Scalar* data = field->data;
   88|     56|  size_t nx = field->nx;
   89|     56|  size_t ny = field->ny;
   90|     56|  size_t nz = field->nz;
   91|     56|  size_t nw = field->nw;
   92|     56|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (92:18): [True: 0, False: 56]
  ------------------
   93|     56|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (93:18): [True: 0, False: 56]
  ------------------
   94|     56|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (94:18): [True: 0, False: 56]
  ------------------
   95|     56|  ptrdiff_t sw = field->sw ? field->sw : (ptrdiff_t)(nx * ny * nz);
  ------------------
  |  Branch (95:18): [True: 0, False: 56]
  ------------------
   96|     56|  size_t x, y, z, w;
   97|       |
   98|       |  /* compress array one block of 4x4x4x4 values at a time */
   99|    112|  for (w = 0; w < nw; w += 4)
  ------------------
  |  Branch (99:15): [True: 56, False: 56]
  ------------------
  100|    112|    for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (100:17): [True: 56, False: 56]
  ------------------
  101|    112|      for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (101:19): [True: 56, False: 56]
  ------------------
  102|    112|        for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (102:21): [True: 56, False: 56]
  ------------------
  103|     56|          const Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z + sw * (ptrdiff_t)w;
  104|     56|          if (nx - x < 4 || ny - y < 4 || nz - z < 4 || nw - w < 4)
  ------------------
  |  Branch (104:15): [True: 0, False: 56]
  |  Branch (104:29): [True: 0, False: 56]
  |  Branch (104:43): [True: 0, False: 56]
  |  Branch (104:57): [True: 0, False: 56]
  ------------------
  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|     56|          else
  107|     56|            _t2(zfp_encode_block_strided, Scalar, 4)(stream, p, sx, sy, sz, sw);
  ------------------
  |  |   10|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  108|     56|        }
  109|     56|}

decode3f.c:decode_block_int32_3:
  272|     92|{
  273|     92|  uint bits;
  274|     92|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|     92|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  275|       |  /* decode integer coefficients */
  276|     92|  bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|     92|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     92|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|     92|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     92|#define DIMS 3
  |  |  ------------------
  ------------------
  277|       |  /* read at least minbits bits */
  278|     92|  if (bits < minbits) {
  ------------------
  |  Branch (278:7): [True: 14, False: 78]
  ------------------
  279|     14|    stream_skip(stream, minbits - bits);
  280|     14|    bits = minbits;
  281|     14|  }
  282|       |  /* reorder unsigned coefficients and convert to signed integer */
  283|     92|  _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|     92|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     92|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|     92|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|     92|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|     92|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|     92|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     92|#define DIMS 3
  |  |  ------------------
  ------------------
  284|       |  /* perform decorrelating transform */
  285|     92|  _t2(inv_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|     92|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     92|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  286|     92|  return bits;
  287|     92|}
decode3f.c:decode_ints_uint32:
  251|     92|{
  252|       |  /* use fastest available decoder implementation */
  253|     92|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (253:7): [True: 16, False: 76]
  ------------------
  254|       |    /* rate constrained path: decode partial bit planes */
  255|     16|    if (size <= 64)
  ------------------
  |  Branch (255:9): [True: 16, False: 0]
  ------------------
  256|     16|      return _t1(decode_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
  |  |  ------------------
  ------------------
  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|     16|  }
  260|     76|  else {
  261|       |    /* variable-rate path: decode whole bit planes */
  262|     76|    if (size <= 64)
  ------------------
  |  Branch (262:9): [True: 76, False: 0]
  ------------------
  263|     76|      return _t1(decode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     76|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     76|#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|     76|  }
  267|     92|}
decode3f.c:decode_few_ints_uint32:
   70|     16|{
   71|       |  /* make a copy of bit stream to avoid aliasing */
   72|     16|  bitstream s = *stream;
   73|     16|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
   74|     16|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (74:15): [True: 0, False: 16]
  ------------------
   75|     16|  uint bits = maxbits;
   76|     16|  uint i, k, m, n;
   77|     16|  uint64 x;
   78|       |
   79|       |  /* initialize data array to all zeros */
   80|  1.04k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (80:15): [True: 1.02k, False: 16]
  ------------------
   81|  1.02k|    data[i] = 0;
   82|       |
   83|       |  /* decode one bit plane at a time from MSB to LSB */
   84|    494|  for (k = intprec, m = n = 0; bits && (m = 0, k-- > kmin);) {
  ------------------
  |  Branch (84:32): [True: 492, False: 2]
  |  Branch (84:40): [True: 478, False: 14]
  ------------------
   85|       |    /* step 1: decode first n bits of bit plane #k */
   86|    478|    m = MIN(n, bits);
  ------------------
  |  |    4|    478|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 476, False: 2]
  |  |  ------------------
  ------------------
   87|    478|    bits -= m;
   88|    478|    x = stream_read_bits(&s, m);
   89|       |    /* step 2: unary run-length decode remainder of bit plane */
   90|    524|    for (; bits && n < size; n++, m = n) {
  ------------------
  |  Branch (90:12): [True: 522, False: 2]
  |  Branch (90:20): [True: 508, False: 14]
  ------------------
   91|    508|      bits--;
   92|    508|      if (stream_read_bit(&s)) {
  ------------------
  |  Branch (92:11): [True: 46, False: 462]
  ------------------
   93|       |        /* positive group test; scan for next one-bit */
   94|    250|        for (; bits && n < size - 1; n++) {
  ------------------
  |  Branch (94:16): [True: 250, False: 0]
  |  Branch (94:24): [True: 248, False: 2]
  ------------------
   95|    248|          bits--;
   96|    248|          if (stream_read_bit(&s))
  ------------------
  |  Branch (96:15): [True: 44, False: 204]
  ------------------
   97|     44|            break;
   98|    248|        }
   99|       |        /* set bit and continue decoding bit plane */
  100|     46|        x += (uint64)1 << n;
  101|     46|      }
  102|    462|      else {
  103|       |        /* negative group test; done with bit plane */
  104|    462|        m = size;
  105|    462|        break;
  106|    462|      }
  107|    508|    }
  108|       |    /* step 3: deposit bit plane from x */
  109|  1.71k|    for (i = 0; x; i++, x >>= 1)
  ------------------
  |  Branch (109:17): [True: 1.23k, False: 478]
  ------------------
  110|  1.23k|      data[i] += (UInt)(x & 1u) << k;
  111|    478|  }
  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|     16|  *stream = s;
  119|     16|  return maxbits - bits;
  120|     16|}
decode3f.c:decode_few_ints_prec_uint32:
  178|     76|{
  179|       |  /* make a copy of bit stream to avoid aliasing */
  180|     76|  bitstream s = *stream;
  181|     76|  bitstream_offset offset = stream_rtell(&s);
  182|     76|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  183|     76|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (183:15): [True: 14, False: 62]
  ------------------
  184|     76|  uint i, k, n;
  185|       |
  186|       |  /* initialize data array to all zeros */
  187|  4.94k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (187:15): [True: 4.86k, False: 76]
  ------------------
  188|  4.86k|    data[i] = 0;
  189|       |
  190|       |  /* decode one bit plane at a time from MSB to LSB */
  191|  2.20k|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (191:28): [True: 2.12k, False: 76]
  ------------------
  192|       |    /* step 1: decode first n bits of bit plane #k */
  193|  2.12k|    uint64 x = stream_read_bits(&s, n);
  194|       |    /* step 2: unary run-length decode remainder of bit plane */
  195|  2.87k|    for (; n < size && stream_read_bit(&s); x += (uint64)1 << n, n++)
  ------------------
  |  Branch (195:12): [True: 1.36k, False: 1.50k]
  |  Branch (195:24): [True: 750, False: 616]
  ------------------
  196|  4.80k|      for (; n < size - 1 && !stream_read_bit(&s); n++)
  ------------------
  |  Branch (196:14): [True: 4.73k, False: 66]
  |  Branch (196:30): [True: 4.05k, False: 684]
  ------------------
  197|  4.05k|        ;
  198|       |    /* step 3: deposit bit plane from x */
  199|  98.0k|    for (i = 0; x; i++, x >>= 1)
  ------------------
  |  Branch (199:17): [True: 95.9k, False: 2.12k]
  ------------------
  200|  95.9k|      data[i] += (UInt)(x & 1u) << k;
  201|  2.12k|  }
  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|     76|  *stream = s;
  209|     76|  return (uint)(stream_rtell(&s) - offset);
  210|     76|}
decode3f.c:inv_order_int32:
   61|     92|{
   62|     92|  do
   63|  5.88k|    iblock[*perm++] = _t1(uint2int, UInt)(*ublock++);
  ------------------
  |  |    9|  5.88k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  5.88k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   64|  5.88k|  while (--n);
  ------------------
  |  Branch (64:10): [True: 5.79k, False: 92]
  ------------------
   65|     92|}
decode3f.c:uint2int_uint32:
   54|  5.88k|{
   55|  5.88k|  return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  5.88k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
                return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  5.88k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
   56|  5.88k|}
decode3f.c:inv_lift_int32:
   10|  4.41k|{
   11|  4.41k|  Int x, y, z, w;
  ------------------
  |  |    4|  4.41k|#define Int int32          /* corresponding signed integer type */
  ------------------
   12|  4.41k|  x = *p; p += s;
   13|  4.41k|  y = *p; p += s;
   14|  4.41k|  z = *p; p += s;
   15|  4.41k|  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|  4.41k|  y += w >> 1; w -= y >> 1;
   25|  4.41k|  y += w; w <<= 1; w -= y;
   26|  4.41k|  z += x; x <<= 1; x -= z;
   27|  4.41k|  y += z; z <<= 1; z -= y;
   28|  4.41k|  w += x; x <<= 1; x -= w;
   29|       |
   30|  4.41k|  p -= s; *p = w;
   31|  4.41k|  p -= s; *p = z;
   32|  4.41k|  p -= s; *p = y;
   33|  4.41k|  p -= s; *p = x;
   34|  4.41k|}
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: 16, False: 48]
  ------------------
  254|       |    /* rate constrained path: decode partial bit planes */
  255|     16|    if (size <= 64)
  ------------------
  |  Branch (255:9): [True: 16, False: 0]
  ------------------
  256|     16|      return _t1(decode_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
  |  |  ------------------
  ------------------
  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|     16|  }
  260|     48|  else {
  261|       |    /* variable-rate path: decode whole bit planes */
  262|     48|    if (size <= 64)
  ------------------
  |  Branch (262:9): [True: 48, False: 0]
  ------------------
  263|     48|      return _t1(decode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     48|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     48|#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|     48|  }
  267|     64|}
decode3d.c:decode_few_ints_uint64:
   70|     16|{
   71|       |  /* make a copy of bit stream to avoid aliasing */
   72|     16|  bitstream s = *stream;
   73|     16|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
   74|     16|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (74:15): [True: 0, False: 16]
  ------------------
   75|     16|  uint bits = maxbits;
   76|     16|  uint i, k, m, n;
   77|     16|  uint64 x;
   78|       |
   79|       |  /* initialize data array to all zeros */
   80|  1.04k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (80:15): [True: 1.02k, False: 16]
  ------------------
   81|  1.02k|    data[i] = 0;
   82|       |
   83|       |  /* decode one bit plane at a time from MSB to LSB */
   84|    410|  for (k = intprec, m = n = 0; bits && (m = 0, k-- > kmin);) {
  ------------------
  |  Branch (84:32): [True: 394, False: 16]
  |  Branch (84:40): [True: 394, False: 0]
  ------------------
   85|       |    /* step 1: decode first n bits of bit plane #k */
   86|    394|    m = MIN(n, bits);
  ------------------
  |  |    4|    394|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 378, False: 16]
  |  |  ------------------
  ------------------
   87|    394|    bits -= m;
   88|    394|    x = stream_read_bits(&s, m);
   89|       |    /* step 2: unary run-length decode remainder of bit plane */
   90|    602|    for (; bits && n < size; n++, m = n) {
  ------------------
  |  Branch (90:12): [True: 586, False: 16]
  |  Branch (90:20): [True: 298, False: 288]
  ------------------
   91|    298|      bits--;
   92|    298|      if (stream_read_bit(&s)) {
  ------------------
  |  Branch (92:11): [True: 208, False: 90]
  ------------------
   93|       |        /* positive group test; scan for next one-bit */
   94|  1.02k|        for (; bits && n < size - 1; n++) {
  ------------------
  |  Branch (94:16): [True: 1.02k, False: 0]
  |  Branch (94:24): [True: 1.00k, False: 16]
  ------------------
   95|  1.00k|          bits--;
   96|  1.00k|          if (stream_read_bit(&s))
  ------------------
  |  Branch (96:15): [True: 192, False: 816]
  ------------------
   97|    192|            break;
   98|  1.00k|        }
   99|       |        /* set bit and continue decoding bit plane */
  100|    208|        x += (uint64)1 << n;
  101|    208|      }
  102|     90|      else {
  103|       |        /* negative group test; done with bit plane */
  104|     90|        m = size;
  105|     90|        break;
  106|     90|      }
  107|    298|    }
  108|       |    /* step 3: deposit bit plane from x */
  109|  18.3k|    for (i = 0; x; i++, x >>= 1)
  ------------------
  |  Branch (109:17): [True: 17.9k, False: 394]
  ------------------
  110|  17.9k|      data[i] += (UInt)(x & 1u) << k;
  111|    394|  }
  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|     16|  *stream = s;
  119|     16|  return maxbits - bits;
  120|     16|}
decode3d.c:decode_few_ints_prec_uint64:
  178|     48|{
  179|       |  /* make a copy of bit stream to avoid aliasing */
  180|     48|  bitstream s = *stream;
  181|     48|  bitstream_offset offset = stream_rtell(&s);
  182|     48|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  183|     48|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (183:15): [True: 32, False: 16]
  ------------------
  184|     48|  uint i, k, n;
  185|       |
  186|       |  /* initialize data array to all zeros */
  187|  3.12k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (187:15): [True: 3.07k, False: 48]
  ------------------
  188|  3.07k|    data[i] = 0;
  189|       |
  190|       |  /* decode one bit plane at a time from MSB to LSB */
  191|  2.03k|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (191:28): [True: 1.98k, False: 48]
  ------------------
  192|       |    /* step 1: decode first n bits of bit plane #k */
  193|  1.98k|    uint64 x = stream_read_bits(&s, n);
  194|       |    /* step 2: unary run-length decode remainder of bit plane */
  195|  2.60k|    for (; n < size && stream_read_bit(&s); x += (uint64)1 << n, n++)
  ------------------
  |  Branch (195:12): [True: 966, False: 1.63k]
  |  Branch (195:24): [True: 620, False: 346]
  ------------------
  196|  3.07k|      for (; n < size - 1 && !stream_read_bit(&s); n++)
  ------------------
  |  Branch (196:14): [True: 3.02k, False: 48]
  |  Branch (196:30): [True: 2.45k, False: 572]
  ------------------
  197|  2.45k|        ;
  198|       |    /* step 3: deposit bit plane from x */
  199|  84.5k|    for (i = 0; x; i++, x >>= 1)
  ------------------
  |  Branch (199:17): [True: 82.5k, False: 1.98k]
  ------------------
  200|  82.5k|      data[i] += (UInt)(x & 1u) << k;
  201|  1.98k|  }
  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|     48|  *stream = s;
  209|     48|  return (uint)(stream_rtell(&s) - offset);
  210|     48|}
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|    112|{
  273|    112|  uint bits;
  274|    112|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|    112|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  275|       |  /* decode integer coefficients */
  276|    112|  bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|    112|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    112|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(decode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|    112|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|    112|#define DIMS 4
  |  |  ------------------
  ------------------
  277|       |  /* read at least minbits bits */
  278|    112|  if (bits < minbits) {
  ------------------
  |  Branch (278:7): [True: 0, False: 112]
  ------------------
  279|      0|    stream_skip(stream, minbits - bits);
  280|      0|    bits = minbits;
  281|      0|  }
  282|       |  /* reorder unsigned coefficients and convert to signed integer */
  283|    112|  _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|    112|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    112|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|    112|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|    112|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|    112|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(inv_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|    112|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|    112|#define DIMS 4
  |  |  ------------------
  ------------------
  284|       |  /* perform decorrelating transform */
  285|    112|  _t2(inv_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|    112|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    112|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  286|    112|  return bits;
  287|    112|}
decode4f.c:decode_ints_uint32:
  251|    112|{
  252|       |  /* use fastest available decoder implementation */
  253|    112|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (253:7): [True: 40, False: 72]
  ------------------
  254|       |    /* rate constrained path: decode partial bit planes */
  255|     40|    if (size <= 64)
  ------------------
  |  Branch (255:9): [True: 0, False: 40]
  ------------------
  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|     40|    else
  258|     40|      return _t1(decode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|     40|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     40|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  259|     40|  }
  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|    112|}
decode4f.c:decode_many_ints_uint32:
  125|     40|{
  126|       |  /* make a copy of bit stream to avoid aliasing */
  127|     40|  bitstream s = *stream;
  128|     40|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  129|     40|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (129:15): [True: 0, False: 40]
  ------------------
  130|     40|  uint bits = maxbits;
  131|     40|  uint i, k, m, n;
  132|       |
  133|       |  /* initialize data array to all zeros */
  134|  10.2k|  for (i = 0; i < size; i++)
  ------------------
  |  Branch (134:15): [True: 10.2k, False: 40]
  ------------------
  135|  10.2k|    data[i] = 0;
  136|       |
  137|       |  /* decode one bit plane at a time from MSB to LSB */
  138|    230|  for (k = intprec, m = n = 0; bits && (m = 0, k-- > kmin);) {
  ------------------
  |  Branch (138:32): [True: 190, False: 40]
  |  Branch (138:40): [True: 190, False: 0]
  ------------------
  139|       |    /* step 1: decode first n bits of bit plane #k */
  140|    190|    m = MIN(n, bits);
  ------------------
  |  |    4|    190|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 190, False: 0]
  |  |  ------------------
  ------------------
  141|    190|    bits -= m;
  142|    190|    for (i = 0; i < m; i++)
  ------------------
  |  Branch (142:17): [True: 0, False: 190]
  ------------------
  143|      0|      if (stream_read_bit(&s))
  ------------------
  |  Branch (143:11): [True: 0, False: 0]
  ------------------
  144|      0|        data[i] += (UInt)1 << k;
  145|       |    /* step 2: unary run-length decode remainder of bit plane */
  146|    230|    for (; bits && n < size; n++, m = n) {
  ------------------
  |  Branch (146:12): [True: 190, False: 40]
  |  Branch (146:20): [True: 190, False: 0]
  ------------------
  147|    190|      bits--;
  148|    190|      if (stream_read_bit(&s)) {
  ------------------
  |  Branch (148:11): [True: 40, False: 150]
  ------------------
  149|       |        /* positive group test; scan for next one-bit */
  150|  2.77k|        for (; bits && n < size - 1; n++) {
  ------------------
  |  Branch (150:16): [True: 2.73k, False: 40]
  |  Branch (150:24): [True: 2.73k, False: 0]
  ------------------
  151|  2.73k|          bits--;
  152|  2.73k|          if (stream_read_bit(&s))
  ------------------
  |  Branch (152:15): [True: 0, False: 2.73k]
  ------------------
  153|      0|            break;
  154|  2.73k|        }
  155|       |        /* set bit and continue decoding bit plane */
  156|     40|        data[n] += (UInt)1 << k;
  157|     40|      }
  158|    150|      else {
  159|       |        /* negative group test; done with bit plane */
  160|    150|        m = size;
  161|    150|        break;
  162|    150|      }
  163|    190|    }
  164|    190|  }
  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|     40|  *stream = s;
  172|     40|  return maxbits - bits;
  173|     40|}
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|   181k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (230:17): [True: 180k, False: 1.02k]
  ------------------
  231|   180k|      if (stream_read_bit(&s))
  ------------------
  |  Branch (231:11): [True: 77.5k, False: 103k]
  ------------------
  232|  77.5k|        data[i] += (UInt)1 << k;
  233|       |    /* step 2: unary run-length decode remainder of bit plane */
  234|  2.09k|    for (; n < size && stream_read_bit(&s); data[n] += (UInt)1 << k, n++)
  ------------------
  |  Branch (234:12): [True: 1.54k, False: 552]
  |  Branch (234:24): [True: 1.06k, False: 472]
  ------------------
  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: 996]
  ------------------
  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|    112|{
   62|    112|  do
   63|  28.6k|    iblock[*perm++] = _t1(uint2int, UInt)(*ublock++);
  ------------------
  |  |    9|  28.6k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  28.6k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   64|  28.6k|  while (--n);
  ------------------
  |  Branch (64:10): [True: 28.5k, False: 112]
  ------------------
   65|    112|}
decode4f.c:uint2int_uint32:
   54|  28.6k|{
   55|  28.6k|  return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  28.6k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
                return (Int)((x ^ NBMASK) - NBMASK);
  ------------------
  |  |    8|  28.6k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
   56|  28.6k|}
decode4f.c:inv_lift_int32:
   10|  28.6k|{
   11|  28.6k|  Int x, y, z, w;
  ------------------
  |  |    4|  28.6k|#define Int int32          /* corresponding signed integer type */
  ------------------
   12|  28.6k|  x = *p; p += s;
   13|  28.6k|  y = *p; p += s;
   14|  28.6k|  z = *p; p += s;
   15|  28.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|  28.6k|  y += w >> 1; w -= y >> 1;
   25|  28.6k|  y += w; w <<= 1; w -= y;
   26|  28.6k|  z += x; x <<= 1; x -= z;
   27|  28.6k|  y += z; z <<= 1; z -= y;
   28|  28.6k|  w += x; x <<= 1; x -= w;
   29|       |
   30|  28.6k|  p -= s; *p = w;
   31|  28.6k|  p -= s; *p = z;
   32|  28.6k|  p -= s; *p = y;
   33|  28.6k|  p -= s; *p = x;
   34|  28.6k|}

zfp_decode_block_strided_float_3:
   49|     92|{
   50|       |  /* decode contiguous block */
   51|     92|  cache_align_(Scalar block[64]);
  ------------------
  |  |   42|     92|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   52|     92|  size_t bits = _t2(zfp_decode_block, Scalar, 3)(stream, block);
  ------------------
  |  |   10|     92|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     92|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   53|       |  /* scatter block to strided array */
   54|     92|  _t2(scatter, Scalar, 3)(block, p, sx, sy, sz);
  ------------------
  |  |   10|     92|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     92|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   55|     92|  return bits;
   56|     92|}
decode3f.c:inv_xform_int32_3:
   28|     92|{
   29|     92|  uint x, y, z;
   30|       |  /* transform along z */
   31|    460|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (31:15): [True: 368, False: 92]
  ------------------
   32|  1.84k|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (32:17): [True: 1.47k, False: 368]
  ------------------
   33|  1.47k|      _t1(inv_lift, Int)(p + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|  1.47k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  1.47k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   34|       |  /* transform along y */
   35|    460|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (35:15): [True: 368, False: 92]
  ------------------
   36|  1.84k|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (36:17): [True: 1.47k, False: 368]
  ------------------
   37|  1.47k|      _t1(inv_lift, Int)(p + 16 * z + 1 * x, 4);
  ------------------
  |  |    9|  1.47k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  1.47k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   38|       |  /* transform along x */
   39|    460|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (39:15): [True: 368, False: 92]
  ------------------
   40|  1.84k|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (40:17): [True: 1.47k, False: 368]
  ------------------
   41|  1.47k|      _t1(inv_lift, Int)(p + 4 * y + 16 * z, 1);
  ------------------
  |  |    9|  1.47k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  1.47k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   42|     92|}
decode3f.c:scatter_float_3:
    6|     92|{
    7|     92|  uint x, y, z;
    8|    460|  for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (8:15): [True: 368, False: 92]
  ------------------
    9|  1.84k|    for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (9:17): [True: 1.47k, False: 368]
  ------------------
   10|  7.36k|      for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (10:19): [True: 5.88k, False: 1.47k]
  ------------------
   11|  5.88k|        *p = *q++;
   12|     92|}
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|    112|{
   60|       |  /* decode contiguous block */
   61|    112|  cache_align_(Scalar block[256]);
  ------------------
  |  |   42|    112|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   62|    112|  size_t bits = _t2(zfp_decode_block, Scalar, 4)(stream, block);
  ------------------
  |  |   10|    112|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    112|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   63|       |  /* scatter block to strided array */
   64|    112|  _t2(scatter, Scalar, 4)(block, p, sx, sy, sz, sw);
  ------------------
  |  |   10|    112|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    112|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   65|    112|  return bits;
   66|    112|}
decode4f.c:inv_xform_int32_4:
   30|    112|{
   31|    112|  uint x, y, z, w;
   32|       |  /* transform along w */
   33|    560|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (33:15): [True: 448, False: 112]
  ------------------
   34|  2.24k|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (34:17): [True: 1.79k, False: 448]
  ------------------
   35|  8.96k|      for (x = 0; x < 4; x++)
  ------------------
  |  Branch (35:19): [True: 7.16k, False: 1.79k]
  ------------------
   36|  7.16k|        _t1(inv_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64);
  ------------------
  |  |    9|  7.16k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  7.16k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   37|       |  /* transform along z */
   38|    560|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (38:15): [True: 448, False: 112]
  ------------------
   39|  2.24k|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (39:17): [True: 1.79k, False: 448]
  ------------------
   40|  8.96k|      for (w = 0; w < 4; w++)
  ------------------
  |  Branch (40:19): [True: 7.16k, False: 1.79k]
  ------------------
   41|  7.16k|        _t1(inv_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|  7.16k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  7.16k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   42|       |  /* transform along y */
   43|    560|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (43:15): [True: 448, False: 112]
  ------------------
   44|  2.24k|    for (w = 0; w < 4; w++)
  ------------------
  |  Branch (44:17): [True: 1.79k, False: 448]
  ------------------
   45|  8.96k|      for (z = 0; z < 4; z++)
  ------------------
  |  Branch (45:19): [True: 7.16k, False: 1.79k]
  ------------------
   46|  7.16k|        _t1(inv_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4);
  ------------------
  |  |    9|  7.16k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  7.16k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   47|       |  /* transform along x */
   48|    560|  for (w = 0; w < 4; w++)
  ------------------
  |  Branch (48:15): [True: 448, False: 112]
  ------------------
   49|  2.24k|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (49:17): [True: 1.79k, False: 448]
  ------------------
   50|  8.96k|      for (y = 0; y < 4; y++)
  ------------------
  |  Branch (50:19): [True: 7.16k, False: 1.79k]
  ------------------
   51|  7.16k|        _t1(inv_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1);
  ------------------
  |  |    9|  7.16k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  7.16k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   52|    112|}
decode4f.c:scatter_float_4:
    6|    112|{
    7|    112|  uint x, y, z, w;
    8|    560|  for (w = 0; w < 4; w++, p += sw - 4 * sz)
  ------------------
  |  Branch (8:15): [True: 448, False: 112]
  ------------------
    9|  2.24k|    for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (9:17): [True: 1.79k, False: 448]
  ------------------
   10|  8.96k|      for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (10:19): [True: 7.16k, False: 1.79k]
  ------------------
   11|  35.8k|        for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (11:21): [True: 28.6k, False: 7.16k]
  ------------------
   12|  28.6k|          *p = *q++;
   13|    112|}

zfp_decode_block_float_3:
   42|     92|{
   43|     92|  return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|     92|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|     92|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 92]
  |  |  ------------------
  ------------------
                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|     92|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     92|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   44|     92|}
decode3f.c:decode_block_float_3:
    8|     92|{
    9|     92|  uint bits = 1;
   10|       |  /* test if block has nonzero values */
   11|     92|  if (stream_read_bit(zfp->stream)) {
  ------------------
  |  Branch (11:7): [True: 92, False: 0]
  ------------------
   12|     92|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|     92|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   13|     92|    uint maxprec;
   14|     92|    int emax;
   15|       |    /* decode common exponent */
   16|     92|    bits += EBITS;
  ------------------
  |  |    6|     92|#define EBITS 8            /* number of exponent bits */
  ------------------
   17|     92|    emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    6|     92|#define EBITS 8            /* number of exponent bits */
  ------------------
                  emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    3|     92|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     92|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
   18|     92|    maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|     92|#define DIMS 3
  ------------------
   19|       |    /* decode integer block */
   20|     92|    bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|     92|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     92|#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|     92|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 16, False: 76]
  |  |  ------------------
  ------------------
   21|       |    /* perform inverse block-floating-point transform */
   22|     92|    _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|     92|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     92|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|     92|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     92|#define DIMS 3
  |  |  ------------------
  ------------------
   23|     92|  }
   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|     92|  return bits;
   35|     92|}
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: 16, False: 48]
  |  |  ------------------
  ------------------
   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|    112|{
   43|    112|  return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|    112|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|    112|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 112]
  |  |  ------------------
  ------------------
                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|    112|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    112|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   44|    112|}
decode4f.c:decode_block_float_4:
    8|    112|{
    9|    112|  uint bits = 1;
   10|       |  /* test if block has nonzero values */
   11|    112|  if (stream_read_bit(zfp->stream)) {
  ------------------
  |  Branch (11:7): [True: 112, False: 0]
  ------------------
   12|    112|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|    112|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   13|    112|    uint maxprec;
   14|    112|    int emax;
   15|       |    /* decode common exponent */
   16|    112|    bits += EBITS;
  ------------------
  |  |    6|    112|#define EBITS 8            /* number of exponent bits */
  ------------------
   17|    112|    emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    6|    112|#define EBITS 8            /* number of exponent bits */
  ------------------
                  emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
  ------------------
  |  |    3|    112|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|    112|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
   18|    112|    maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|    112|#define DIMS 4
  ------------------
   19|       |    /* decode integer block */
   20|    112|    bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|    112|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    112|#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|    112|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 40, False: 72]
  |  |  ------------------
  ------------------
   21|       |    /* perform inverse block-floating-point transform */
   22|    112|    _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|    112|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    112|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|    112|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|    112|#define DIMS 4
  |  |  ------------------
  ------------------
   23|    112|  }
   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 4
  |  |  ------------------
  ------------------
  |  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|    112|  return bits;
   35|    112|}

zfp.c:decompress_strided_float_3:
   61|     92|{
   62|     92|  Scalar* data = (Scalar*)field->data;
  ------------------
  |  |   70|     92|#define Scalar float
  ------------------
   63|     92|  size_t nx = field->nx;
   64|     92|  size_t ny = field->ny;
   65|     92|  size_t nz = field->nz;
   66|     92|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (66:18): [True: 0, False: 92]
  ------------------
   67|     92|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (67:18): [True: 0, False: 92]
  ------------------
   68|     92|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (68:18): [True: 0, False: 92]
  ------------------
   69|     92|  size_t x, y, z;
   70|       |
   71|       |  /* decompress array one block of 4x4x4 values at a time */
   72|    184|  for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (72:15): [True: 92, False: 92]
  ------------------
   73|    184|    for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (73:17): [True: 92, False: 92]
  ------------------
   74|    184|      for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (74:19): [True: 92, False: 92]
  ------------------
   75|     92|        Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z;
  ------------------
  |  |   70|     92|#define Scalar float
  ------------------
   76|     92|        if (nx - x < 4 || ny - y < 4 || nz - z < 4)
  ------------------
  |  Branch (76:13): [True: 0, False: 92]
  |  Branch (76:27): [True: 0, False: 92]
  |  Branch (76:41): [True: 0, False: 92]
  ------------------
   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|     92|        else
   79|     92|          _t2(zfp_decode_block_strided, Scalar, 3)(stream, p, sx, sy, sz);
  ------------------
  |  |   10|     92|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     92|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   80|     92|      }
   81|     92|}
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|    112|{
   87|    112|  Scalar* data = field->data;
  ------------------
  |  |   70|    112|#define Scalar float
  ------------------
   88|    112|  size_t nx = field->nx;
   89|    112|  size_t ny = field->ny;
   90|    112|  size_t nz = field->nz;
   91|    112|  size_t nw = field->nw;
   92|    112|  ptrdiff_t sx = field->sx ? field->sx : 1;
  ------------------
  |  Branch (92:18): [True: 0, False: 112]
  ------------------
   93|    112|  ptrdiff_t sy = field->sy ? field->sy : (ptrdiff_t)nx;
  ------------------
  |  Branch (93:18): [True: 0, False: 112]
  ------------------
   94|    112|  ptrdiff_t sz = field->sz ? field->sz : (ptrdiff_t)(nx * ny);
  ------------------
  |  Branch (94:18): [True: 0, False: 112]
  ------------------
   95|    112|  ptrdiff_t sw = field->sw ? field->sw : (ptrdiff_t)(nx * ny * nz);
  ------------------
  |  Branch (95:18): [True: 0, False: 112]
  ------------------
   96|    112|  size_t x, y, z, w;
   97|       |
   98|       |  /* decompress array one block of 4x4x4x4 values at a time */
   99|    224|  for (w = 0; w < nw; w += 4)
  ------------------
  |  Branch (99:15): [True: 112, False: 112]
  ------------------
  100|    224|    for (z = 0; z < nz; z += 4)
  ------------------
  |  Branch (100:17): [True: 112, False: 112]
  ------------------
  101|    224|      for (y = 0; y < ny; y += 4)
  ------------------
  |  Branch (101:19): [True: 112, False: 112]
  ------------------
  102|    224|        for (x = 0; x < nx; x += 4) {
  ------------------
  |  Branch (102:21): [True: 112, False: 112]
  ------------------
  103|    112|          Scalar* p = data + sx * (ptrdiff_t)x + sy * (ptrdiff_t)y + sz * (ptrdiff_t)z + sw * (ptrdiff_t)w;
  ------------------
  |  |   70|    112|#define Scalar float
  ------------------
  104|    112|          if (nx - x < 4 || ny - y < 4 || nz - z < 4 || nw - w < 4)
  ------------------
  |  Branch (104:15): [True: 0, False: 112]
  |  Branch (104:29): [True: 0, False: 112]
  |  Branch (104:43): [True: 0, False: 112]
  |  Branch (104:57): [True: 0, False: 112]
  ------------------
  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|    112|          else
  107|    112|            _t2(zfp_decode_block_strided, Scalar, 4)(stream, p, sx, sy, sz, sw);
  ------------------
  |  |   10|    112|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|    112|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
  108|    112|        }
  109|    112|}

encode3f.c:encode_block_int32_3:
  261|     47|{
  262|     47|  uint bits;
  263|     47|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|     47|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  264|       |  /* perform decorrelating transform */
  265|     47|  _t2(fwd_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|     47|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     47|#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|     47|  _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|     47|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     47|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|     47|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|     47|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|     47|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|     47|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     47|#define DIMS 3
  |  |  ------------------
  ------------------
  272|       |  /* encode integer coefficients */
  273|     47|  bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|     47|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     47|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|     47|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     47|#define DIMS 3
  |  |  ------------------
  ------------------
  274|       |  /* write at least minbits bits by padding with zeros */
  275|     47|  if (bits < minbits) {
  ------------------
  |  Branch (275:7): [True: 7, False: 40]
  ------------------
  276|      7|    stream_pad(stream, minbits - bits);
  277|      7|    bits = minbits;
  278|      7|  }
  279|     47|  return bits;
  280|     47|}
encode3f.c:fwd_lift_int32:
   32|  2.25k|{
   33|  2.25k|  Int x, y, z, w;
  ------------------
  |  |    4|  2.25k|#define Int int32          /* corresponding signed integer type */
  ------------------
   34|  2.25k|  x = *p; p += s;
   35|  2.25k|  y = *p; p += s;
   36|  2.25k|  z = *p; p += s;
   37|  2.25k|  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|  2.25k|  x += w; x >>= 1; w -= x;
   47|  2.25k|  z += y; z >>= 1; y -= z;
   48|  2.25k|  x += z; x >>= 1; z -= x;
   49|  2.25k|  w += y; w >>= 1; y -= w;
   50|  2.25k|  w += y >> 1; y -= w >> 1;
   51|       |
   52|  2.25k|  p -= s; *p = w;
   53|  2.25k|  p -= s; *p = z;
   54|  2.25k|  p -= s; *p = y;
   55|  2.25k|  p -= s; *p = x;
   56|  2.25k|}
encode3f.c:fwd_order_int32:
   84|     47|{
   85|     47|  do
   86|  3.00k|    *ublock++ = _t1(int2uint, Int)(iblock[*perm++]);
  ------------------
  |  |    9|  3.00k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.00k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   87|  3.00k|  while (--n);
  ------------------
  |  Branch (87:10): [True: 2.96k, False: 47]
  ------------------
   88|     47|}
encode3f.c:int2uint_int32:
   77|  3.00k|{
   78|  3.00k|  return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  3.00k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
                return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  3.00k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
   79|  3.00k|}
encode3f.c:encode_ints_uint32:
  240|     47|{
  241|       |  /* use fastest available encoder implementation */
  242|     47|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (242:7): [True: 8, False: 39]
  ------------------
  243|       |    /* rate constrained path: encode partial bit planes */
  244|      8|    if (size <= 64)
  ------------------
  |  Branch (244:9): [True: 8, False: 0]
  ------------------
  245|      8|      return _t1(encode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      8|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      8|#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|      8|  }
  249|     39|  else {
  250|       |    /* variable-rate path: encode whole bit planes */
  251|     39|    if (size <= 64)
  ------------------
  |  Branch (251:9): [True: 39, False: 0]
  ------------------
  252|     39|      return _t1(encode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     39|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     39|#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|     39|  }
  256|     47|}
encode3f.c:encode_few_ints_uint32:
   93|      8|{
   94|       |  /* make a copy of bit stream to avoid aliasing */
   95|      8|  bitstream s = *stream;
   96|      8|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
   97|      8|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (97:15): [True: 0, False: 8]
  ------------------
   98|      8|  uint bits = maxbits;
   99|      8|  uint i, k, m, n;
  100|      8|  uint64 x;
  101|       |
  102|       |  /* encode one bit plane at a time from MSB to LSB */
  103|    247|  for (k = intprec, n = 0; bits && k-- > kmin;) {
  ------------------
  |  Branch (103:28): [True: 246, False: 1]
  |  Branch (103:36): [True: 239, False: 7]
  ------------------
  104|       |    /* step 1: extract bit plane #k to x */
  105|    239|    x = 0;
  106|  15.5k|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (106:17): [True: 15.2k, False: 239]
  ------------------
  107|  15.2k|      x += (uint64)((data[i] >> k) & 1u) << i;
  108|       |    /* step 2: encode first n bits of bit plane */
  109|    239|    m = MIN(n, bits);
  ------------------
  |  |    4|    239|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 238, False: 1]
  |  |  ------------------
  ------------------
  110|    239|    bits -= m;
  111|    239|    x = stream_write_bits(&s, x, m);
  112|       |    /* step 3: unary run-length encode remainder of bit plane */
  113|    262|    for (; bits && n < size; x >>= 1, n++) {
  ------------------
  |  Branch (113:12): [True: 261, False: 1]
  |  Branch (113:20): [True: 254, False: 7]
  ------------------
  114|    254|      bits--;
  115|    254|      if (stream_write_bit(&s, !!x)) {
  ------------------
  |  Branch (115:11): [True: 23, False: 231]
  ------------------
  116|       |        /* positive group test (x != 0); scan for one-bit */
  117|    125|        for (; bits && n < size - 1; x >>= 1, n++) {
  ------------------
  |  Branch (117:16): [True: 125, False: 0]
  |  Branch (117:24): [True: 124, False: 1]
  ------------------
  118|    124|          bits--;
  119|    124|          if (stream_write_bit(&s, x & 1u))
  ------------------
  |  Branch (119:15): [True: 22, False: 102]
  ------------------
  120|     22|            break;
  121|    124|        }
  122|     23|      }
  123|    231|      else {
  124|       |        /* negative group test (x == 0); done with bit plane */
  125|    231|        break;
  126|    231|      }
  127|    254|    }
  128|    239|  }
  129|       |
  130|      8|  *stream = s;
  131|      8|  return maxbits - bits;
  132|      8|}
encode3f.c:encode_few_ints_prec_uint32:
  181|     39|{
  182|       |  /* make a copy of bit stream to avoid aliasing */
  183|     39|  bitstream s = *stream;
  184|     39|  bitstream_offset offset = stream_wtell(&s);
  185|     39|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  186|     39|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (186:15): [True: 7, False: 32]
  ------------------
  187|     39|  uint i, k, n;
  188|       |
  189|       |  /* encode one bit plane at a time from MSB to LSB */
  190|  1.13k|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (190:28): [True: 1.09k, False: 39]
  ------------------
  191|       |    /* step 1: extract bit plane #k to x */
  192|  1.09k|    uint64 x = 0;
  193|  71.1k|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (193:17): [True: 70.0k, False: 1.09k]
  ------------------
  194|  70.0k|      x += (uint64)((data[i] >> k) & 1u) << i;
  195|       |    /* step 2: encode first n bits of bit plane */
  196|  1.09k|    x = stream_write_bits(&s, x, n);
  197|       |    /* step 3: unary run-length encode remainder of bit plane */
  198|  1.47k|    for (; n < size && stream_write_bit(&s, !!x); x >>= 1, n++)
  ------------------
  |  Branch (198:12): [True: 688, False: 783]
  |  Branch (198:24): [True: 377, False: 311]
  ------------------
  199|  2.46k|      for (; n < size - 1 && !stream_write_bit(&s, x & 1u); x >>= 1, n++)
  ------------------
  |  Branch (199:14): [True: 2.43k, False: 34]
  |  Branch (199:30): [True: 2.08k, False: 343]
  ------------------
  200|  2.08k|        ;
  201|  1.09k|  }
  202|       |
  203|     39|  *stream = s;
  204|     39|  return (uint)(stream_wtell(&s) - offset);
  205|     39|}
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: 8, False: 24]
  ------------------
  243|       |    /* rate constrained path: encode partial bit planes */
  244|      8|    if (size <= 64)
  ------------------
  |  Branch (244:9): [True: 8, False: 0]
  ------------------
  245|      8|      return _t1(encode_few_ints, UInt)(stream, maxbits, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|      8|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|      8|#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|      8|  }
  249|     24|  else {
  250|       |    /* variable-rate path: encode whole bit planes */
  251|     24|    if (size <= 64)
  ------------------
  |  Branch (251:9): [True: 24, False: 0]
  ------------------
  252|     24|      return _t1(encode_few_ints_prec, UInt)(stream, maxprec, data, size); /* 1D, 2D, 3D blocks */
  ------------------
  |  |    9|     24|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     24|#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|     24|  }
  256|     32|}
encode3d.c:encode_few_ints_uint64:
   93|      8|{
   94|       |  /* make a copy of bit stream to avoid aliasing */
   95|      8|  bitstream s = *stream;
   96|      8|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
   97|      8|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (97:15): [True: 0, False: 8]
  ------------------
   98|      8|  uint bits = maxbits;
   99|      8|  uint i, k, m, n;
  100|      8|  uint64 x;
  101|       |
  102|       |  /* encode one bit plane at a time from MSB to LSB */
  103|    205|  for (k = intprec, n = 0; bits && k-- > kmin;) {
  ------------------
  |  Branch (103:28): [True: 197, False: 8]
  |  Branch (103:36): [True: 197, False: 0]
  ------------------
  104|       |    /* step 1: extract bit plane #k to x */
  105|    197|    x = 0;
  106|  12.8k|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (106:17): [True: 12.6k, False: 197]
  ------------------
  107|  12.6k|      x += (uint64)((data[i] >> k) & 1u) << i;
  108|       |    /* step 2: encode first n bits of bit plane */
  109|    197|    m = MIN(n, bits);
  ------------------
  |  |    4|    197|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 189, False: 8]
  |  |  ------------------
  ------------------
  110|    197|    bits -= m;
  111|    197|    x = stream_write_bits(&s, x, m);
  112|       |    /* step 3: unary run-length encode remainder of bit plane */
  113|    301|    for (; bits && n < size; x >>= 1, n++) {
  ------------------
  |  Branch (113:12): [True: 293, False: 8]
  |  Branch (113:20): [True: 149, False: 144]
  ------------------
  114|    149|      bits--;
  115|    149|      if (stream_write_bit(&s, !!x)) {
  ------------------
  |  Branch (115:11): [True: 104, False: 45]
  ------------------
  116|       |        /* positive group test (x != 0); scan for one-bit */
  117|    512|        for (; bits && n < size - 1; x >>= 1, n++) {
  ------------------
  |  Branch (117:16): [True: 512, False: 0]
  |  Branch (117:24): [True: 504, False: 8]
  ------------------
  118|    504|          bits--;
  119|    504|          if (stream_write_bit(&s, x & 1u))
  ------------------
  |  Branch (119:15): [True: 96, False: 408]
  ------------------
  120|     96|            break;
  121|    504|        }
  122|    104|      }
  123|     45|      else {
  124|       |        /* negative group test (x == 0); done with bit plane */
  125|     45|        break;
  126|     45|      }
  127|    149|    }
  128|    197|  }
  129|       |
  130|      8|  *stream = s;
  131|      8|  return maxbits - bits;
  132|      8|}
encode3d.c:encode_few_ints_prec_uint64:
  181|     24|{
  182|       |  /* make a copy of bit stream to avoid aliasing */
  183|     24|  bitstream s = *stream;
  184|     24|  bitstream_offset offset = stream_wtell(&s);
  185|     24|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  186|     24|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (186:15): [True: 16, False: 8]
  ------------------
  187|     24|  uint i, k, n;
  188|       |
  189|       |  /* encode one bit plane at a time from MSB to LSB */
  190|  1.01k|  for (k = intprec, n = 0; k-- > kmin;) {
  ------------------
  |  Branch (190:28): [True: 992, False: 24]
  ------------------
  191|       |    /* step 1: extract bit plane #k to x */
  192|    992|    uint64 x = 0;
  193|  64.4k|    for (i = 0; i < size; i++)
  ------------------
  |  Branch (193:17): [True: 63.4k, False: 992]
  ------------------
  194|  63.4k|      x += (uint64)((data[i] >> k) & 1u) << i;
  195|       |    /* step 2: encode first n bits of bit plane */
  196|    992|    x = stream_write_bits(&s, x, n);
  197|       |    /* step 3: unary run-length encode remainder of bit plane */
  198|  1.30k|    for (; n < size && stream_write_bit(&s, !!x); x >>= 1, n++)
  ------------------
  |  Branch (198:12): [True: 483, False: 819]
  |  Branch (198:24): [True: 310, False: 173]
  ------------------
  199|  1.53k|      for (; n < size - 1 && !stream_write_bit(&s, x & 1u); x >>= 1, n++)
  ------------------
  |  Branch (199:14): [True: 1.51k, False: 24]
  |  Branch (199:30): [True: 1.22k, False: 286]
  ------------------
  200|  1.22k|        ;
  201|    992|  }
  202|       |
  203|     24|  *stream = s;
  204|     24|  return (uint)(stream_wtell(&s) - offset);
  205|     24|}
encode4f.c:encode_block_int32_4:
  261|     56|{
  262|     56|  uint bits;
  263|     56|  cache_align_(UInt ublock[BLOCK_SIZE]);
  ------------------
  |  |   42|     56|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
  264|       |  /* perform decorrelating transform */
  265|     56|  _t2(fwd_xform, Int, DIMS)(iblock);
  ------------------
  |  |   10|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#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|     56|  _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    9|     56|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     56|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    1|     56|#define PERM _t1(perm, DIMS)           /* coefficient order */
  |  |  ------------------
  |  |  |  |    9|     56|#define _t1(function, arg)        _cat2(function, arg)
  |  |  |  |  ------------------
  |  |  |  |  |  |    5|     56|#define _cat2(x, y)    x ## _ ## y
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _t1(fwd_order, Int)(ublock, iblock, PERM, BLOCK_SIZE);
  ------------------
  |  |    2|     56|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     56|#define DIMS 4
  |  |  ------------------
  ------------------
  272|       |  /* encode integer coefficients */
  273|     56|  bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    9|     56|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     56|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                bits = _t1(encode_ints, UInt)(stream, maxbits, maxprec, ublock, BLOCK_SIZE);
  ------------------
  |  |    2|     56|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     56|#define DIMS 4
  |  |  ------------------
  ------------------
  274|       |  /* write at least minbits bits by padding with zeros */
  275|     56|  if (bits < minbits) {
  ------------------
  |  Branch (275:7): [True: 0, False: 56]
  ------------------
  276|      0|    stream_pad(stream, minbits - bits);
  277|      0|    bits = minbits;
  278|      0|  }
  279|     56|  return bits;
  280|     56|}
encode4f.c:fwd_lift_int32:
   32|  14.3k|{
   33|  14.3k|  Int x, y, z, w;
  ------------------
  |  |    4|  14.3k|#define Int int32          /* corresponding signed integer type */
  ------------------
   34|  14.3k|  x = *p; p += s;
   35|  14.3k|  y = *p; p += s;
   36|  14.3k|  z = *p; p += s;
   37|  14.3k|  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.3k|  x += w; x >>= 1; w -= x;
   47|  14.3k|  z += y; z >>= 1; y -= z;
   48|  14.3k|  x += z; x >>= 1; z -= x;
   49|  14.3k|  w += y; w >>= 1; y -= w;
   50|  14.3k|  w += y >> 1; y -= w >> 1;
   51|       |
   52|  14.3k|  p -= s; *p = w;
   53|  14.3k|  p -= s; *p = z;
   54|  14.3k|  p -= s; *p = y;
   55|  14.3k|  p -= s; *p = x;
   56|  14.3k|}
encode4f.c:fwd_order_int32:
   84|     56|{
   85|     56|  do
   86|  14.3k|    *ublock++ = _t1(int2uint, Int)(iblock[*perm++]);
  ------------------
  |  |    9|  14.3k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  14.3k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   87|  14.3k|  while (--n);
  ------------------
  |  Branch (87:10): [True: 14.2k, False: 56]
  ------------------
   88|     56|}
encode4f.c:int2uint_int32:
   77|  14.3k|{
   78|  14.3k|  return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  14.3k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
                return ((UInt)x + NBMASK) ^ NBMASK;
  ------------------
  |  |    8|  14.3k|#define NBMASK 0xaaaaaaaau /* negabinary mask */
  ------------------
   79|  14.3k|}
encode4f.c:encode_ints_uint32:
  240|     56|{
  241|       |  /* use fastest available encoder implementation */
  242|     56|  if (with_maxbits(maxbits, maxprec, size)) {
  ------------------
  |  Branch (242:7): [True: 20, False: 36]
  ------------------
  243|       |    /* rate constrained path: encode partial bit planes */
  244|     20|    if (size <= 64)
  ------------------
  |  Branch (244:9): [True: 0, False: 20]
  ------------------
  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|     20|    else
  247|     20|      return _t1(encode_many_ints, UInt)(stream, maxbits, maxprec, data, size); /* 4D blocks */
  ------------------
  |  |    9|     20|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     20|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
  248|     20|  }
  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|     56|}
encode4f.c:encode_many_ints_uint32:
  137|     20|{
  138|       |  /* make a copy of bit stream to avoid aliasing */
  139|     20|  bitstream s = *stream;
  140|     20|  uint intprec = (uint)(CHAR_BIT * sizeof(UInt));
  141|     20|  uint kmin = intprec > maxprec ? intprec - maxprec : 0;
  ------------------
  |  Branch (141:15): [True: 0, False: 20]
  ------------------
  142|     20|  uint bits = maxbits;
  143|     20|  uint i, k, m, n, c;
  144|       |
  145|       |  /* encode one bit plane at a time from MSB to LSB */
  146|    115|  for (k = intprec, n = 0; bits && k-- > kmin;) {
  ------------------
  |  Branch (146:28): [True: 95, False: 20]
  |  Branch (146:36): [True: 95, False: 0]
  ------------------
  147|       |    /* step 1: encode first n bits of bit plane #k */
  148|     95|    m = MIN(n, bits);
  ------------------
  |  |    4|     95|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 95, False: 0]
  |  |  ------------------
  ------------------
  149|     95|    bits -= m;
  150|     95|    for (i = 0; i < m; i++)
  ------------------
  |  Branch (150:17): [True: 0, False: 95]
  ------------------
  151|      0|      stream_write_bit(&s, (data[i] >> k) & 1u);
  152|       |    /* step 2: count remaining one-bits in bit plane */
  153|     95|    c = 0;
  154|  24.4k|    for (i = m; i < size; i++)
  ------------------
  |  Branch (154:17): [True: 24.3k, False: 95]
  ------------------
  155|  24.3k|      c += (data[i] >> k) & 1u;
  156|       |    /* step 3: unary run-length encode remainder of bit plane */
  157|    115|    for (; bits && n < size; n++) {
  ------------------
  |  Branch (157:12): [True: 95, False: 20]
  |  Branch (157:20): [True: 95, False: 0]
  ------------------
  158|     95|      bits--;
  159|     95|      if (stream_write_bit(&s, !!c)) {
  ------------------
  |  Branch (159:11): [True: 20, False: 75]
  ------------------
  160|       |        /* positive group test (c > 0); scan for one-bit */
  161|  1.38k|        for (c--; bits && n < size - 1; n++) {
  ------------------
  |  Branch (161:19): [True: 1.36k, False: 20]
  |  Branch (161:27): [True: 1.36k, False: 0]
  ------------------
  162|  1.36k|          bits--;
  163|  1.36k|          if (stream_write_bit(&s, (data[n] >> k) & 1u))
  ------------------
  |  Branch (163:15): [True: 0, False: 1.36k]
  ------------------
  164|      0|            break;
  165|  1.36k|        }
  166|     20|      }
  167|     75|      else {
  168|       |        /* negative group test (c == 0); done with bit plane */
  169|     75|        break;
  170|     75|      }
  171|     95|    }
  172|     95|  }
  173|       |
  174|     20|  *stream = s;
  175|     20|  return maxbits - bits;
  176|     20|}
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|  90.8k|    for (i = 0; i < n; i++)
  ------------------
  |  Branch (221:17): [True: 90.3k, False: 512]
  ------------------
  222|  90.3k|      stream_write_bit(&s, (data[i] >> k) & 1u);
  223|       |    /* step 2: count remaining one-bits in bit plane */
  224|    512|    c = 0;
  225|  41.2k|    for (i = n; i < size; i++)
  ------------------
  |  Branch (225:17): [True: 40.6k, False: 512]
  ------------------
  226|  40.6k|      c += (data[i] >> k) & 1u;
  227|       |    /* step 3: unary run-length encode remainder of bit plane */
  228|  1.04k|    for (; n < size && stream_write_bit(&s, !!c); n++)
  ------------------
  |  Branch (228:12): [True: 770, False: 276]
  |  Branch (228:24): [True: 534, False: 236]
  ------------------
  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.68k, False: 498]
  ------------------
  230|  8.68k|        ;
  231|    512|  }
  232|       |
  233|     36|  *stream = s;
  234|     36|  return (uint)(stream_wtell(&s) - offset);
  235|     36|}

zfp_encode_block_strided_float_3:
   57|     47|{
   58|       |  /* gather block from strided array */
   59|     47|  cache_align_(Scalar block[64]);
  ------------------
  |  |   42|     47|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   60|     47|  _t2(gather, Scalar, 3)(block, p, sx, sy, sz);
  ------------------
  |  |   10|     47|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     47|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   61|       |  /* encode block */
   62|     47|  return _t2(zfp_encode_block, Scalar, 3)(stream, block);
  ------------------
  |  |   10|     47|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     47|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   63|     47|}
encode3f.c:fwd_xform_int32_3:
   36|     47|{
   37|     47|  uint x, y, z;
   38|       |  /* transform along x */
   39|    235|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (39:15): [True: 188, False: 47]
  ------------------
   40|    940|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (40:17): [True: 752, False: 188]
  ------------------
   41|    752|      _t1(fwd_lift, Int)(p + 4 * y + 16 * z, 1);
  ------------------
  |  |    9|    752|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    752|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   42|       |  /* transform along y */
   43|    235|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (43:15): [True: 188, False: 47]
  ------------------
   44|    940|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (44:17): [True: 752, False: 188]
  ------------------
   45|    752|      _t1(fwd_lift, Int)(p + 16 * z + 1 * x, 4);
  ------------------
  |  |    9|    752|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    752|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   46|       |  /* transform along z */
   47|    235|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (47:15): [True: 188, False: 47]
  ------------------
   48|    940|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (48:17): [True: 752, False: 188]
  ------------------
   49|    752|      _t1(fwd_lift, Int)(p + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|    752|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|    752|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   50|     47|}
encode3f.c:gather_float_3:
    6|     47|{
    7|     47|  uint x, y, z;
    8|    235|  for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (8:15): [True: 188, False: 47]
  ------------------
    9|    940|    for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (9:17): [True: 752, False: 188]
  ------------------
   10|  3.76k|      for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (10:19): [True: 3.00k, False: 752]
  ------------------
   11|  3.00k|        *q++ = *p;
   12|     47|}
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|     56|{
   73|       |  /* gather block from strided array */
   74|     56|  cache_align_(Scalar block[256]);
  ------------------
  |  |   42|     56|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   75|     56|  _t2(gather, Scalar, 4)(block, p, sx, sy, sz, sw);
  ------------------
  |  |   10|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   76|       |  /* encode block */
   77|     56|  return _t2(zfp_encode_block, Scalar, 4)(stream, block);
  ------------------
  |  |   10|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   78|     56|}
encode4f.c:fwd_xform_int32_4:
   43|     56|{
   44|     56|  uint x, y, z, w;
   45|       |  /* transform along x */
   46|    280|  for (w = 0; w < 4; w++)
  ------------------
  |  Branch (46:15): [True: 224, False: 56]
  ------------------
   47|  1.12k|    for (z = 0; z < 4; z++)
  ------------------
  |  Branch (47:17): [True: 896, False: 224]
  ------------------
   48|  4.48k|      for (y = 0; y < 4; y++)
  ------------------
  |  Branch (48:19): [True: 3.58k, False: 896]
  ------------------
   49|  3.58k|        _t1(fwd_lift, Int)(p + 4 * y + 16 * z + 64 * w, 1);
  ------------------
  |  |    9|  3.58k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.58k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   50|       |  /* transform along y */
   51|    280|  for (x = 0; x < 4; x++)
  ------------------
  |  Branch (51:15): [True: 224, False: 56]
  ------------------
   52|  1.12k|    for (w = 0; w < 4; w++)
  ------------------
  |  Branch (52:17): [True: 896, False: 224]
  ------------------
   53|  4.48k|      for (z = 0; z < 4; z++)
  ------------------
  |  Branch (53:19): [True: 3.58k, False: 896]
  ------------------
   54|  3.58k|        _t1(fwd_lift, Int)(p + 16 * z + 64 * w + 1 * x, 4);
  ------------------
  |  |    9|  3.58k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.58k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   55|       |  /* transform along z */
   56|    280|  for (y = 0; y < 4; y++)
  ------------------
  |  Branch (56:15): [True: 224, False: 56]
  ------------------
   57|  1.12k|    for (x = 0; x < 4; x++)
  ------------------
  |  Branch (57:17): [True: 896, False: 224]
  ------------------
   58|  4.48k|      for (w = 0; w < 4; w++)
  ------------------
  |  Branch (58:19): [True: 3.58k, False: 896]
  ------------------
   59|  3.58k|        _t1(fwd_lift, Int)(p + 64 * w + 1 * x + 4 * y, 16);
  ------------------
  |  |    9|  3.58k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.58k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   60|       |  /* transform along w */
   61|    280|  for (z = 0; z < 4; z++)
  ------------------
  |  Branch (61:15): [True: 224, False: 56]
  ------------------
   62|  1.12k|    for (y = 0; y < 4; y++)
  ------------------
  |  Branch (62:17): [True: 896, False: 224]
  ------------------
   63|  4.48k|      for (x = 0; x < 4; x++)
  ------------------
  |  Branch (63:19): [True: 3.58k, False: 896]
  ------------------
   64|  3.58k|        _t1(fwd_lift, Int)(p + 1 * x + 4 * y + 16 * z, 64);
  ------------------
  |  |    9|  3.58k|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|  3.58k|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   65|     56|}
encode4f.c:gather_float_4:
    6|     56|{
    7|     56|  uint x, y, z, w;
    8|    280|  for (w = 0; w < 4; w++, p += sw - 4 * sz)
  ------------------
  |  Branch (8:15): [True: 224, False: 56]
  ------------------
    9|  1.12k|    for (z = 0; z < 4; z++, p += sz - 4 * sy)
  ------------------
  |  Branch (9:17): [True: 896, False: 224]
  ------------------
   10|  4.48k|      for (y = 0; y < 4; y++, p += sy - 4 * sx)
  ------------------
  |  Branch (10:19): [True: 3.58k, False: 896]
  ------------------
   11|  17.9k|        for (x = 0; x < 4; x++, p += sx)
  ------------------
  |  Branch (11:21): [True: 14.3k, False: 3.58k]
  ------------------
   12|  14.3k|          *q++ = *p;
   13|     56|}

zfp_encode_block_float_3:
   97|     47|{
   98|     47|  return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_block, Scalar, DIMS)(zfp, fblock);
  ------------------
  |  |    4|     47|#define REVERSIBLE(zfp) ((zfp)->minexp < ZFP_MIN_EXP) /* reversible mode? */
  |  |  ------------------
  |  |  |  |   21|     47|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  |  |  ------------------
  |  |  |  Branch (4:25): [True: 0, False: 47]
  |  |  ------------------
  ------------------
                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|     47|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     47|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   99|     47|}
encode3f.c:encode_block_float_3:
   64|     47|{
   65|     47|  uint bits = 1;
   66|       |  /* compute maximum exponent */
   67|     47|  int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    9|     47|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     47|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    2|     47|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     47|#define DIMS 3
  |  |  ------------------
  ------------------
   68|     47|  uint maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|     47|#define DIMS 3
  ------------------
   69|     47|  uint e = maxprec ? (uint)(emax + EBIAS) : 0;
  ------------------
  |  |    3|     47|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     47|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
  |  Branch (69:12): [True: 47, False: 0]
  ------------------
   70|       |  /* encode block only if biased exponent is nonzero */
   71|     47|  if (e) {
  ------------------
  |  Branch (71:7): [True: 47, False: 0]
  ------------------
   72|     47|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|     47|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   73|       |    /* encode common exponent; LSB indicates that exponent is nonzero */
   74|     47|    bits += EBITS;
  ------------------
  |  |    6|     47|#define EBITS 8            /* number of exponent bits */
  ------------------
   75|     47|    stream_write_bits(zfp->stream, 2 * e + 1, bits);
   76|       |    /* perform forward block-floating-point transform */
   77|     47|    _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|     47|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     47|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|     47|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     47|#define DIMS 3
  |  |  ------------------
  ------------------
   78|       |    /* encode integer block */
   79|     47|    bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|     47|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     47|#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|     47|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 8, False: 39]
  |  |  ------------------
  ------------------
   80|     47|  }
   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|     47|  return bits;
   90|     47|}
encode3f.c:exponent_block_float:
   32|     47|{
   33|     47|  Scalar max = 0;
  ------------------
  |  |    3|     47|#define Scalar float       /* floating-point type */
  ------------------
   34|  3.00k|  do {
   35|  3.00k|    Scalar f = FABS(*p++);
  ------------------
  |  |    3|  3.00k|#define Scalar float       /* floating-point type */
  ------------------
                  Scalar f = FABS(*p++);
  ------------------
  |  |   13|  3.00k|  #define FABS(x)     fabsf(x)
  ------------------
   36|  3.00k|    if (max < f)
  ------------------
  |  Branch (36:9): [True: 477, False: 2.53k]
  ------------------
   37|    477|      max = f;
   38|  3.00k|  } while (--n);
  ------------------
  |  Branch (38:12): [True: 2.96k, False: 47]
  ------------------
   39|     47|  return _t1(exponent, Scalar)(max);
  ------------------
  |  |    9|     47|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     47|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   40|     47|}
encode3f.c:exponent_float:
   12|     47|{
   13|       |  /* use e = -EBIAS when x = 0 */
   14|     47|  int e = -EBIAS;
  ------------------
  |  |    3|     47|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     47|#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|     47|  if (x > 0) {
  ------------------
  |  Branch (20:7): [True: 47, False: 0]
  ------------------
   21|     47|    FREXP(x, &e);
  ------------------
  |  |   14|     47|  #define FREXP(x, e) frexpf(x, e)
  ------------------
   22|       |    /* clamp exponent in case x is subnormal; may still result in overflow */
   23|     47|    e = MAX(e, 1 - EBIAS);
  ------------------
  |  |    5|     47|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 46, False: 1]
  |  |  ------------------
  ------------------
   24|     47|  }
   25|     47|#endif
   26|     47|  return e;
   27|     47|}
encode3f.c:fwd_cast_float:
   52|     47|{
   53|       |  /* compute power-of-two scale factor s */
   54|     47|  Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    3|     47|#define Scalar float       /* floating-point type */
  ------------------
                Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    9|     47|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     47|#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|     47|  do
   57|  3.00k|    *iblock++ = (Int)(s * *fblock++);
   58|  3.00k|  while (--n);
  ------------------
  |  Branch (58:10): [True: 2.96k, False: 47]
  ------------------
   59|     47|}
encode3f.c:quantize_float:
   45|     47|{
   46|     47|  return LDEXP(x, ((int)(CHAR_BIT * sizeof(Scalar)) - 2) - e);
  ------------------
  |  |   15|     47|  #define LDEXP(x, e) ldexpf(x, e)
  ------------------
   47|     47|}
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: 8, False: 24]
  |  |  ------------------
  ------------------
   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: 560, False: 1.48k]
  ------------------
   37|    560|      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|     56|{
   98|     56|  return REVERSIBLE(zfp) ? _t2(rev_encode_block, Scalar, DIMS)(zfp, fblock) : _t2(encode_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_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|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#define _cat3(x, y, z) x ## _ ## y ## _ ## z
  |  |  ------------------
  ------------------
   99|     56|}
encode4f.c:encode_block_float_4:
   64|     56|{
   65|     56|  uint bits = 1;
   66|       |  /* compute maximum exponent */
   67|     56|  int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    9|     56|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     56|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                int emax = _t1(exponent_block, Scalar)(fblock, BLOCK_SIZE);
  ------------------
  |  |    2|     56|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     56|#define DIMS 4
  |  |  ------------------
  ------------------
   68|     56|  uint maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
  ------------------
  |  |    1|     56|#define DIMS 4
  ------------------
   69|     56|  uint e = maxprec ? (uint)(emax + EBIAS) : 0;
  ------------------
  |  |    3|     56|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     56|#define EBITS 8            /* number of exponent bits */
  |  |  ------------------
  ------------------
  |  Branch (69:12): [True: 56, False: 0]
  ------------------
   70|       |  /* encode block only if biased exponent is nonzero */
   71|     56|  if (e) {
  ------------------
  |  Branch (71:7): [True: 56, False: 0]
  ------------------
   72|     56|    cache_align_(Int iblock[BLOCK_SIZE]);
  ------------------
  |  |   42|     56|  #define cache_align_(x) x __attribute__((aligned(ZFP_CACHE_LINE_SIZE)))
  ------------------
   73|       |    /* encode common exponent; LSB indicates that exponent is nonzero */
   74|     56|    bits += EBITS;
  ------------------
  |  |    6|     56|#define EBITS 8            /* number of exponent bits */
  ------------------
   75|     56|    stream_write_bits(zfp->stream, 2 * e + 1, bits);
   76|       |    /* perform forward block-floating-point transform */
   77|     56|    _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    9|     56|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     56|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
                  _t1(fwd_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
  ------------------
  |  |    2|     56|#define BLOCK_SIZE (1 << (2 * DIMS))   /* values per block */
  |  |  ------------------
  |  |  |  |    1|     56|#define DIMS 4
  |  |  ------------------
  ------------------
   78|       |    /* encode integer block */
   79|     56|    bits += _t2(encode_block, Int, DIMS)(zfp->stream, zfp->minbits - MIN(bits, zfp->minbits), zfp->maxbits - bits, maxprec, iblock);
  ------------------
  |  |   10|     56|#define _t2(function, type, dims) _cat3(function, type, dims)
  |  |  ------------------
  |  |  |  |    6|     56|#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|     56|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 20, False: 36]
  |  |  ------------------
  ------------------
   80|     56|  }
   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|     56|  return bits;
   90|     56|}
encode4f.c:exponent_block_float:
   32|     56|{
   33|     56|  Scalar max = 0;
  ------------------
  |  |    3|     56|#define Scalar float       /* floating-point type */
  ------------------
   34|  14.3k|  do {
   35|  14.3k|    Scalar f = FABS(*p++);
  ------------------
  |  |    3|  14.3k|#define Scalar float       /* floating-point type */
  ------------------
                  Scalar f = FABS(*p++);
  ------------------
  |  |   13|  14.3k|  #define FABS(x)     fabsf(x)
  ------------------
   36|  14.3k|    if (max < f)
  ------------------
  |  Branch (36:9): [True: 1.01k, False: 13.3k]
  ------------------
   37|  1.01k|      max = f;
   38|  14.3k|  } while (--n);
  ------------------
  |  Branch (38:12): [True: 14.2k, False: 56]
  ------------------
   39|     56|  return _t1(exponent, Scalar)(max);
  ------------------
  |  |    9|     56|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     56|#define _cat2(x, y)    x ## _ ## y
  |  |  ------------------
  ------------------
   40|     56|}
encode4f.c:exponent_float:
   12|     56|{
   13|       |  /* use e = -EBIAS when x = 0 */
   14|     56|  int e = -EBIAS;
  ------------------
  |  |    3|     56|#define EBIAS ((1 << (EBITS - 1)) - 1) /* exponent bias */
  |  |  ------------------
  |  |  |  |    6|     56|#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|     56|  if (x > 0) {
  ------------------
  |  Branch (20:7): [True: 56, False: 0]
  ------------------
   21|     56|    FREXP(x, &e);
  ------------------
  |  |   14|     56|  #define FREXP(x, e) frexpf(x, e)
  ------------------
   22|       |    /* clamp exponent in case x is subnormal; may still result in overflow */
   23|     56|    e = MAX(e, 1 - EBIAS);
  ------------------
  |  |    5|     56|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 56, False: 0]
  |  |  ------------------
  ------------------
   24|     56|  }
   25|     56|#endif
   26|     56|  return e;
   27|     56|}
encode4f.c:fwd_cast_float:
   52|     56|{
   53|       |  /* compute power-of-two scale factor s */
   54|     56|  Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    3|     56|#define Scalar float       /* floating-point type */
  ------------------
                Scalar s = _t1(quantize, Scalar)(1, emax);
  ------------------
  |  |    9|     56|#define _t1(function, arg)        _cat2(function, arg)
  |  |  ------------------
  |  |  |  |    5|     56|#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|     56|  do
   57|  14.3k|    *iblock++ = (Int)(s * *fblock++);
   58|  14.3k|  while (--n);
  ------------------
  |  Branch (58:10): [True: 14.2k, False: 56]
  ------------------
   59|     56|}
encode4f.c:quantize_float:
   45|     56|{
   46|     56|  return LDEXP(x, ((int)(CHAR_BIT * sizeof(Scalar)) - 2) - e);
  ------------------
  |  |   15|     56|  #define LDEXP(x, e) ldexpf(x, e)
  ------------------
   47|     56|}

zfp_type_size:
   90|    641|{
   91|    641|  switch (type) {
   92|      0|    case zfp_type_int32:
  ------------------
  |  Branch (92:5): [True: 0, False: 641]
  ------------------
   93|      0|      return sizeof(int32);
   94|      0|    case zfp_type_int64:
  ------------------
  |  Branch (94:5): [True: 0, False: 641]
  ------------------
   95|      0|      return sizeof(int64);
   96|    497|    case zfp_type_float:
  ------------------
  |  Branch (96:5): [True: 497, False: 144]
  ------------------
   97|    497|      return sizeof(float);
   98|    144|    case zfp_type_double:
  ------------------
  |  Branch (98:5): [True: 144, False: 497]
  ------------------
   99|    144|      return sizeof(double);
  100|      0|    default:
  ------------------
  |  Branch (100:5): [True: 0, False: 641]
  ------------------
  101|      0|      return 0;
  102|    641|  }
  103|    641|}
zfp_field_alloc:
  109|    403|{
  110|    403|  zfp_field* field = (zfp_field*)malloc(sizeof(zfp_field));
  111|    403|  if (field) {
  ------------------
  |  Branch (111:7): [True: 403, False: 0]
  ------------------
  112|    403|    field->type = zfp_type_none;
  113|    403|    field->nx = field->ny = field->nz = field->nw = 0;
  114|    403|    field->sx = field->sy = field->sz = field->sw = 0;
  115|    403|    field->data = 0;
  116|    403|  }
  117|    403|  return field;
  118|    403|}
zfp_field_3d:
  147|    235|{
  148|    235|  zfp_field* field = zfp_field_alloc();
  149|    235|  if (field) {
  ------------------
  |  Branch (149:7): [True: 235, False: 0]
  ------------------
  150|    235|    field->type = type;
  151|    235|    field->nx = nx;
  152|    235|    field->ny = ny;
  153|    235|    field->nz = nz;
  154|    235|    field->data = data;
  155|    235|  }
  156|    235|  return field;
  157|    235|}
zfp_field_4d:
  161|    168|{
  162|    168|  zfp_field* field = zfp_field_alloc();
  163|    168|  if (field) {
  ------------------
  |  Branch (163:7): [True: 168, False: 0]
  ------------------
  164|    168|    field->type = type;
  165|    168|    field->nx = nx;
  166|    168|    field->ny = ny;
  167|    168|    field->nz = nz;
  168|    168|    field->nw = nw;
  169|    168|    field->data = data;
  170|    168|  }
  171|    168|  return field;
  172|    168|}
zfp_field_free:
  176|    403|{
  177|    403|  free(field);
  178|    403|}
zfp_field_precision:
  206|    641|{
  207|       |  return (uint)(CHAR_BIT * zfp_type_size(field->type));
  208|    641|}
zfp_field_dimensionality:
  212|  1.47k|{
  213|  1.47k|  return field->nx ? field->ny ? field->nz ? field->nw ? 4 : 3 : 2 : 1 : 0;
  ------------------
  |  Branch (213:10): [True: 1.47k, False: 0]
  |  Branch (213:22): [True: 1.47k, False: 0]
  |  Branch (213:34): [True: 1.47k, False: 0]
  |  Branch (213:46): [True: 616, False: 861]
  ------------------
  214|  1.47k|}
zfp_field_blocks:
  245|    671|{
  246|    671|  size_t bx = (field->nx + 3) / 4;
  247|    671|  size_t by = (field->ny + 3) / 4;
  248|    671|  size_t bz = (field->nz + 3) / 4;
  249|    671|  size_t bw = (field->nw + 3) / 4;
  250|    671|  switch (zfp_field_dimensionality(field)) {
  251|      0|    case 1: return bx;
  ------------------
  |  Branch (251:5): [True: 0, False: 671]
  ------------------
  252|      0|    case 2: return bx * by;
  ------------------
  |  Branch (252:5): [True: 0, False: 671]
  ------------------
  253|    391|    case 3: return bx * by * bz;
  ------------------
  |  Branch (253:5): [True: 391, False: 280]
  ------------------
  254|    280|    case 4: return bx * by * bz * bw;
  ------------------
  |  Branch (254:5): [True: 280, False: 391]
  ------------------
  255|      0|    default: return 0;
  ------------------
  |  Branch (255:5): [True: 0, False: 671]
  ------------------
  256|    671|  }
  257|    671|}
zfp_field_stride:
  261|    403|{
  262|    403|  if (stride)
  ------------------
  |  Branch (262:7): [True: 0, False: 403]
  ------------------
  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|    403|  return field->sx || field->sy || field->sz || field->sw;
  ------------------
  |  Branch (277:10): [True: 0, False: 403]
  |  Branch (277:23): [True: 0, False: 403]
  |  Branch (277:36): [True: 0, False: 403]
  |  Branch (277:49): [True: 0, False: 403]
  ------------------
  278|    403|}
zfp_stream_open:
  538|    538|{
  539|    538|  zfp_stream* zfp = (zfp_stream*)malloc(sizeof(zfp_stream));
  540|    538|  if (zfp) {
  ------------------
  |  Branch (540:7): [True: 538, False: 0]
  ------------------
  541|    538|    zfp->stream = stream;
  542|    538|    zfp->minbits = ZFP_MIN_BITS;
  ------------------
  |  |   18|    538|#define ZFP_MIN_BITS     1 /* minimum number of bits per block */
  ------------------
  543|    538|    zfp->maxbits = ZFP_MAX_BITS;
  ------------------
  |  |   19|    538|#define ZFP_MAX_BITS 16658 /* maximum number of bits per block */
  ------------------
  544|    538|    zfp->maxprec = ZFP_MAX_PREC;
  ------------------
  |  |   20|    538|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  545|    538|    zfp->minexp = ZFP_MIN_EXP;
  ------------------
  |  |   21|    538|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
  546|    538|    zfp->exec.policy = zfp_exec_serial;
  547|       |    zfp->exec.params = NULL;
  548|    538|  }
  549|    538|  return zfp;
  550|    538|}
zfp_stream_close:
  554|    538|{
  555|    538|  if (zfp->exec.params != NULL)
  ------------------
  |  Branch (555:7): [True: 0, False: 538]
  ------------------
  556|      0|    free(zfp->exec.params);
  557|    538|  free(zfp);
  558|    538|}
zfp_stream_maximum_size:
  713|    403|{
  714|    403|  zfp_bool reversible = is_reversible(zfp);
  715|    403|  uint dims = zfp_field_dimensionality(field);
  716|    403|  size_t blocks = zfp_field_blocks(field);
  717|    403|  uint values = 1u << (2 * dims);
  718|    403|  uint maxbits = 0;
  719|       |
  720|    403|  if (!dims)
  ------------------
  |  Branch (720:7): [True: 0, False: 403]
  ------------------
  721|      0|    return 0;
  722|    403|  switch (field->type) {
  723|      0|    case zfp_type_int32:
  ------------------
  |  Branch (723:5): [True: 0, False: 403]
  ------------------
  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: 403]
  ------------------
  727|      0|      maxbits += reversible ? 6 : 0;
  ------------------
  |  Branch (727:18): [True: 0, False: 0]
  ------------------
  728|      0|      break;
  729|    307|    case zfp_type_float:
  ------------------
  |  Branch (729:5): [True: 307, False: 96]
  ------------------
  730|    307|      maxbits += reversible ? 1 + 1 + 8 + 5 : 1 + 8;
  ------------------
  |  Branch (730:18): [True: 0, False: 307]
  ------------------
  731|    307|      break;
  732|     96|    case zfp_type_double:
  ------------------
  |  Branch (732:5): [True: 96, False: 307]
  ------------------
  733|     96|      maxbits += reversible ? 1 + 1 + 11 + 6 : 1 + 11;
  ------------------
  |  Branch (733:18): [True: 0, False: 96]
  ------------------
  734|     96|      break;
  735|      0|    default:
  ------------------
  |  Branch (735:5): [True: 0, False: 403]
  ------------------
  736|      0|      return 0;
  737|    403|  }
  738|    403|  maxbits += values - 1 + values * MIN(zfp->maxprec, zfp_field_precision(field));
  ------------------
  |  |    4|    403|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 165, False: 238]
  |  |  ------------------
  ------------------
  739|    403|  maxbits = MIN(maxbits, zfp->maxbits);
  ------------------
  |  |    4|    403|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 331, False: 72]
  |  |  ------------------
  ------------------
  740|    403|  maxbits = MAX(maxbits, zfp->minbits);
  ------------------
  |  |    5|    403|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 331, False: 72]
  |  |  ------------------
  ------------------
  741|    403|  return ((ZFP_HEADER_MAX_BITS + blocks * maxbits + stream_word_bits - 1) & ~(stream_word_bits - 1)) / CHAR_BIT;
  ------------------
  |  |   49|    403|#define ZFP_HEADER_MAX_BITS 148 /* max number of header bits */
  ------------------
  742|    403|}
zfp_stream_set_bit_stream:
  746|    538|{
  747|    538|  zfp->stream = stream;
  748|    538|}
zfp_stream_set_rate:
  761|    108|{
  762|    108|  uint n = 1u << (2 * dims);
  763|    108|  uint bits = (uint)floor(n * rate + 0.5);
  764|    108|  switch (type) {
  765|     84|    case zfp_type_float:
  ------------------
  |  Branch (765:5): [True: 84, False: 24]
  ------------------
  766|     84|      bits = MAX(bits, 1 + 8u);
  ------------------
  |  |    5|     84|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 84, False: 0]
  |  |  ------------------
  ------------------
  767|     84|      break;
  768|     24|    case zfp_type_double:
  ------------------
  |  Branch (768:5): [True: 24, False: 84]
  ------------------
  769|     24|      bits = MAX(bits, 1 + 11u);
  ------------------
  |  |    5|     24|#define MAX(x, y) ((x) > (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 24, False: 0]
  |  |  ------------------
  ------------------
  770|     24|      break;
  771|      0|    default:
  ------------------
  |  Branch (771:5): [True: 0, False: 108]
  ------------------
  772|      0|      break;
  773|    108|  }
  774|    108|  if (align) {
  ------------------
  |  Branch (774:7): [True: 0, False: 108]
  ------------------
  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|    108|  zfp->minbits = bits;
  780|    108|  zfp->maxbits = bits;
  781|    108|  zfp->maxprec = ZFP_MAX_PREC;
  ------------------
  |  |   20|    108|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  782|    108|  zfp->minexp = ZFP_MIN_EXP;
  ------------------
  |  |   21|    108|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
  783|    108|  return (double)bits / n;
  784|    108|}
zfp_stream_set_precision:
  788|    330|{
  789|    330|  zfp->minbits = ZFP_MIN_BITS;
  ------------------
  |  |   18|    330|#define ZFP_MIN_BITS     1 /* minimum number of bits per block */
  ------------------
  790|    330|  zfp->maxbits = ZFP_MAX_BITS;
  ------------------
  |  |   19|    330|#define ZFP_MAX_BITS 16658 /* maximum number of bits per block */
  ------------------
  791|    330|  zfp->maxprec = precision ? MIN(precision, ZFP_MAX_PREC) : ZFP_MAX_PREC;
  ------------------
  |  |    4|    330|#define MIN(x, y) ((x) < (y) ? (x) : (y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 298, False: 32]
  |  |  ------------------
  ------------------
                zfp->maxprec = precision ? MIN(precision, ZFP_MAX_PREC) : ZFP_MAX_PREC;
  ------------------
  |  |   20|    330|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  |  Branch (791:18): [True: 330, False: 0]
  ------------------
  792|    330|  zfp->minexp = ZFP_MIN_EXP;
  ------------------
  |  |   21|    330|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
  793|    330|  return zfp->maxprec;
  794|    330|}
zfp_stream_set_accuracy:
  798|     64|{
  799|     64|  int emin = ZFP_MIN_EXP;
  ------------------
  |  |   21|     64|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
  800|     64|  if (tolerance > 0) {
  ------------------
  |  Branch (800:7): [True: 64, False: 0]
  ------------------
  801|       |    /* tolerance = x * 2^emin, with 0.5 <= x < 1 */
  802|     64|    frexp(tolerance, &emin);
  803|     64|    emin--;
  804|       |    /* assert: 2^emin <= tolerance < 2^(emin+1) */
  805|     64|  }
  806|     64|  zfp->minbits = ZFP_MIN_BITS;
  ------------------
  |  |   18|     64|#define ZFP_MIN_BITS     1 /* minimum number of bits per block */
  ------------------
  807|     64|  zfp->maxbits = ZFP_MAX_BITS;
  ------------------
  |  |   19|     64|#define ZFP_MAX_BITS 16658 /* maximum number of bits per block */
  ------------------
  808|     64|  zfp->maxprec = ZFP_MAX_PREC;
  ------------------
  |  |   20|     64|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  809|     64|  zfp->minexp = emin;
  810|     64|  return tolerance > 0 ? ldexp(1.0, emin) : 0;
  ------------------
  |  Branch (810:10): [True: 64, False: 0]
  ------------------
  811|     64|}
zfp_stream_rewind:
  889|    538|{
  890|    538|  stream_rewind(zfp->stream);
  891|    538|}
zfp_compress:
 1053|    135|{
 1054|       |  /* function table [execution][strided][dimensionality][scalar type] */
 1055|    135|  void (*ftable[3][2][4][4])(zfp_stream*, const zfp_field*) = {
 1056|       |    /* serial */
 1057|    135|    {{{ compress_int32_1,         compress_int64_1,         compress_float_1,         compress_double_1 },
 1058|    135|      { compress_strided_int32_2, compress_strided_int64_2, compress_strided_float_2, compress_strided_double_2 },
 1059|    135|      { compress_strided_int32_3, compress_strided_int64_3, compress_strided_float_3, compress_strided_double_3 },
 1060|    135|      { compress_strided_int32_4, compress_strided_int64_4, compress_strided_float_4, compress_strided_double_4 }},
 1061|    135|     {{ compress_strided_int32_1, compress_strided_int64_1, compress_strided_float_1, compress_strided_double_1 },
 1062|    135|      { compress_strided_int32_2, compress_strided_int64_2, compress_strided_float_2, compress_strided_double_2 },
 1063|    135|      { compress_strided_int32_3, compress_strided_int64_3, compress_strided_float_3, compress_strided_double_3 },
 1064|    135|      { 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|    135|    {{{ NULL }}},
 1078|    135|#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|    135|    {{{ NULL }}},
 1092|    135|#endif
 1093|    135|  };
 1094|    135|  uint exec = zfp->exec.policy;
 1095|    135|  uint strided = (uint)zfp_field_stride(field, NULL);
 1096|    135|  uint dims = zfp_field_dimensionality(field);
 1097|    135|  uint type = field->type;
 1098|    135|  void (*compress)(zfp_stream*, const zfp_field*);
 1099|       |
 1100|    135|  switch (type) {
 1101|      0|    case zfp_type_int32:
  ------------------
  |  Branch (1101:5): [True: 0, False: 135]
  ------------------
 1102|      0|    case zfp_type_int64:
  ------------------
  |  Branch (1102:5): [True: 0, False: 135]
  ------------------
 1103|    103|    case zfp_type_float:
  ------------------
  |  Branch (1103:5): [True: 103, False: 32]
  ------------------
 1104|    135|    case zfp_type_double:
  ------------------
  |  Branch (1104:5): [True: 32, False: 103]
  ------------------
 1105|    135|      break;
 1106|      0|    default:
  ------------------
  |  Branch (1106:5): [True: 0, False: 135]
  ------------------
 1107|      0|      return 0;
 1108|    135|  }
 1109|       |
 1110|       |  /* return 0 if compression mode is not supported */
 1111|    135|  compress = ftable[exec][strided][dims - 1][type - zfp_type_int32];
 1112|    135|  if (!compress)
  ------------------
  |  Branch (1112:7): [True: 0, False: 135]
  ------------------
 1113|      0|    return 0;
 1114|       |
 1115|       |  /* compress field and align bit stream on word boundary */
 1116|    135|  compress(zfp, field);
 1117|    135|  stream_flush(zfp->stream);
 1118|       |
 1119|    135|  return stream_size(zfp->stream);
 1120|    135|}
zfp_decompress:
 1124|    268|{
 1125|       |  /* function table [execution][strided][dimensionality][scalar type] */
 1126|    268|  void (*ftable[3][2][4][4])(zfp_stream*, zfp_field*) = {
 1127|       |    /* serial */
 1128|    268|    {{{ decompress_int32_1,         decompress_int64_1,         decompress_float_1,         decompress_double_1 },
 1129|    268|      { decompress_strided_int32_2, decompress_strided_int64_2, decompress_strided_float_2, decompress_strided_double_2 },
 1130|    268|      { decompress_strided_int32_3, decompress_strided_int64_3, decompress_strided_float_3, decompress_strided_double_3 },
 1131|    268|      { decompress_strided_int32_4, decompress_strided_int64_4, decompress_strided_float_4, decompress_strided_double_4 }},
 1132|    268|     {{ decompress_strided_int32_1, decompress_strided_int64_1, decompress_strided_float_1, decompress_strided_double_1 },
 1133|    268|      { decompress_strided_int32_2, decompress_strided_int64_2, decompress_strided_float_2, decompress_strided_double_2 },
 1134|    268|      { decompress_strided_int32_3, decompress_strided_int64_3, decompress_strided_float_3, decompress_strided_double_3 },
 1135|    268|      { decompress_strided_int32_4, decompress_strided_int64_4, decompress_strided_float_4, decompress_strided_double_4 }}},
 1136|       |
 1137|       |    /* OpenMP; not yet supported */
 1138|    268|    {{{ 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|    268|    {{{ NULL }}},
 1152|    268|#endif
 1153|    268|  };
 1154|    268|  uint exec = zfp->exec.policy;
 1155|    268|  uint strided = (uint)zfp_field_stride(field, NULL);
 1156|    268|  uint dims = zfp_field_dimensionality(field);
 1157|    268|  uint type = field->type;
 1158|    268|  void (*decompress)(zfp_stream*, zfp_field*);
 1159|       |
 1160|    268|  switch (type) {
 1161|      0|    case zfp_type_int32:
  ------------------
  |  Branch (1161:5): [True: 0, False: 268]
  ------------------
 1162|      0|    case zfp_type_int64:
  ------------------
  |  Branch (1162:5): [True: 0, False: 268]
  ------------------
 1163|    204|    case zfp_type_float:
  ------------------
  |  Branch (1163:5): [True: 204, False: 64]
  ------------------
 1164|    268|    case zfp_type_double:
  ------------------
  |  Branch (1164:5): [True: 64, False: 204]
  ------------------
 1165|    268|      break;
 1166|      0|    default:
  ------------------
  |  Branch (1166:5): [True: 0, False: 268]
  ------------------
 1167|      0|      return 0;
 1168|    268|  }
 1169|       |
 1170|       |  /* return 0 if decompression mode is not supported */
 1171|    268|  decompress = ftable[exec][strided][dims - 1][type - zfp_type_int32];
 1172|    268|  if (!decompress)
  ------------------
  |  Branch (1172:7): [True: 0, False: 268]
  ------------------
 1173|      0|    return 0;
 1174|       |
 1175|       |  /* decompress field and align bit stream on word boundary */
 1176|    268|  decompress(zfp, field);
 1177|    268|  stream_align(zfp->stream);
 1178|       |
 1179|    268|  return stream_size(zfp->stream);
 1180|    268|}
zfp.c:is_reversible:
   43|    403|{
   44|    403|  return zfp->minexp < ZFP_MIN_EXP;
  ------------------
  |  |   21|    403|#define ZFP_MIN_EXP  -1074 /* minimum floating-point base-2 exponent */
  ------------------
   45|    403|}

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

adler32_avx2:
  172|      2|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|      2|}
adler32_fold_copy_avx2:
  176|      9|Z_INTERNAL uint32_t adler32_fold_copy_avx2(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len) {
  177|      9|    return adler32_fold_copy_impl(adler, dst, src, len, 1);
  178|      9|}
adler32_avx2.c:adler32_fold_copy_impl:
   21|     11|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|     11|    if (src == NULL) return 1L;
  ------------------
  |  Branch (22:9): [True: 0, False: 11]
  ------------------
   23|     11|    if (len == 0) return adler;
  ------------------
  |  Branch (23:9): [True: 0, False: 11]
  ------------------
   24|       |
   25|     11|    uint32_t adler0, adler1;
   26|     11|    adler1 = (adler >> 16) & 0xffff;
   27|     11|    adler0 = adler & 0xffff;
   28|       |
   29|     17|rem_peel:
   30|     17|    if (len < 16) {
  ------------------
  |  Branch (30:9): [True: 7, False: 10]
  ------------------
   31|      7|        if (COPY) {
  ------------------
  |  Branch (31:13): [True: 7, False: 0]
  ------------------
   32|      7|            return adler32_copy_len_16(adler0, src, dst, len, adler1);
   33|      7|        } else {
   34|      0|            return adler32_len_16(adler0, src, len, adler1);
   35|      0|        }
   36|     10|    } else if (len < 32) {
  ------------------
  |  Branch (36:16): [True: 4, False: 6]
  ------------------
   37|      4|        if (COPY) {
  ------------------
  |  Branch (37:13): [True: 2, False: 2]
  ------------------
   38|      2|            return adler32_fold_copy_sse42(adler, dst, src, len);
   39|      2|        } else {
   40|      2|            return adler32_ssse3(adler, src, len);
   41|      2|        }
   42|      4|    }
   43|       |
   44|      6|    __m256i vs1, vs2, vs2_0;
   45|       |
   46|      6|    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|      6|                                           46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33);
   48|      6|    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|      6|                                             14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   50|      6|    const __m256i dot3v = _mm256_set1_epi16(1);
   51|      6|    const __m256i zero = _mm256_setzero_si256();
   52|       |
   53|     12|    while (len >= 32) {
  ------------------
  |  Branch (53:12): [True: 6, False: 6]
  ------------------
   54|      6|        vs1 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler0));
   55|      6|        vs2 = _mm256_zextsi128_si256(_mm_cvtsi32_si128(adler1));
   56|      6|        __m256i vs1_0 = vs1;
   57|      6|        __m256i vs3 = _mm256_setzero_si256();
   58|      6|        vs2_0 = vs3;
   59|       |
   60|      6|        size_t k = MIN(len, NMAX);
  ------------------
  |  |  124|      6|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 6]
  |  |  ------------------
  ------------------
   61|      6|        k -= k % 32;
   62|      6|        len -= k;
   63|       |
   64|     30|        while (k >= 64) {
  ------------------
  |  Branch (64:16): [True: 24, False: 6]
  ------------------
   65|     24|            __m256i vbuf = _mm256_loadu_si256((__m256i*)src);
   66|     24|            __m256i vbuf_0 = _mm256_loadu_si256((__m256i*)(src + 32));
   67|     24|            src += 64;
   68|     24|            k -= 64;
   69|       |
   70|     24|            __m256i vs1_sad = _mm256_sad_epu8(vbuf, zero);
   71|     24|            __m256i vs1_sad2 = _mm256_sad_epu8(vbuf_0, zero);
   72|       |
   73|     24|            if (COPY) {
  ------------------
  |  Branch (73:17): [True: 23, False: 1]
  ------------------
   74|     23|                _mm256_storeu_si256((__m256i*)dst, vbuf);
   75|     23|                _mm256_storeu_si256((__m256i*)(dst + 32), vbuf_0);
   76|     23|                dst += 64;
   77|     23|            }
   78|       |
   79|     24|            vs1 = _mm256_add_epi32(vs1, vs1_sad);
   80|     24|            vs3 = _mm256_add_epi32(vs3, vs1_0);
   81|     24|            __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v); // sum 32 uint8s to 16 shorts
   82|     24|            __m256i v_short_sum2_0 = _mm256_maddubs_epi16(vbuf_0, dot2v_0); // sum 32 uint8s to 16 shorts
   83|     24|            __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); // sum 16 shorts to 8 uint32s
   84|     24|            __m256i vsum2_0 = _mm256_madd_epi16(v_short_sum2_0, dot3v); // sum 16 shorts to 8 uint32s
   85|     24|            vs1 = _mm256_add_epi32(vs1_sad2, vs1);
   86|     24|            vs2 = _mm256_add_epi32(vsum2, vs2);
   87|     24|            vs2_0 = _mm256_add_epi32(vsum2_0, vs2_0);
   88|     24|            vs1_0 = vs1;
   89|     24|        }
   90|       |
   91|      6|        vs2 = _mm256_add_epi32(vs2_0, vs2);
   92|      6|        vs3 = _mm256_slli_epi32(vs3, 6);
   93|      6|        vs2 = _mm256_add_epi32(vs3, vs2);
   94|      6|        vs3 = _mm256_setzero_si256();
   95|       |
   96|      9|        while (k >= 32) {
  ------------------
  |  Branch (96:16): [True: 3, False: 6]
  ------------------
   97|       |            /*
   98|       |               vs1 = adler + sum(c[i])
   99|       |               vs2 = sum2 + 32 vs1 + sum( (32-i+1) c[i] )
  100|       |            */
  101|      3|            __m256i vbuf = _mm256_loadu_si256((__m256i*)src);
  102|      3|            src += 32;
  103|      3|            k -= 32;
  104|       |
  105|      3|            __m256i vs1_sad = _mm256_sad_epu8(vbuf, zero); // Sum of abs diff, resulting in 2 x int32's
  106|       |
  107|      3|            if (COPY) {
  ------------------
  |  Branch (107:17): [True: 3, False: 0]
  ------------------
  108|      3|                _mm256_storeu_si256((__m256i*)dst, vbuf);
  109|      3|                dst += 32;
  110|      3|            }
  111|       | 
  112|      3|            vs1 = _mm256_add_epi32(vs1, vs1_sad);
  113|      3|            vs3 = _mm256_add_epi32(vs3, vs1_0);
  114|      3|            __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v_0); // sum 32 uint8s to 16 shorts
  115|      3|            __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); // sum 16 shorts to 8 uint32s
  116|      3|            vs2 = _mm256_add_epi32(vsum2, vs2);
  117|      3|            vs1_0 = vs1;
  118|      3|        }
  119|       |
  120|       |        /* Defer the multiplication with 32 to outside of the loop */
  121|      6|        vs3 = _mm256_slli_epi32(vs3, 5);
  122|      6|        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|      6|         adler0 = partial_hsum256(vs1) % BASE;
  ------------------
  |  |   11|      6|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  160|      6|         adler1 = hsum256(vs2) % BASE;
  ------------------
  |  |   11|      6|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  161|      6|    }
  162|       |
  163|      6|    adler = adler0 | (adler1 << 16);
  164|       |
  165|      6|    if (len) {
  ------------------
  |  Branch (165:9): [True: 6, False: 0]
  ------------------
  166|      6|        goto rem_peel;
  167|      6|    }
  168|       |
  169|      0|    return adler;
  170|      6|}

adler32_avx2.c:partial_hsum256:
   20|      6|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|      6|    const __m256i perm_vec = _mm256_setr_epi32(0, 2, 4, 6, 1, 1, 1, 1);
   24|      6|    __m256i non_zero = _mm256_permutevar8x32_epi32(x, perm_vec);
   25|      6|    __m128i non_zero_sse = _mm256_castsi256_si128(non_zero);
   26|      6|    __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|      6|    return (uint32_t)_mm_cvtsi128_si32(sum3);
   29|      6|}
adler32_avx2.c:hsum256:
   12|      6|static inline uint32_t hsum256(__m256i x) {
   13|      6|    __m128i sum1  = _mm_add_epi32(_mm256_extracti128_si256(x, 1),
   14|      6|                                  _mm256_castsi256_si128(x));
   15|      6|    __m128i sum2  = _mm_add_epi32(sum1, _mm_unpackhi_epi64(sum1, sum1));
   16|       |    __m128i sum3  = _mm_add_epi32(sum2, _mm_shuffle_epi32(sum2, 1));
   17|      6|    return (uint32_t)_mm_cvtsi128_si32(sum3);
   18|      6|}

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

adler32_ssse3:
   17|      2|Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const uint8_t *buf, size_t len) {
   18|      2|    uint32_t sum2;
   19|       |
   20|       |     /* split Adler-32 into component sums */
   21|      2|    sum2 = (adler >> 16) & 0xffff;
   22|      2|    adler &= 0xffff;
   23|       |
   24|       |    /* in case user likes doing a byte at a time, keep it fast */
   25|      2|    if (UNLIKELY(len == 1))
  ------------------
  |  |  214|      2|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 0, False: 2]
  |  |  ------------------
  ------------------
   26|      0|        return adler32_len_1(adler, buf, sum2);
   27|       |
   28|       |    /* initial Adler-32 value (deferred check for len == 1 speed) */
   29|      2|    if (UNLIKELY(buf == NULL))
  ------------------
  |  |  214|      2|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 0, False: 2]
  |  |  ------------------
  ------------------
   30|      0|        return 1L;
   31|       |
   32|       |    /* in case short lengths are provided, keep it somewhat fast */
   33|      2|    if (UNLIKELY(len < 16))
  ------------------
  |  |  214|      2|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 0, False: 2]
  |  |  ------------------
  ------------------
   34|      0|        return adler32_len_16(adler, buf, len, sum2);
   35|       |
   36|      2|    const __m128i dot2v = _mm_setr_epi8(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17);
   37|      2|    const __m128i dot2v_0 = _mm_setr_epi8(16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
   38|      2|    const __m128i dot3v = _mm_set1_epi16(1);
   39|      2|    const __m128i zero = _mm_setzero_si128();
   40|       |
   41|      2|    __m128i vbuf, vs1_0, vs3, vs1, vs2, vs2_0, v_sad_sum1, v_short_sum2, v_short_sum2_0,
   42|      2|            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|      2|    size_t max_iters = NMAX;
  ------------------
  |  |   12|      2|#define NMAX 5552
  ------------------
   50|      2|    size_t rem = (uintptr_t)buf & 15;
   51|      2|    size_t align_offset = 16 - rem;
   52|      2|    size_t k = 0;
   53|      2|    if (rem) {
  ------------------
  |  Branch (53:9): [True: 0, False: 2]
  ------------------
   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|      4|    while (len >= 16) {
  ------------------
  |  Branch (81:12): [True: 2, False: 2]
  ------------------
   82|      2|        vs1 = _mm_cvtsi32_si128(adler);
   83|      2|        vs2 = _mm_cvtsi32_si128(sum2);
   84|      2|        vs3 = _mm_setzero_si128();
   85|      2|        vs2_0 = _mm_setzero_si128();
   86|      2|        vs1_0 = vs1;
   87|       |
   88|      2|        k = (len < max_iters ? len : max_iters);
  ------------------
  |  Branch (88:14): [True: 2, False: 0]
  ------------------
   89|      2|        k -= k % 16;
   90|      2|        len -= k;
   91|       |
   92|      2|        while (k >= 32) {
  ------------------
  |  Branch (92:16): [True: 0, False: 2]
  ------------------
   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|      2|        vs2 = _mm_add_epi32(vs2_0, vs2);
  118|      2|        vs3 = _mm_slli_epi32(vs3, 5);
  119|      2|        vs2 = _mm_add_epi32(vs3, vs2);
  120|      2|        vs3 = _mm_setzero_si128();
  121|       |
  122|      4|        while (k >= 16) {
  ------------------
  |  Branch (122:16): [True: 2, False: 2]
  ------------------
  123|       |            /*
  124|       |               vs1 = adler + sum(c[i])
  125|       |               vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] )
  126|       |            */
  127|      2|            vbuf = _mm_load_si128((__m128i*)buf);
  128|      2|            buf += 16;
  129|      2|            k -= 16;
  130|       |
  131|      2|unaligned_jmp:
  132|      2|            v_sad_sum1 = _mm_sad_epu8(vbuf, zero);
  133|      2|            vs1 = _mm_add_epi32(v_sad_sum1, vs1);
  134|      2|            vs3 = _mm_add_epi32(vs1_0, vs3);
  135|      2|            v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v_0);
  136|      2|            vsum2 = _mm_madd_epi16(v_short_sum2, dot3v);
  137|      2|            vs2 = _mm_add_epi32(vsum2, vs2);
  138|      2|            vs1_0 = vs1;
  139|      2|        }
  140|       |
  141|      2|        vs3 = _mm_slli_epi32(vs3, 4);
  142|      2|        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|      2|        adler = partial_hsum(vs1) % BASE;
  ------------------
  |  |   11|      2|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  148|      2|        sum2 = hsum(vs2) % BASE;
  ------------------
  |  |   11|      2|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  149|      2|        max_iters = NMAX;
  ------------------
  |  |   12|      2|#define NMAX 5552
  ------------------
  150|      2|    }
  151|       |
  152|       |    /* Process tail (len < 16).  */
  153|      2|    return adler32_len_16(adler, buf, len, sum2);
  154|      2|}

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

chunkset_avx2.c:loadhalfchunk:
   91|      1|static inline void loadhalfchunk(uint8_t const *s, halfchunk_t *chunk) {
   92|      1|    *chunk = _mm_loadu_si128((__m128i *)s);
   93|      1|}
chunkset_avx2.c:GET_HALFCHUNK_MAG:
  105|      2|static inline halfchunk_t GET_HALFCHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) {
  106|      2|    lut_rem_pair lut_rem = perm_idx_lut[dist - 3];
  107|      2|    __m128i perm_vec, ret_vec;
  108|      2|    __msan_unpoison(buf + dist, 16 - dist);
  ------------------
  |  |  338|      2|#  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|      2|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |               #  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|      2|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |  |  Branch (338:79): [Folded, False: 2]
  |  |  ------------------
  ------------------
  109|      2|    ret_vec = _mm_loadu_si128((__m128i*)buf);
  110|      2|    *chunk_rem = half_rem_vals[dist - 3];
  111|       |
  112|      2|    perm_vec = _mm_load_si128((__m128i*)(permute_table + lut_rem.idx));
  113|      2|    ret_vec = _mm_shuffle_epi8(ret_vec, perm_vec);
  114|       |
  115|      2|    return ret_vec;
  116|      2|}
chunkset_avx2.c:storehalfchunk:
   95|      1|static inline void storehalfchunk(uint8_t *out, halfchunk_t *chunk) {
   96|      1|    _mm_storeu_si128((__m128i *)out, *chunk);
   97|      1|}
chunkset_avx2.c:halfchunk2whole:
   99|      2|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|      2|    return _mm256_zextsi128_si256(*chunk);
  103|      2|}
chunkset_avx2.c:chunkmemset_2:
   22|      2|static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) {
   23|      2|    *chunk = _mm256_set1_epi16(zng_memread_2(from));
   24|      2|}
chunkset_avx2.c:chunkmemset_4:
   26|      1|static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) {
   27|      1|    *chunk = _mm256_set1_epi32(zng_memread_4(from));
   28|      1|}
chunkset_avx2.c:chunkmemset_16:
   34|      3|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|      3|    *chunk = _mm256_broadcastsi128_si256(_mm_loadu_si128((__m128i*)from));
   41|      3|#endif
   42|      3|}
chunkset_avx2.c:GET_CHUNK_MAG:
   52|      2|static inline chunk_t GET_CHUNK_MAG(uint8_t *buf, uint32_t *chunk_rem, uint32_t dist) {
   53|      2|    lut_rem_pair lut_rem = perm_idx_lut[dist - 3];
   54|      2|    __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|      2|    *chunk_rem = lut_rem.remval;
   59|       |
   60|       |    /* See note in chunkset_ssse3.c for why this is ok */
   61|      2|    __msan_unpoison(buf + dist, 32 - dist);
  ------------------
  |  |  338|      2|#  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|      2|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |               #  define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
  |  |  ------------------
  |  |  |  |  128|      2|#define Z_UNUSED(var) (void)(var)
  |  |  ------------------
  |  |  |  Branch (338:79): [Folded, False: 2]
  |  |  ------------------
  ------------------
   62|       |
   63|      2|    if (dist < 16) {
  ------------------
  |  Branch (63:9): [True: 2, False: 0]
  ------------------
   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|      2|        const __m256i permute_xform =
   68|      2|            _mm256_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   69|      2|                             16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16);
   70|      2|        __m256i perm_vec = _mm256_load_si256((__m256i*)(permute_table+lut_rem.idx));
   71|      2|        __m128i ret_vec0 = _mm_loadu_si128((__m128i*)buf);
   72|      2|        perm_vec = _mm256_add_epi8(perm_vec, permute_xform);
   73|      2|        ret_vec = _mm256_inserti128_si256(_mm256_castsi128_si256(ret_vec0), ret_vec0, 1);
   74|      2|        ret_vec = _mm256_shuffle_epi8(ret_vec, perm_vec);
   75|      2|    }  else {
   76|      0|        __m128i ret_vec0 = _mm_loadu_si128((__m128i*)buf);
   77|      0|        __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|      0|        __m128i perm_vec1 = _mm_load_si128((__m128i*)(permute_table + lut_rem.idx));
   80|      0|        __m128i xlane_permutes = _mm_cmpgt_epi8(_mm_set1_epi8(16), perm_vec1);
   81|      0|        __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|      0|        __m128i latter_half = _mm_blendv_epi8(ret_vec1, xlane_res, xlane_permutes);
   85|      0|        ret_vec = _mm256_inserti128_si256(_mm256_castsi128_si256(ret_vec0), latter_half, 1);
   86|      0|    }
   87|       |
   88|      2|    return ret_vec;
   89|      2|}
chunkset_avx2.c:storechunk:
   48|     18|static inline void storechunk(uint8_t *out, chunk_t *chunk) {
   49|     18|    _mm256_storeu_si256((__m256i *)out, *chunk);
   50|     18|}
chunkset_avx2.c:loadchunk:
   44|      3|static inline void loadchunk(uint8_t const *s, chunk_t *chunk) {
   45|      3|    *chunk = _mm256_loadu_si256((__m256i *)s);
   46|      3|}

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|     25|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|     25|    len = MIN(len, left);
  ------------------
  |  |  124|     25|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 25]
  |  |  ------------------
  ------------------
  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|     25|#ifndef HAVE_MASKED_READWRITE
  247|     25|    if (UNLIKELY(left < sizeof(chunk_t))) {
  ------------------
  |  |  214|     25|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 1, False: 24]
  |  |  ------------------
  ------------------
  248|     29|        while (len > 0) {
  ------------------
  |  Branch (248:16): [True: 28, False: 1]
  ------------------
  249|     28|            *out++ = *from++;
  250|     28|            --len;
  251|     28|        }
  252|       |
  253|      1|        return out;
  254|      1|    }
  255|     24|#endif
  256|       |
  257|     24|    if (len)
  ------------------
  |  Branch (257:9): [True: 24, False: 0]
  ------------------
  258|     24|        out = CHUNKMEMSET(out, from, len);
  ------------------
  |  |  121|     24|#define CHUNKMEMSET      chunkmemset_avx2
  ------------------
  259|       |
  260|     24|    return out;
  261|     25|}
chunkset_avx2.c:chunkmemset_avx2:
  112|     24|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|     24|    Assert(from != out, "chunkmemset cannot have a distance 0");
  116|       |
  117|     24|    chunk_t chunk_load;
  118|     24|    uint32_t chunk_mod = 0;
  119|     24|    uint32_t adv_amount;
  120|     24|    int64_t sdist = out - from;
  121|     24|    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|     24|    if (sdist < 0 && dist < len) {
  ------------------
  |  Branch (127:9): [True: 0, False: 24]
  |  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|     24|    if (dist == 1) {
  ------------------
  |  Branch (143:9): [True: 11, False: 13]
  ------------------
  144|     11|        memset(out, *from, len);
  145|     11|        return out + len;
  146|     13|    } else if (dist >= sizeof(chunk_t)) {
  ------------------
  |  Branch (146:16): [True: 2, False: 11]
  ------------------
  147|      2|        return CHUNKCOPY(out, from, len);
  ------------------
  |  |  119|      2|#define CHUNKCOPY        chunkcopy_avx2
  ------------------
  148|      2|    }
  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|     11|#ifdef HAVE_HALF_CHUNK
  158|     11|    if (len <= sizeof(halfchunk_t)) {
  ------------------
  |  Branch (158:9): [True: 4, False: 7]
  ------------------
  159|      4|        if (dist >= sizeof(halfchunk_t))
  ------------------
  |  Branch (159:13): [True: 1, False: 3]
  ------------------
  160|      1|            return HALFCHUNKCOPY(out, from, len);
  161|       |
  162|      3|        if ((dist % 2) != 0 || dist == 6) {
  ------------------
  |  Branch (162:13): [True: 2, False: 1]
  |  Branch (162:32): [True: 0, False: 1]
  ------------------
  163|      2|            halfchunk_t halfchunk_load = GET_HALFCHUNK_MAG(from, &chunk_mod, (unsigned)dist);
  164|       |
  165|      2|            if (len == sizeof(halfchunk_t)) {
  ------------------
  |  Branch (165:17): [True: 0, False: 2]
  ------------------
  166|      0|                storehalfchunk(out, &halfchunk_load);
  167|      0|                len -= sizeof(halfchunk_t);
  168|      0|                out += sizeof(halfchunk_t);
  169|      0|            }
  170|       |
  171|      2|            chunk_load = halfchunk2whole(&halfchunk_load);
  172|      2|            goto rem_bytes;
  173|      2|        }
  174|      3|    }
  175|      8|#endif
  176|       |
  177|      8|#ifdef HAVE_CHUNKMEMSET_2
  178|      8|    if (dist == 2) {
  ------------------
  |  Branch (178:9): [True: 2, False: 6]
  ------------------
  179|      2|        chunkmemset_2(from, &chunk_load);
  180|      2|    } else
  181|      6|#endif
  182|      6|#ifdef HAVE_CHUNKMEMSET_4
  183|      6|    if (dist == 4) {
  ------------------
  |  Branch (183:9): [True: 1, False: 5]
  ------------------
  184|      1|        chunkmemset_4(from, &chunk_load);
  185|      1|    } else
  186|      5|#endif
  187|      5|#ifdef HAVE_CHUNKMEMSET_8
  188|      5|    if (dist == 8) {
  ------------------
  |  Branch (188:9): [True: 0, False: 5]
  ------------------
  189|      0|        chunkmemset_8(from, &chunk_load);
  190|      0|    } else
  191|      5|#endif
  192|      5|#ifdef HAVE_CHUNKMEMSET_16
  193|      5|    if (dist == 16) {
  ------------------
  |  Branch (193:9): [True: 3, False: 2]
  ------------------
  194|      3|        chunkmemset_16(from, &chunk_load);
  195|      3|    } else
  196|      2|#endif
  197|      2|    chunk_load = GET_CHUNK_MAG(from, &chunk_mod, (unsigned)dist);
  198|       |
  199|      8|    adv_amount = sizeof(chunk_t) - chunk_mod;
  200|       |
  201|     13|    while (len >= (2 * sizeof(chunk_t))) {
  ------------------
  |  Branch (201:12): [True: 5, False: 8]
  ------------------
  202|      5|        storechunk(out, &chunk_load);
  203|      5|        storechunk(out + adv_amount, &chunk_load);
  204|      5|        out += 2 * adv_amount;
  205|      5|        len -= 2 * adv_amount;
  206|      5|    }
  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|     13|    while (len >= sizeof(chunk_t)) {
  ------------------
  |  Branch (212:12): [True: 5, False: 8]
  ------------------
  213|      5|        storechunk(out, &chunk_load);
  214|      5|        len -= adv_amount;
  215|      5|        out += adv_amount;
  216|      5|    }
  217|       |
  218|      8|#ifdef HAVE_HALF_CHUNK
  219|     10|rem_bytes:
  220|     10|#endif
  221|     10|    if (len) {
  ------------------
  |  Branch (221:9): [True: 9, False: 1]
  ------------------
  222|      9|        memcpy(out, &chunk_load, len);
  223|      9|        out += len;
  224|      9|    }
  225|       |
  226|     10|    return out;
  227|      8|}
chunkset_avx2.c:HALFCHUNKCOPY:
   91|      1|static inline uint8_t* HALFCHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) {
   92|      1|    halfchunk_t chunk;
   93|      1|    int32_t align = ((len - 1) % sizeof(halfchunk_t)) + 1;
   94|      1|    loadhalfchunk(from, &chunk);
   95|      1|    storehalfchunk(out, &chunk);
   96|      1|    out += align;
   97|      1|    from += align;
   98|      1|    len -= align;
   99|      1|    while (len > 0) {
  ------------------
  |  Branch (99:12): [True: 0, False: 1]
  ------------------
  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|      1|    return out;
  107|      1|}
chunkset_avx2.c:chunkcopy_avx2:
   24|      2|static inline uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) {
   25|      2|    Assert(len > 0, "chunkcopy should never have a length 0");
   26|      2|    chunk_t chunk;
   27|      2|    int32_t align = ((len - 1) % sizeof(chunk_t)) + 1;
   28|      2|    loadchunk(from, &chunk);
   29|      2|    storechunk(out, &chunk);
   30|      2|    out += align;
   31|      2|    from += align;
   32|      2|    len -= align;
   33|      3|    while (len > 0) {
  ------------------
  |  Branch (33:12): [True: 1, False: 2]
  ------------------
   34|      1|        loadchunk(from, &chunk);
   35|      1|        storechunk(out, &chunk);
   36|      1|        out += sizeof(chunk_t);
   37|      1|        from += sizeof(chunk_t);
   38|      1|        len -= sizeof(chunk_t);
   39|      1|    }
   40|      2|    return out;
   41|      2|}

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|     17|static int force_init_empty(void) {
   64|     17|    return 0;
   65|     17|}

zng_inflateResetKeep:
   61|     18|int32_t Z_EXPORT PREFIX(inflateResetKeep)(PREFIX3(stream) *strm) {
   62|     18|    struct inflate_state *state;
   63|       |
   64|     18|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (64:9): [True: 0, False: 18]
  ------------------
   65|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
   66|     18|    state = (struct inflate_state *)strm->state;
   67|     18|    strm->total_in = strm->total_out = state->total = 0;
   68|     18|    strm->msg = NULL;
   69|     18|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (69:9): [True: 18, False: 0]
  ------------------
   70|     18|        strm->adler = state->wrap & 1;
   71|     18|    state->mode = HEAD;
   72|     18|    state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|     18|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
   73|     18|    state->last = 0;
   74|     18|    state->havedict = 0;
   75|     18|    state->flags = -1;
   76|     18|    state->head = NULL;
   77|     18|    state->hold = 0;
   78|     18|    state->bits = 0;
   79|     18|    state->lencode = state->distcode = state->next = state->codes;
   80|     18|    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|     18|    INFLATE_RESET_KEEP_HOOK(strm);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   25|     18|#  define INFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (25:54): [Folded, False: 18]
  |  |  ------------------
  ------------------
   88|     18|    Tracev((stderr, "inflate: reset\n"));
   89|     18|    return Z_OK;
  ------------------
  |  |  180|     18|#define Z_OK            0
  ------------------
   90|     18|}
zng_inflateReset:
   92|     18|int32_t Z_EXPORT PREFIX(inflateReset)(PREFIX3(stream) *strm) {
   93|     18|    struct inflate_state *state;
   94|       |
   95|     18|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (95:9): [True: 0, False: 18]
  ------------------
   96|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
   97|     18|    state = (struct inflate_state *)strm->state;
   98|     18|    state->wsize = 0;
   99|     18|    state->whave = 0;
  100|     18|    state->wnext = 0;
  101|     18|    return PREFIX(inflateResetKeep)(strm);
  ------------------
  |  |   97|     18|#  define PREFIX(x) zng_ ## x
  ------------------
  102|     18|}
zng_inflateReset2:
  104|     18|int32_t Z_EXPORT PREFIX(inflateReset2)(PREFIX3(stream) *strm, int32_t windowBits) {
  105|     18|    int wrap;
  106|     18|    struct inflate_state *state;
  107|       |
  108|       |    /* get the state */
  109|     18|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (109:9): [True: 0, False: 18]
  ------------------
  110|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  111|     18|    state = (struct inflate_state *)strm->state;
  112|       |
  113|       |    /* extract wrap request from windowBits parameter */
  114|     18|    if (windowBits < 0) {
  ------------------
  |  Branch (114:9): [True: 0, False: 18]
  ------------------
  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|     18|    } else {
  120|     18|        wrap = (windowBits >> 4) + 5;
  121|     18|#ifdef GUNZIP
  122|     18|        if (windowBits < 48)
  ------------------
  |  Branch (122:13): [True: 18, False: 0]
  ------------------
  123|     18|            windowBits &= MAX_WBITS;
  ------------------
  |  |   39|     18|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  124|     18|#endif
  125|     18|    }
  126|       |
  127|       |    /* set number of window bits */
  128|     18|    if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   36|     36|#  define MIN_WBITS   8  /* 256 LZ77 window */
  ------------------
                  if (windowBits && (windowBits < MIN_WBITS || windowBits > MAX_WBITS))
  ------------------
  |  |   39|     18|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (128:9): [True: 18, False: 0]
  |  Branch (128:24): [True: 0, False: 18]
  |  Branch (128:50): [True: 0, False: 18]
  ------------------
  129|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  130|       |
  131|       |    /* update state and reset the rest of it */
  132|     18|    state->wrap = wrap;
  133|     18|    state->wbits = (unsigned)windowBits;
  134|     18|    return PREFIX(inflateReset)(strm);
  ------------------
  |  |   97|     18|#  define PREFIX(x) zng_ ## x
  ------------------
  135|     18|}
alloc_inflate:
  152|     18|Z_INTERNAL inflate_allocs* alloc_inflate(PREFIX3(stream) *strm) {
  153|     18|    int curr_size = 0;
  154|       |
  155|       |    /* Define sizes */
  156|     18|    int window_size = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64); /* 64B padding for chunksize */
  ------------------
  |  |   23|     18|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  157|     18|    int state_size = sizeof(inflate_state);
  158|     18|    int alloc_size = sizeof(inflate_allocs);
  159|       |
  160|       |    /* Calculate relative buffer positions and paddings */
  161|     18|    LOGSZP("window", window_size, PAD_WINDOW(curr_size), PADSZ(curr_size,WINDOW_PAD_SIZE));
  162|     18|    int window_pos = PAD_WINDOW(curr_size);
  ------------------
  |  |  465|     18|#  define PAD_WINDOW            PAD_64
  |  |  ------------------
  |  |  |  |  245|     18|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  |  |  ------------------
  |  |  |  |  |  |  243|     18|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  163|     18|    curr_size = window_pos + window_size;
  164|       |
  165|     18|    LOGSZP("state", state_size, PAD_64(curr_size), PADSZ(curr_size,64));
  166|     18|    int state_pos = PAD_64(curr_size);
  ------------------
  |  |  245|     18|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  243|     18|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  167|     18|    curr_size = state_pos + state_size;
  168|       |
  169|     18|    LOGSZP("alloc", alloc_size, PAD_16(curr_size), PADSZ(curr_size,16));
  170|     18|    int alloc_pos = PAD_16(curr_size);
  ------------------
  |  |  244|     18|#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16))
  |  |  ------------------
  |  |  |  |  243|     18|#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
  |  |  ------------------
  ------------------
  171|     18|    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|     18|    int total_size = PAD_64(curr_size + (WINDOW_PAD_SIZE - 1));
  ------------------
  |  |  245|     18|#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
  |  |  ------------------
  |  |  |  |  243|     18|#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|     18|    char *original_buf = (char *)strm->zalloc(strm->opaque, 1, total_size);
  178|     18|    if (original_buf == NULL)
  ------------------
  |  Branch (178:9): [True: 0, False: 18]
  ------------------
  179|      0|        return NULL;
  180|       |
  181|     18|    char *buff = (char *)HINT_ALIGNED_WINDOW((char *)PAD_WINDOW(original_buf));
  ------------------
  |  |  467|     18|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  236|     18|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  231|     18|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  182|     18|    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|     18|    inflate_allocs *alloc_bufs  = (struct inflate_allocs_s *)(buff + alloc_pos);
  186|     18|    alloc_bufs->buf_start = original_buf;
  187|     18|    alloc_bufs->zfree = strm->zfree;
  188|       |
  189|     18|    alloc_bufs->window =  (unsigned char *)HINT_ALIGNED_WINDOW((buff + window_pos));
  ------------------
  |  |  467|     18|#  define HINT_ALIGNED_WINDOW   HINT_ALIGNED_64
  |  |  ------------------
  |  |  |  |  236|     18|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  |  |  ------------------
  |  |  |  |  |  |  231|     18|#  define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  190|     18|    alloc_bufs->state = (inflate_state *)HINT_ALIGNED_64((buff + state_pos));
  ------------------
  |  |  236|     18|#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
  |  |  ------------------
  |  |  |  |  231|     18|#  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|     18|    return alloc_bufs;
  200|     18|}
free_inflate:
  205|     18|Z_INTERNAL void free_inflate(PREFIX3(stream) *strm) {
  206|     18|    struct inflate_state *state = (struct inflate_state *)strm->state;
  207|       |
  208|     18|    if (state->alloc_bufs != NULL) {
  ------------------
  |  Branch (208:9): [True: 18, False: 0]
  ------------------
  209|     18|        inflate_allocs *alloc_bufs = state->alloc_bufs;
  210|     18|        alloc_bufs->zfree(strm->opaque, alloc_bufs->buf_start);
  211|       |        strm->state = NULL;
  212|     18|    }
  213|     18|}
zng_inflateInit2:
  219|     18|int32_t ZNG_CONDEXPORT PREFIX(inflateInit2)(PREFIX3(stream) *strm, int32_t windowBits) {
  220|     18|    struct inflate_state *state;
  221|     18|    int32_t ret;
  222|       |
  223|       |    /* Initialize functable */
  224|     18|    FUNCTABLE_INIT;
  ------------------
  |  |   48|     18|#  define FUNCTABLE_INIT if (functable.force_init()) {return Z_VERSION_ERROR;}
  |  |  ------------------
  |  |  |  |  188|      0|#define Z_VERSION_ERROR (-6)
  |  |  ------------------
  |  |  |  Branch (48:30): [True: 0, False: 18]
  |  |  ------------------
  ------------------
  225|       |
  226|     18|    if (strm == NULL)
  ------------------
  |  Branch (226:9): [True: 0, False: 18]
  ------------------
  227|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  228|     18|    strm->msg = NULL;                   /* in case we return an error */
  229|     18|    if (strm->zalloc == NULL) {
  ------------------
  |  Branch (229:9): [True: 18, False: 0]
  ------------------
  230|     18|        strm->zalloc = PREFIX(zcalloc);
  ------------------
  |  |   97|     18|#  define PREFIX(x) zng_ ## x
  ------------------
  231|     18|        strm->opaque = NULL;
  232|     18|    }
  233|     18|    if (strm->zfree == NULL)
  ------------------
  |  Branch (233:9): [True: 18, False: 0]
  ------------------
  234|     18|        strm->zfree = PREFIX(zcfree);
  ------------------
  |  |   97|     18|#  define PREFIX(x) zng_ ## x
  ------------------
  235|       |
  236|     18|    inflate_allocs *alloc_bufs = alloc_inflate(strm);
  237|     18|    if (alloc_bufs == NULL)
  ------------------
  |  Branch (237:9): [True: 0, False: 18]
  ------------------
  238|      0|        return Z_MEM_ERROR;
  ------------------
  |  |  186|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  239|       |
  240|     18|    state = alloc_bufs->state;
  241|     18|    state->window = alloc_bufs->window;
  242|     18|    state->alloc_bufs = alloc_bufs;
  243|     18|    state->wbufsize = INFLATE_ADJUST_WINDOW_SIZE((1 << MAX_WBITS) + 64);
  ------------------
  |  |   23|     18|#  define INFLATE_ADJUST_WINDOW_SIZE(n) (n)
  ------------------
  244|     18|    Tracev((stderr, "inflate: allocated\n"));
  245|       |
  246|     18|    strm->state = (struct internal_state *)state;
  247|     18|    state->strm = strm;
  248|     18|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  249|     18|    ret = PREFIX(inflateReset2)(strm, windowBits);
  ------------------
  |  |   97|     18|#  define PREFIX(x) zng_ ## x
  ------------------
  250|     18|    if (ret != Z_OK) {
  ------------------
  |  |  180|     18|#define Z_OK            0
  ------------------
  |  Branch (250:9): [True: 0, False: 18]
  ------------------
  251|      0|        free_inflate(strm);
  252|      0|    }
  253|     18|    return ret;
  254|     18|}
zng_inflateInit:
  257|     18|int32_t Z_EXPORT PREFIX(inflateInit)(PREFIX3(stream) *strm) {
  258|     18|    return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |   97|     18|#  define PREFIX(x) zng_ ## x
  ------------------
                  return PREFIX(inflateInit2)(strm, DEF_WBITS);
  ------------------
  |  |   35|     18|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |   39|     18|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  259|     18|}
zng_fixedtables:
  303|     12|void Z_INTERNAL PREFIX(fixedtables)(struct inflate_state *state) {
  304|     12|    state->lencode = lenfix;
  305|     12|    state->lenbits = 9;
  306|     12|    state->distcode = distfix;
  307|     12|    state->distbits = 5;
  308|     12|}
zng_inflate:
  475|     27|int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) {
  476|     27|    struct inflate_state *state;
  477|     27|    const unsigned char *next;  /* next input */
  478|     27|    unsigned char *put;         /* next output */
  479|     27|    unsigned char *from;        /* where to copy match bytes from */
  480|     27|    unsigned have, left;        /* available input and output */
  481|     27|    uint64_t hold;              /* bit buffer */
  482|     27|    unsigned bits;              /* bits in bit buffer */
  483|     27|    uint32_t in, out;           /* save starting available input and output */
  484|     27|    unsigned copy;              /* number of stored or match bytes to copy */
  485|     27|    code here;                  /* current decoding table entry */
  486|     27|    code last;                  /* parent table entry */
  487|     27|    unsigned len;               /* length to copy for repeats, bits to drop */
  488|     27|    int32_t ret;                /* return code */
  489|     27|#ifdef GUNZIP
  490|     27|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  491|     27|#endif
  492|     27|    static const uint16_t order[19] = /* permutation of code lengths */
  493|     27|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  494|       |
  495|     27|    if (inflateStateCheck(strm) || strm->next_out == NULL ||
  ------------------
  |  Branch (495:9): [True: 0, False: 27]
  |  Branch (495:36): [True: 0, False: 27]
  ------------------
  496|     27|        (strm->next_in == NULL && strm->avail_in != 0))
  ------------------
  |  Branch (496:10): [True: 0, False: 27]
  |  Branch (496:35): [True: 0, False: 0]
  ------------------
  497|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  498|       |
  499|     27|    state = (struct inflate_state *)strm->state;
  500|     27|    if (state->mode == TYPE)      /* skip check */
  ------------------
  |  Branch (500:9): [True: 0, False: 27]
  ------------------
  501|      0|        state->mode = TYPEDO;
  502|     27|    LOAD();
  ------------------
  |  |   77|     27|    do { \
  |  |   78|     27|        put = strm->next_out; \
  |  |   79|     27|        left = strm->avail_out; \
  |  |   80|     27|        next = strm->next_in; \
  |  |   81|     27|        have = strm->avail_in; \
  |  |   82|     27|        hold = state->hold; \
  |  |   83|     27|        bits = state->bits; \
  |  |   84|     27|    } while (0)
  |  |  ------------------
  |  |  |  Branch (84:14): [Folded, False: 27]
  |  |  ------------------
  ------------------
  503|     27|    in = have;
  504|     27|    out = left;
  505|     27|    ret = Z_OK;
  ------------------
  |  |  180|     27|#define Z_OK            0
  ------------------
  506|     27|    for (;;)
  507|    239|        switch (state->mode) {
  508|     18|        case HEAD:
  ------------------
  |  Branch (508:9): [True: 18, False: 221]
  ------------------
  509|     18|            if (state->wrap == 0) {
  ------------------
  |  Branch (509:17): [True: 0, False: 18]
  ------------------
  510|      0|                state->mode = TYPEDO;
  511|      0|                break;
  512|      0|            }
  513|     18|            NEEDBITS(16);
  ------------------
  |  |  107|     18|    do { \
  |  |  108|     54|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 36, False: 18]
  |  |  ------------------
  |  |  109|     36|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     36|    do { \
  |  |  |  |  387|     36|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 36]
  |  |  |  |  ------------------
  |  |  |  |  388|     36|        have--; \
  |  |  |  |  389|     36|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     36|        bits += 8; \
  |  |  |  |  391|     36|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     18|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 18]
  |  |  ------------------
  ------------------
  514|     18|#ifdef GUNZIP
  515|     18|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (515:17): [True: 0, False: 18]
  |  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|     18|            if (state->head != NULL)
  ------------------
  |  Branch (524:17): [True: 0, False: 18]
  ------------------
  525|      0|                state->head->done = -1;
  526|     18|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (526:17): [True: 0, False: 18]
  ------------------
  527|       |#else
  528|       |            if (
  529|       |#endif
  530|     18|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  114|     18|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  |  Branch (530:17): [True: 0, False: 18]
  ------------------
  531|      0|                SET_BAD("incorrect header 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]
  |  |  ------------------
  ------------------
  532|      0|                break;
  533|      0|            }
  534|     18|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  114|     18|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  212|     18|#define Z_DEFLATED   8
  ------------------
  |  Branch (534:17): [True: 0, False: 18]
  ------------------
  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|     18|            DROPBITS(4);
  ------------------
  |  |  118|     18|    do { \
  |  |  119|     18|        hold >>= (n); \
  |  |  120|     18|        bits -= (unsigned)(n); \
  |  |  121|     18|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 18]
  |  |  ------------------
  ------------------
  539|     18|            len = BITS(4) + 8;
  ------------------
  |  |  114|     18|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  540|     18|            if (state->wbits == 0)
  ------------------
  |  Branch (540:17): [True: 0, False: 18]
  ------------------
  541|      0|                state->wbits = len;
  542|     18|            if (len > MAX_WBITS || len > state->wbits) {
  ------------------
  |  |   39|     36|#  define MAX_WBITS   15 /* 32K LZ77 window */
  ------------------
  |  Branch (542:17): [True: 0, False: 18]
  |  Branch (542:36): [True: 0, False: 18]
  ------------------
  543|      0|                SET_BAD("invalid window size");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  544|      0|                break;
  545|      0|            }
  546|       |#ifdef INFLATE_STRICT
  547|       |            state->dmax = 1U << len;
  548|       |#endif
  549|     18|            state->flags = 0;               /* indicate zlib header */
  550|     18|            Tracev((stderr, "inflate:   zlib header ok\n"));
  551|     18|            strm->adler = state->check = ADLER32_INITIAL_VALUE;
  ------------------
  |  |   65|     18|#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */
  ------------------
  552|     18|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (552:27): [True: 0, False: 18]
  ------------------
  553|     18|            INITBITS();
  ------------------
  |  |   99|     18|    do { \
  |  |  100|     18|        hold = 0; \
  |  |  101|     18|        bits = 0; \
  |  |  102|     18|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 18]
  |  |  ------------------
  ------------------
  554|     18|            break;
  555|      0|#ifdef GUNZIP
  556|       |
  557|      0|        case FLAGS:
  ------------------
  |  Branch (557:9): [True: 0, False: 239]
  ------------------
  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: 239]
  ------------------
  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: 239]
  ------------------
  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: 239]
  ------------------
  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: 239]
  ------------------
  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: 239]
  ------------------
  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: 239]
  ------------------
  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: 239]
  ------------------
  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|      0|        case DICTID:
  ------------------
  |  Branch (704:9): [True: 0, False: 239]
  ------------------
  705|      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]
  |  |  ------------------
  ------------------
  706|      0|            strm->adler = state->check = ZSWAP32((unsigned)hold);
  ------------------
  |  |  170|      0|#  define ZSWAP32(q) __builtin_bswap32(q)
  ------------------
  707|      0|            INITBITS();
  ------------------
  |  |   99|      0|    do { \
  |  |  100|      0|        hold = 0; \
  |  |  101|      0|        bits = 0; \
  |  |  102|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  708|      0|            state->mode = DICT;
  709|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  710|       |
  711|      0|        case DICT:
  ------------------
  |  Branch (711:9): [True: 0, False: 239]
  ------------------
  712|      0|            if (state->havedict == 0) {
  ------------------
  |  Branch (712:17): [True: 0, False: 0]
  ------------------
  713|      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]
  |  |  ------------------
  ------------------
  714|      0|                return Z_NEED_DICT;
  ------------------
  |  |  182|      0|#define Z_NEED_DICT     2
  ------------------
  715|      0|            }
  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|     26|        case TYPE:
  ------------------
  |  Branch (720:9): [True: 26, False: 213]
  ------------------
  721|     26|            if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  176|     52|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES)
  ------------------
  |  |  177|     26|#define Z_TREES         6
  ------------------
  |  Branch (721:17): [True: 0, False: 26]
  |  Branch (721:37): [True: 0, False: 26]
  ------------------
  722|      0|                goto inf_leave;
  723|     26|            Z_FALLTHROUGH;
  ------------------
  |  |   45|     26|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  724|       |
  725|     26|        case TYPEDO:
  ------------------
  |  Branch (725:9): [True: 0, False: 239]
  ------------------
  726|       |            /* determine and dispatch block type */
  727|     26|            INFLATE_TYPEDO_HOOK(strm, flush);  /* hook for IBM Z DFLTCC */
  ------------------
  |  |   29|     26|#  define INFLATE_TYPEDO_HOOK(strm, flush) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (29:57): [Folded, False: 26]
  |  |  ------------------
  ------------------
  728|     26|            if (state->last) {
  ------------------
  |  Branch (728:17): [True: 4, False: 22]
  ------------------
  729|      4|                BYTEBITS();
  ------------------
  |  |  125|      4|    do { \
  |  |  126|      4|        hold >>= bits & 7; \
  |  |  127|      4|        bits -= bits & 7; \
  |  |  128|      4|    } while (0)
  |  |  ------------------
  |  |  |  Branch (128:14): [Folded, False: 4]
  |  |  ------------------
  ------------------
  730|      4|                state->mode = CHECK;
  731|      4|                break;
  732|      4|            }
  733|     22|            NEEDBITS(3);
  ------------------
  |  |  107|     22|    do { \
  |  |  108|     41|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 19, False: 22]
  |  |  ------------------
  |  |  109|     22|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     19|    do { \
  |  |  |  |  387|     19|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 19]
  |  |  |  |  ------------------
  |  |  |  |  388|     19|        have--; \
  |  |  |  |  389|     19|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     19|        bits += 8; \
  |  |  |  |  391|     19|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     22|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 22]
  |  |  ------------------
  ------------------
  734|     22|            state->last = BITS(1);
  ------------------
  |  |  114|     22|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  735|     22|            DROPBITS(1);
  ------------------
  |  |  118|     22|    do { \
  |  |  119|     22|        hold >>= (n); \
  |  |  120|     22|        bits -= (unsigned)(n); \
  |  |  121|     22|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 22]
  |  |  ------------------
  ------------------
  736|     22|            switch (BITS(2)) {
  ------------------
  |  |  114|     22|    (hold & ((1U << (unsigned)(n)) - 1))
  |  |  ------------------
  |  |  |  Branch (114:5): [True: 22, False: 0]
  |  |  ------------------
  ------------------
  737|      3|            case 0:                             /* stored block */
  ------------------
  |  Branch (737:13): [True: 3, False: 19]
  ------------------
  738|      3|                Tracev((stderr, "inflate:     stored block%s\n", state->last ? " (last)" : ""));
  739|      3|                state->mode = STORED;
  740|      3|                break;
  741|     12|            case 1:                             /* fixed block */
  ------------------
  |  Branch (741:13): [True: 12, False: 10]
  ------------------
  742|     12|                PREFIX(fixedtables)(state);
  ------------------
  |  |   97|     12|#  define PREFIX(x) zng_ ## x
  ------------------
  743|     12|                Tracev((stderr, "inflate:     fixed codes block%s\n", state->last ? " (last)" : ""));
  744|     12|                state->mode = LEN_;             /* decode codes */
  745|     12|                if (flush == Z_TREES) {
  ------------------
  |  |  177|     12|#define Z_TREES         6
  ------------------
  |  Branch (745:21): [True: 0, False: 12]
  ------------------
  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|     12|                break;
  750|     12|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (750:13): [True: 6, False: 16]
  ------------------
  751|      6|                Tracev((stderr, "inflate:     dynamic codes block%s\n", state->last ? " (last)" : ""));
  752|      6|                state->mode = TABLE;
  753|      6|                break;
  754|      1|            case 3:
  ------------------
  |  Branch (754:13): [True: 1, False: 21]
  ------------------
  755|      1|                SET_BAD("invalid block type");
  ------------------
  |  |  132|      1|    do { \
  |  |  133|      1|        state->mode = BAD; \
  |  |  134|      1|        strm->msg = (char *)errmsg; \
  |  |  135|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  756|     22|            }
  757|     22|            DROPBITS(2);
  ------------------
  |  |  118|     22|    do { \
  |  |  119|     22|        hold >>= (n); \
  |  |  120|     22|        bits -= (unsigned)(n); \
  |  |  121|     22|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 22]
  |  |  ------------------
  ------------------
  758|     22|            break;
  759|       |
  760|      5|        case STORED:
  ------------------
  |  Branch (760:9): [True: 5, False: 234]
  ------------------
  761|       |            /* get and verify stored block length */
  762|      5|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  125|      5|    do { \
  |  |  126|      5|        hold >>= bits & 7; \
  |  |  127|      5|        bits -= bits & 7; \
  |  |  128|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (128:14): [Folded, False: 5]
  |  |  ------------------
  ------------------
  763|      5|            NEEDBITS(32);
  ------------------
  |  |  107|      5|    do { \
  |  |  108|     12|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 11, False: 1]
  |  |  ------------------
  |  |  109|     11|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     11|    do { \
  |  |  |  |  387|     11|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 4, False: 7]
  |  |  |  |  ------------------
  |  |  |  |  388|     11|        have--; \
  |  |  |  |  389|      7|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      7|        bits += 8; \
  |  |  |  |  391|      7|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  764|      1|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (764:17): [True: 0, False: 1]
  ------------------
  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|      1|            state->length = (uint16_t)hold;
  769|      1|            Tracev((stderr, "inflate:       stored length %u\n", state->length));
  770|      1|            INITBITS();
  ------------------
  |  |   99|      1|    do { \
  |  |  100|      1|        hold = 0; \
  |  |  101|      1|        bits = 0; \
  |  |  102|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  ------------------
  ------------------
  771|      1|            state->mode = COPY_;
  772|      1|            if (flush == Z_TREES)
  ------------------
  |  |  177|      1|#define Z_TREES         6
  ------------------
  |  Branch (772:17): [True: 0, False: 1]
  ------------------
  773|      0|                goto inf_leave;
  774|      1|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      1|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  775|       |
  776|      1|        case COPY_:
  ------------------
  |  Branch (776:9): [True: 0, False: 239]
  ------------------
  777|      1|            state->mode = COPY;
  778|      1|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      1|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  779|       |
  780|      3|        case COPY:
  ------------------
  |  Branch (780:9): [True: 2, False: 237]
  ------------------
  781|       |            /* copy stored block from input to output */
  782|      3|            copy = state->length;
  783|      3|            if (copy) {
  ------------------
  |  Branch (783:17): [True: 3, False: 0]
  ------------------
  784|      3|                copy = MIN(copy, have);
  ------------------
  |  |  124|      3|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 3, False: 0]
  |  |  ------------------
  ------------------
  785|      3|                copy = MIN(copy, left);
  ------------------
  |  |  124|      3|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 3]
  |  |  ------------------
  ------------------
  786|      3|                if (copy == 0)
  ------------------
  |  Branch (786:21): [True: 2, False: 1]
  ------------------
  787|      2|                    goto inf_leave;
  788|      1|                memcpy(put, next, copy);
  789|      1|                have -= copy;
  790|      1|                next += copy;
  791|      1|                left -= copy;
  792|      1|                put += copy;
  793|      1|                state->length -= copy;
  794|      1|                break;
  795|      3|            }
  796|      0|            Tracev((stderr, "inflate:       stored end\n"));
  797|      0|            state->mode = TYPE;
  798|      0|            break;
  799|       |
  800|      7|        case TABLE:
  ------------------
  |  Branch (800:9): [True: 7, False: 232]
  ------------------
  801|       |            /* get dynamic table entries descriptor */
  802|      7|            NEEDBITS(14);
  ------------------
  |  |  107|      7|    do { \
  |  |  108|     18|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 13, False: 5]
  |  |  ------------------
  |  |  109|     13|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     13|    do { \
  |  |  |  |  387|     13|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 2, False: 11]
  |  |  |  |  ------------------
  |  |  |  |  388|     13|        have--; \
  |  |  |  |  389|     11|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     11|        bits += 8; \
  |  |  |  |  391|     11|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      7|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 5]
  |  |  ------------------
  ------------------
  803|      5|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  114|      5|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  804|      5|            DROPBITS(5);
  ------------------
  |  |  118|      5|    do { \
  |  |  119|      5|        hold >>= (n); \
  |  |  120|      5|        bits -= (unsigned)(n); \
  |  |  121|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 5]
  |  |  ------------------
  ------------------
  805|      5|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  114|      5|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  806|      5|            DROPBITS(5);
  ------------------
  |  |  118|      5|    do { \
  |  |  119|      5|        hold >>= (n); \
  |  |  120|      5|        bits -= (unsigned)(n); \
  |  |  121|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 5]
  |  |  ------------------
  ------------------
  807|      5|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  114|      5|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  808|      5|            DROPBITS(4);
  ------------------
  |  |  118|      5|    do { \
  |  |  119|      5|        hold >>= (n); \
  |  |  120|      5|        bits -= (unsigned)(n); \
  |  |  121|      5|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 5]
  |  |  ------------------
  ------------------
  809|      5|#ifndef PKZIP_BUG_WORKAROUND
  810|      5|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (810:17): [True: 0, False: 5]
  |  Branch (810:38): [True: 0, False: 5]
  ------------------
  811|      0|                SET_BAD("too many length or distance symbols");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  812|      0|                break;
  813|      0|            }
  814|      5|#endif
  815|      5|            Tracev((stderr, "inflate:       table sizes ok\n"));
  816|      5|            state->have = 0;
  817|      5|            state->mode = LENLENS;
  818|      5|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      5|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  819|       |
  820|      5|        case LENLENS:
  ------------------
  |  Branch (820:9): [True: 0, False: 239]
  ------------------
  821|       |            /* get code length code lengths (not a typo) */
  822|     57|            while (state->have < state->ncode) {
  ------------------
  |  Branch (822:20): [True: 52, False: 5]
  ------------------
  823|     52|                NEEDBITS(3);
  ------------------
  |  |  107|     52|    do { \
  |  |  108|     69|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 17, False: 52]
  |  |  ------------------
  |  |  109|     52|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     17|    do { \
  |  |  |  |  387|     17|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  388|     17|        have--; \
  |  |  |  |  389|     17|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     17|        bits += 8; \
  |  |  |  |  391|     17|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     52|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 52]
  |  |  ------------------
  ------------------
  824|     52|                state->lens[order[state->have++]] = (uint16_t)BITS(3);
  ------------------
  |  |  114|     52|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  825|     52|                DROPBITS(3);
  ------------------
  |  |  118|     52|    do { \
  |  |  119|     52|        hold >>= (n); \
  |  |  120|     52|        bits -= (unsigned)(n); \
  |  |  121|     52|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 52]
  |  |  ------------------
  ------------------
  826|     52|            }
  827|     48|            while (state->have < 19)
  ------------------
  |  Branch (827:20): [True: 43, False: 5]
  ------------------
  828|     43|                state->lens[order[state->have++]] = 0;
  829|      5|            state->next = state->codes;
  830|      5|            state->lencode = (const code *)(state->next);
  831|      5|            state->lenbits = 7;
  832|      5|            ret = zng_inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work);
  833|      5|            if (ret) {
  ------------------
  |  Branch (833:17): [True: 2, False: 3]
  ------------------
  834|      2|                SET_BAD("invalid code lengths set");
  ------------------
  |  |  132|      2|    do { \
  |  |  133|      2|        state->mode = BAD; \
  |  |  134|      2|        strm->msg = (char *)errmsg; \
  |  |  135|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  835|      2|                break;
  836|      2|            }
  837|      3|            Tracev((stderr, "inflate:       code lengths ok\n"));
  838|      3|            state->have = 0;
  839|      3|            state->mode = CODELENS;
  840|      3|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      3|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  841|       |
  842|      3|        case CODELENS:
  ------------------
  |  Branch (842:9): [True: 0, False: 239]
  ------------------
  843|       |            /* get length and distance code code lengths */
  844|     42|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (844:20): [True: 40, False: 2]
  ------------------
  845|     49|                for (;;) {
  846|     49|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  114|     49|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  847|     49|                    if (here.bits <= bits) break;
  ------------------
  |  Branch (847:25): [True: 40, False: 9]
  ------------------
  848|      9|                    PULLBYTE();
  ------------------
  |  |  386|      9|    do { \
  |  |  387|      9|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (387:13): [True: 0, False: 9]
  |  |  ------------------
  |  |  388|      9|        have--; \
  |  |  389|      9|        hold += ((uint64_t)(*next++) << bits); \
  |  |  390|      9|        bits += 8; \
  |  |  391|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
  849|      9|                }
  850|     40|                if (here.val < 16) {
  ------------------
  |  Branch (850:21): [True: 23, False: 17]
  ------------------
  851|     23|                    DROPBITS(here.bits);
  ------------------
  |  |  118|     23|    do { \
  |  |  119|     23|        hold >>= (n); \
  |  |  120|     23|        bits -= (unsigned)(n); \
  |  |  121|     23|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 23]
  |  |  ------------------
  ------------------
  852|     23|                    state->lens[state->have++] = here.val;
  853|     23|                } else {
  854|     17|                    if (here.val == 16) {
  ------------------
  |  Branch (854:25): [True: 9, False: 8]
  ------------------
  855|      9|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  107|      9|    do { \
  |  |  108|     12|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 3, False: 9]
  |  |  ------------------
  |  |  109|      9|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      3|    do { \
  |  |  |  |  387|      3|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  388|      3|        have--; \
  |  |  |  |  389|      3|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      3|        bits += 8; \
  |  |  |  |  391|      3|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
  856|      9|                        DROPBITS(here.bits);
  ------------------
  |  |  118|      9|    do { \
  |  |  119|      9|        hold >>= (n); \
  |  |  120|      9|        bits -= (unsigned)(n); \
  |  |  121|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
  857|      9|                        if (state->have == 0) {
  ------------------
  |  Branch (857:29): [True: 0, False: 9]
  ------------------
  858|      0|                            SET_BAD("invalid bit length repeat");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  859|      0|                            break;
  860|      0|                        }
  861|      9|                        len = state->lens[state->have - 1];
  862|      9|                        copy = 3 + BITS(2);
  ------------------
  |  |  114|      9|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  863|      9|                        DROPBITS(2);
  ------------------
  |  |  118|      9|    do { \
  |  |  119|      9|        hold >>= (n); \
  |  |  120|      9|        bits -= (unsigned)(n); \
  |  |  121|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
  864|      9|                    } else if (here.val == 17) {
  ------------------
  |  Branch (864:32): [True: 0, False: 8]
  ------------------
  865|      0|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  866|      0|                        DROPBITS(here.bits);
  ------------------
  |  |  118|      0|    do { \
  |  |  119|      0|        hold >>= (n); \
  |  |  120|      0|        bits -= (unsigned)(n); \
  |  |  121|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  867|      0|                        len = 0;
  868|      0|                        copy = 3 + BITS(3);
  ------------------
  |  |  114|      0|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  869|      0|                        DROPBITS(3);
  ------------------
  |  |  118|      0|    do { \
  |  |  119|      0|        hold >>= (n); \
  |  |  120|      0|        bits -= (unsigned)(n); \
  |  |  121|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  870|      8|                    } else {
  871|      8|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  107|      8|    do { \
  |  |  108|     15|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 7, False: 8]
  |  |  ------------------
  |  |  109|      8|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      7|    do { \
  |  |  |  |  387|      7|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  |  |  388|      7|        have--; \
  |  |  |  |  389|      7|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      7|        bits += 8; \
  |  |  |  |  391|      7|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      8|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 8]
  |  |  ------------------
  ------------------
  872|      8|                        DROPBITS(here.bits);
  ------------------
  |  |  118|      8|    do { \
  |  |  119|      8|        hold >>= (n); \
  |  |  120|      8|        bits -= (unsigned)(n); \
  |  |  121|      8|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 8]
  |  |  ------------------
  ------------------
  873|      8|                        len = 0;
  874|      8|                        copy = 11 + BITS(7);
  ------------------
  |  |  114|      8|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  875|      8|                        DROPBITS(7);
  ------------------
  |  |  118|      8|    do { \
  |  |  119|      8|        hold >>= (n); \
  |  |  120|      8|        bits -= (unsigned)(n); \
  |  |  121|      8|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 8]
  |  |  ------------------
  ------------------
  876|      8|                    }
  877|     17|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (877:25): [True: 1, False: 16]
  ------------------
  878|      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]
  |  |  ------------------
  ------------------
  879|      1|                        break;
  880|      1|                    }
  881|    761|                    while (copy) {
  ------------------
  |  Branch (881:28): [True: 745, False: 16]
  ------------------
  882|    745|                        --copy;
  883|    745|                        state->lens[state->have++] = (uint16_t)len;
  884|    745|                    }
  885|     16|                }
  886|     40|            }
  887|       |
  888|       |            /* handle error breaks in while */
  889|      3|            if (state->mode == BAD)
  ------------------
  |  Branch (889:17): [True: 1, False: 2]
  ------------------
  890|      1|                break;
  891|       |
  892|       |            /* check for end-of-block code (better have one) */
  893|      2|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (893:17): [True: 0, False: 2]
  ------------------
  894|      0|                SET_BAD("invalid code -- missing end-of-block");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  895|      0|                break;
  896|      0|            }
  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|      2|            state->next = state->codes;
  902|      2|            state->lencode = (const code *)(state->next);
  903|      2|            state->lenbits = 10;
  904|      2|            ret = zng_inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work);
  905|      2|            if (ret) {
  ------------------
  |  Branch (905:17): [True: 2, False: 0]
  ------------------
  906|      2|                SET_BAD("invalid literal/lengths set");
  ------------------
  |  |  132|      2|    do { \
  |  |  133|      2|        state->mode = BAD; \
  |  |  134|      2|        strm->msg = (char *)errmsg; \
  |  |  135|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  907|      2|                break;
  908|      2|            }
  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|     12|        case LEN_:
  ------------------
  |  Branch (923:9): [True: 12, False: 227]
  ------------------
  924|     12|            state->mode = LEN;
  925|     12|            Z_FALLTHROUGH;
  ------------------
  |  |   45|     12|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  926|       |
  927|    100|        case LEN:
  ------------------
  |  Branch (927:9): [True: 88, False: 151]
  ------------------
  928|       |            /* use inflate_fast() if we have enough input and output */
  929|    100|            if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_LEFT) {
  ------------------
  |  |  137|    200|#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: 100]
  |  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|    100|            state->back = 0;
  938|       |
  939|       |            /* get a literal, length, or end-of-block code */
  940|    199|            for (;;) {
  941|    199|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  114|    199|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  942|    199|                if (here.bits <= bits)
  ------------------
  |  Branch (942:21): [True: 100, False: 99]
  ------------------
  943|    100|                    break;
  944|     99|                PULLBYTE();
  ------------------
  |  |  386|     99|    do { \
  |  |  387|     99|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (387:13): [True: 0, False: 99]
  |  |  ------------------
  |  |  388|     99|        have--; \
  |  |  389|     99|        hold += ((uint64_t)(*next++) << bits); \
  |  |  390|     99|        bits += 8; \
  |  |  391|     99|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 99]
  |  |  ------------------
  ------------------
  945|     99|            }
  946|    100|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (946:17): [True: 37, False: 63]
  |  Branch (946:28): [True: 0, False: 37]
  ------------------
  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|    100|            DROPBITS(here.bits);
  ------------------
  |  |  118|    100|    do { \
  |  |  119|    100|        hold >>= (n); \
  |  |  120|    100|        bits -= (unsigned)(n); \
  |  |  121|    100|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 100]
  |  |  ------------------
  ------------------
  958|    100|            state->back += here.bits;
  959|    100|            state->length = here.val;
  960|       |
  961|       |            /* process literal */
  962|    100|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (962:17): [True: 63, False: 37]
  ------------------
  963|     63|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  964|     63|                        "inflate:         literal '%c'\n" :
  965|     63|                        "inflate:         literal 0x%02x\n", here.val));
  966|     63|                state->mode = LIT;
  967|     63|                break;
  968|     63|            }
  969|       |
  970|       |            /* process end of block */
  971|     37|            if (here.op & 32) {
  ------------------
  |  Branch (971:17): [True: 8, False: 29]
  ------------------
  972|      8|                Tracevv((stderr, "inflate:         end of block\n"));
  973|      8|                state->back = -1;
  974|      8|                state->mode = TYPE;
  975|      8|                break;
  976|      8|            }
  977|       |
  978|       |            /* invalid code */
  979|     29|            if (here.op & 64) {
  ------------------
  |  Branch (979:17): [True: 1, False: 28]
  ------------------
  980|      1|                SET_BAD("invalid literal/length 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]
  |  |  ------------------
  ------------------
  981|      1|                break;
  982|      1|            }
  983|       |
  984|       |            /* length code */
  985|     28|            state->extra = (here.op & MAX_BITS);
  ------------------
  |  |   39|     28|#define MAX_BITS 15
  ------------------
  986|     28|            state->mode = LENEXT;
  987|     28|            Z_FALLTHROUGH;
  ------------------
  |  |   45|     28|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  988|       |
  989|     29|        case LENEXT:
  ------------------
  |  Branch (989:9): [True: 1, False: 238]
  ------------------
  990|       |            /* get extra bits, if any */
  991|     29|            if (state->extra) {
  ------------------
  |  Branch (991:17): [True: 21, False: 8]
  ------------------
  992|     21|                NEEDBITS(state->extra);
  ------------------
  |  |  107|     21|    do { \
  |  |  108|     25|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 6, False: 19]
  |  |  ------------------
  |  |  109|     21|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      6|    do { \
  |  |  |  |  387|      6|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 2, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  388|      6|        have--; \
  |  |  |  |  389|      4|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      4|        bits += 8; \
  |  |  |  |  391|      4|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     21|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 19]
  |  |  ------------------
  ------------------
  993|     19|                state->length += BITS(state->extra);
  ------------------
  |  |  114|     19|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  994|     19|                DROPBITS(state->extra);
  ------------------
  |  |  118|     19|    do { \
  |  |  119|     19|        hold >>= (n); \
  |  |  120|     19|        bits -= (unsigned)(n); \
  |  |  121|     19|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 19]
  |  |  ------------------
  ------------------
  995|     19|                state->back += state->extra;
  996|     19|            }
  997|     27|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  998|     27|            state->was = state->length;
  999|     27|            state->mode = DIST;
 1000|     27|            Z_FALLTHROUGH;
  ------------------
  |  |   45|     27|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1001|       |
 1002|     28|        case DIST:
  ------------------
  |  Branch (1002:9): [True: 1, False: 238]
  ------------------
 1003|       |            /* get distance code */
 1004|     47|            for (;;) {
 1005|     47|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  114|     47|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1006|     47|                if (here.bits <= bits)
  ------------------
  |  Branch (1006:21): [True: 26, False: 21]
  ------------------
 1007|     26|                    break;
 1008|     21|                PULLBYTE();
  ------------------
  |  |  386|     21|    do { \
  |  |  387|     21|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (387:13): [True: 2, False: 19]
  |  |  ------------------
  |  |  388|     21|        have--; \
  |  |  389|     19|        hold += ((uint64_t)(*next++) << bits); \
  |  |  390|     19|        bits += 8; \
  |  |  391|     19|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 19]
  |  |  ------------------
  ------------------
 1009|     21|            }
 1010|     26|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (1010:17): [True: 0, False: 26]
  ------------------
 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|     26|            DROPBITS(here.bits);
  ------------------
  |  |  118|     26|    do { \
  |  |  119|     26|        hold >>= (n); \
  |  |  120|     26|        bits -= (unsigned)(n); \
  |  |  121|     26|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 26]
  |  |  ------------------
  ------------------
 1022|     26|            state->back += here.bits;
 1023|     26|            if (here.op & 64) {
  ------------------
  |  Branch (1023:17): [True: 0, False: 26]
  ------------------
 1024|      0|                SET_BAD("invalid distance 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]
  |  |  ------------------
  ------------------
 1025|      0|                break;
 1026|      0|            }
 1027|     26|            state->offset = here.val;
 1028|     26|            state->extra = (here.op & MAX_BITS);
  ------------------
  |  |   39|     26|#define MAX_BITS 15
  ------------------
 1029|     26|            state->mode = DISTEXT;
 1030|     26|            Z_FALLTHROUGH;
  ------------------
  |  |   45|     26|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1031|       |
 1032|     27|        case DISTEXT:
  ------------------
  |  Branch (1032:9): [True: 1, False: 238]
  ------------------
 1033|       |            /* get distance extra bits, if any */
 1034|     27|            if (state->extra) {
  ------------------
  |  Branch (1034:17): [True: 11, False: 16]
  ------------------
 1035|     11|                NEEDBITS(state->extra);
  ------------------
  |  |  107|     11|    do { \
  |  |  108|     13|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 4, False: 9]
  |  |  ------------------
  |  |  109|     11|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|      4|    do { \
  |  |  |  |  387|      4|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 2, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  388|      4|        have--; \
  |  |  |  |  389|      2|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|      2|        bits += 8; \
  |  |  |  |  391|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|     11|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
 1036|      9|                state->offset += BITS(state->extra);
  ------------------
  |  |  114|      9|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
 1037|      9|                DROPBITS(state->extra);
  ------------------
  |  |  118|      9|    do { \
  |  |  119|      9|        hold >>= (n); \
  |  |  120|      9|        bits -= (unsigned)(n); \
  |  |  121|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
 1038|      9|                state->back += state->extra;
 1039|      9|            }
 1040|       |#ifdef INFLATE_STRICT
 1041|       |            if (state->offset > state->dmax) {
 1042|       |                SET_BAD("invalid distance too far back");
 1043|       |                break;
 1044|       |            }
 1045|       |#endif
 1046|     25|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1047|     25|            state->mode = MATCH;
 1048|     25|            Z_FALLTHROUGH;
  ------------------
  |  |   45|     25|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1049|       |
 1050|     25|        case MATCH:
  ------------------
  |  Branch (1050:9): [True: 0, False: 239]
  ------------------
 1051|       |            /* copy match from window to output */
 1052|     25|            if (left == 0)
  ------------------
  |  Branch (1052:17): [True: 0, False: 25]
  ------------------
 1053|      0|                goto inf_leave;
 1054|     25|            copy = out - left;
 1055|     25|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1055:17): [True: 0, False: 25]
  ------------------
 1056|      0|                copy = state->offset - copy;
 1057|      0|                if (copy > state->whave) {
  ------------------
  |  Branch (1057:21): [True: 0, 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|      0|                    SET_BAD("invalid distance too far back");
  ------------------
  |  |  132|      0|    do { \
  |  |  133|      0|        state->mode = BAD; \
  |  |  134|      0|        strm->msg = (char *)errmsg; \
  |  |  135|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1076|      0|#endif
 1077|      0|                    break;
 1078|      0|                }
 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|     25|            } else {
 1090|     25|                copy = MIN(state->length, left);
  ------------------
  |  |  124|     25|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 0, False: 25]
  |  |  ------------------
  ------------------
 1091|       |
 1092|     25|                put = FUNCTABLE_CALL(chunkmemset_safe)(put, put - state->offset, copy, left);
  ------------------
  |  |   49|     25|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1093|     25|            }
 1094|     25|            left -= copy;
 1095|     25|            state->length -= copy;
 1096|     25|            if (state->length == 0)
  ------------------
  |  Branch (1096:17): [True: 25, False: 0]
  ------------------
 1097|     25|                state->mode = LEN;
 1098|     25|            break;
 1099|       |
 1100|     63|        case LIT:
  ------------------
  |  Branch (1100:9): [True: 63, False: 176]
  ------------------
 1101|     63|            if (left == 0)
  ------------------
  |  Branch (1101:17): [True: 0, False: 63]
  ------------------
 1102|      0|                goto inf_leave;
 1103|     63|            *put++ = (unsigned char)(state->length);
 1104|     63|            left--;
 1105|     63|            state->mode = LEN;
 1106|     63|            break;
 1107|       |
 1108|      6|        case CHECK:
  ------------------
  |  Branch (1108:9): [True: 6, False: 233]
  ------------------
 1109|      6|            if (state->wrap) {
  ------------------
  |  Branch (1109:17): [True: 6, False: 0]
  ------------------
 1110|      6|                NEEDBITS(32);
  ------------------
  |  |  107|      6|    do { \
  |  |  108|     17|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (108:16): [True: 15, False: 2]
  |  |  ------------------
  |  |  109|     15|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  386|     15|    do { \
  |  |  |  |  387|     15|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (387:13): [True: 4, False: 11]
  |  |  |  |  ------------------
  |  |  |  |  388|     15|        have--; \
  |  |  |  |  389|     11|        hold += ((uint64_t)(*next++) << bits); \
  |  |  |  |  390|     11|        bits += 8; \
  |  |  |  |  391|     11|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (391:14): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  110|      6|    } while (0)
  |  |  ------------------
  |  |  |  Branch (110:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1111|      2|                out -= left;
 1112|      2|                strm->total_out += out;
 1113|      2|                state->total += out;
 1114|       |
 1115|       |                /* compute crc32 checksum if not in raw mode */
 1116|      2|                if (INFLATE_NEED_CHECKSUM(strm) && state->wrap & 4) {
  ------------------
  |  |   31|      4|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (31:39): [True: 2, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1116:52): [True: 2, False: 0]
  ------------------
 1117|      2|                    if (out) {
  ------------------
  |  Branch (1117:25): [True: 2, False: 0]
  ------------------
 1118|      2|                        inf_chksum(strm, put - out, out);
 1119|      2|                    }
 1120|      2|#ifdef GUNZIP
 1121|      2|                    if (state->flags)
  ------------------
  |  Branch (1121:25): [True: 0, False: 2]
  ------------------
 1122|      0|                        strm->adler = state->check = FUNCTABLE_CALL(crc32_fold_final)(&state->crc_fold);
  ------------------
  |  |   49|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
 1123|      2|#endif
 1124|      2|                }
 1125|      2|                out = left;
 1126|      2|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1126:21): [True: 2, False: 0]
  |  Branch (1126:42): [True: 2, False: 0]
  ------------------
 1127|      2|#ifdef GUNZIP
 1128|      2|                     state->flags ? hold :
  ------------------
  |  Branch (1128:22): [True: 0, False: 2]
  ------------------
 1129|      2|#endif
 1130|      2|                     ZSWAP32((unsigned)hold)) != state->check) {
  ------------------
  |  |  170|      2|#  define ZSWAP32(q) __builtin_bswap32(q)
  ------------------
 1131|      2|                    SET_BAD("incorrect data check");
  ------------------
  |  |  132|      2|    do { \
  |  |  133|      2|        state->mode = BAD; \
  |  |  134|      2|        strm->msg = (char *)errmsg; \
  |  |  135|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1132|      2|                    break;
 1133|      2|                }
 1134|      0|                INITBITS();
  ------------------
  |  |   99|      0|    do { \
  |  |  100|      0|        hold = 0; \
  |  |  101|      0|        bits = 0; \
  |  |  102|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1135|      0|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1136|      0|            }
 1137|      0|#ifdef GUNZIP
 1138|      0|            state->mode = LENGTH;
 1139|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1140|       |
 1141|      0|        case LENGTH:
  ------------------
  |  Branch (1141:9): [True: 0, False: 239]
  ------------------
 1142|      0|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1142:17): [True: 0, False: 0]
  |  Branch (1142:32): [True: 0, False: 0]
  ------------------
 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|      0|#endif
 1152|      0|            state->mode = DONE;
 1153|      0|            Z_FALLTHROUGH;
  ------------------
  |  |   45|      0|#    define Z_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 1154|       |
 1155|      0|        case DONE:
  ------------------
  |  Branch (1155:9): [True: 0, False: 239]
  ------------------
 1156|       |            /* inflate stream terminated properly */
 1157|      0|            ret = Z_STREAM_END;
  ------------------
  |  |  181|      0|#define Z_STREAM_END    1
  ------------------
 1158|      0|            goto inf_leave;
 1159|       |
 1160|      9|        case BAD:
  ------------------
  |  Branch (1160:9): [True: 9, False: 230]
  ------------------
 1161|      9|            ret = Z_DATA_ERROR;
  ------------------
  |  |  185|      9|#define Z_DATA_ERROR   (-3)
  ------------------
 1162|      9|            goto inf_leave;
 1163|       |
 1164|      0|        case SYNC:
  ------------------
  |  Branch (1164:9): [True: 0, False: 239]
  ------------------
 1165|       |
 1166|      0|        default:                 /* can't happen, but makes compilers happy */
  ------------------
  |  Branch (1166:9): [True: 0, False: 239]
  ------------------
 1167|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1168|    239|        }
 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|     27|  inf_leave:
 1176|     27|    RESTORE();
  ------------------
  |  |   88|     27|    do { \
  |  |   89|     27|        strm->next_out = put; \
  |  |   90|     27|        strm->avail_out = left; \
  |  |   91|     27|        strm->next_in = (z_const unsigned char *)next; \
  |  |   92|     27|        strm->avail_in = have; \
  |  |   93|     27|        state->hold = hold; \
  |  |   94|     27|        state->bits = bits; \
  |  |   95|     27|    } while (0)
  |  |  ------------------
  |  |  |  Branch (95:14): [Folded, False: 27]
  |  |  ------------------
  ------------------
 1177|     27|    uint32_t check_bytes = out - strm->avail_out;
 1178|     27|    if (INFLATE_NEED_UPDATEWINDOW(strm) &&
  ------------------
  |  |   33|     54|#  define INFLATE_NEED_UPDATEWINDOW(strm) 1
  |  |  ------------------
  |  |  |  Branch (33:43): [True: 27, Folded]
  |  |  ------------------
  ------------------
 1179|     27|            (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1179:14): [True: 9, False: 18]
  |  Branch (1179:31): [True: 11, False: 7]
  |  Branch (1179:57): [True: 9, False: 2]
  ------------------
 1180|     18|                 (state->mode < CHECK || flush != Z_FINISH)))) {
  ------------------
  |  |  175|      2|#define Z_FINISH        4
  ------------------
  |  Branch (1180:19): [True: 7, False: 2]
  |  Branch (1180:42): [True: 2, False: 0]
  ------------------
 1181|       |        /* update sliding window with respective checksum if not in "raw" mode */
 1182|     18|        updatewindow(strm, strm->next_out, check_bytes, state->wrap & 4);
 1183|     18|    }
 1184|     27|    in -= strm->avail_in;
 1185|     27|    out -= strm->avail_out;
 1186|     27|    strm->total_in += in;
 1187|     27|    strm->total_out += out;
 1188|     27|    state->total += out;
 1189|       |
 1190|     27|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1190:43): [True: 15, False: 12]
  ------------------
 1191|     27|                      (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1191:24): [True: 0, False: 27]
  |  Branch (1191:58): [True: 0, False: 27]
  |  Branch (1191:81): [True: 0, False: 27]
  ------------------
 1192|     27|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) {
  ------------------
  |  |  175|     18|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) {
  ------------------
  |  |  180|      9|#define Z_OK            0
  ------------------
  |  Branch (1192:11): [True: 9, False: 18]
  |  Branch (1192:22): [True: 9, False: 0]
  |  Branch (1192:35): [True: 0, False: 18]
  |  Branch (1192:57): [True: 9, False: 0]
  ------------------
 1193|       |        /* when no sliding window is used, hash the output bytes if no CHECK state */
 1194|      9|        if (INFLATE_NEED_CHECKSUM(strm) && !state->wsize && flush == Z_FINISH) {
  ------------------
  |  |   31|     18|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (31:39): [True: 9, Folded]
  |  |  ------------------
  ------------------
                      if (INFLATE_NEED_CHECKSUM(strm) && !state->wsize && flush == Z_FINISH) {
  ------------------
  |  |  175|      0|#define Z_FINISH        4
  ------------------
  |  Branch (1194:44): [True: 0, False: 9]
  |  Branch (1194:61): [True: 0, False: 0]
  ------------------
 1195|      0|            inf_chksum(strm, put - check_bytes, check_bytes);
 1196|      0|        }
 1197|      9|        ret = Z_BUF_ERROR;
  ------------------
  |  |  187|      9|#define Z_BUF_ERROR    (-5)
  ------------------
 1198|      9|    }
 1199|     27|    return ret;
 1200|     27|}
zng_inflateEnd:
 1202|     18|int32_t Z_EXPORT PREFIX(inflateEnd)(PREFIX3(stream) *strm) {
 1203|     18|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1203:9): [True: 0, False: 18]
  ------------------
 1204|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  184|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1205|       |
 1206|       |    /* Free allocated buffers */
 1207|     18|    free_inflate(strm);
 1208|       |
 1209|     18|    Tracev((stderr, "inflate: end\n"));
 1210|     18|    return Z_OK;
  ------------------
  |  |  180|     18|#define Z_OK            0
  ------------------
 1211|     18|}
inflate.c:inflateStateCheck:
   51|     99|static int inflateStateCheck(PREFIX3(stream) *strm) {
   52|     99|    struct inflate_state *state;
   53|     99|    if (strm == NULL || strm->zalloc == NULL || strm->zfree == NULL)
  ------------------
  |  Branch (53:9): [True: 0, False: 99]
  |  Branch (53:25): [True: 0, False: 99]
  |  Branch (53:49): [True: 0, False: 99]
  ------------------
   54|      0|        return 1;
   55|     99|    state = (struct inflate_state *)strm->state;
   56|     99|    if (state == NULL || state->alloc_bufs == NULL || state->strm != strm || state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (56:9): [True: 0, False: 99]
  |  Branch (56:26): [True: 0, False: 99]
  |  Branch (56:55): [True: 0, False: 99]
  |  Branch (56:78): [True: 0, False: 99]
  |  Branch (56:100): [True: 0, False: 99]
  ------------------
   57|      0|        return 1;
   58|     99|    return 0;
   59|     99|}
inflate.c:inf_chksum:
   39|      2|static inline void inf_chksum(PREFIX3(stream) *strm, const uint8_t *src, uint32_t len) {
   40|      2|    struct inflate_state *state = (struct inflate_state*)strm->state;
   41|      2|#ifdef GUNZIP
   42|      2|    if (state->flags) {
  ------------------
  |  Branch (42:9): [True: 0, False: 2]
  ------------------
   43|      0|        FUNCTABLE_CALL(crc32_fold)(&state->crc_fold, src, len, 0);
  ------------------
  |  |   49|      0|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   44|      0|    } else
   45|      2|#endif
   46|      2|    {
   47|      2|        strm->adler = state->check = FUNCTABLE_CALL(adler32)(state->check, src, len);
  ------------------
  |  |   49|      2|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   48|      2|    }
   49|      2|}
inflate.c:updatewindow:
  324|     18|static void updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t len, int32_t cksum) {
  325|     18|    struct inflate_state *state;
  326|     18|    uint32_t dist;
  327|       |
  328|     18|    state = (struct inflate_state *)strm->state;
  329|       |
  330|       |    /* if window not in use yet, initialize */
  331|     18|    if (state->wsize == 0)
  ------------------
  |  Branch (331:9): [True: 9, False: 9]
  ------------------
  332|      9|        state->wsize = 1U << state->wbits;
  333|       |
  334|       |    /* len state->wsize or less output bytes into the circular window */
  335|     18|    if (len >= state->wsize) {
  ------------------
  |  Branch (335:9): [True: 0, False: 18]
  ------------------
  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|     18|    } else {
  350|     18|        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|     18|        dist = MIN(dist, len);
  ------------------
  |  |  124|     18|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 18, False: 0]
  |  |  ------------------
  ------------------
  354|     18|        if (INFLATE_NEED_CHECKSUM(strm) && cksum) {
  ------------------
  |  |   31|     36|#  define INFLATE_NEED_CHECKSUM(strm) 1
  |  |  ------------------
  |  |  |  Branch (31:39): [True: 18, Folded]
  |  |  ------------------
  ------------------
  |  Branch (354:44): [True: 18, False: 0]
  ------------------
  355|     18|            inf_chksum_cpy(strm, state->window + state->wnext, end - len, dist);
  356|     18|        } else {
  357|      0|            memcpy(state->window + state->wnext, end - len, dist);
  358|      0|        }
  359|     18|        len -= dist;
  360|     18|        if (len) {
  ------------------
  |  Branch (360:13): [True: 0, False: 18]
  ------------------
  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|     18|        } else {
  370|     18|            state->wnext += dist;
  371|     18|            if (state->wnext == state->wsize)
  ------------------
  |  Branch (371:17): [True: 0, False: 18]
  ------------------
  372|      0|                state->wnext = 0;
  373|     18|            if (state->whave < state->wsize)
  ------------------
  |  Branch (373:17): [True: 18, False: 0]
  ------------------
  374|     18|                state->whave += dist;
  375|     18|        }
  376|     18|    }
  377|     18|}
inflate.c:inf_chksum_cpy:
   26|     18|                           const uint8_t *src, uint32_t copy) {
   27|     18|    if (!copy) return;
  ------------------
  |  Branch (27:9): [True: 9, False: 9]
  ------------------
   28|      9|    struct inflate_state *state = (struct inflate_state*)strm->state;
   29|      9|#ifdef GUNZIP
   30|      9|    if (state->flags) {
  ------------------
  |  Branch (30:9): [True: 0, False: 9]
  ------------------
   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|      9|#endif
   34|      9|    {
   35|      9|        strm->adler = state->check = FUNCTABLE_CALL(adler32_fold_copy)(state->check, dst, src, copy);
  ------------------
  |  |   49|      9|#  define FUNCTABLE_CALL(name) functable.name
  ------------------
   36|      9|    }
   37|      9|}

zng_inflate_table:
   31|      7|                                code * *table, unsigned *bits, uint16_t *work) {
   32|      7|    unsigned len;               /* a code's length in bits */
   33|      7|    unsigned sym;               /* index of code symbols */
   34|      7|    unsigned min, max;          /* minimum and maximum code lengths */
   35|      7|    unsigned root;              /* number of index bits for root table */
   36|      7|    unsigned curr;              /* number of index bits for current table */
   37|      7|    unsigned drop;              /* code bits to drop for sub-table */
   38|      7|    int left;                   /* number of prefix codes available */
   39|      7|    unsigned used;              /* code entries in table used */
   40|      7|    unsigned huff;              /* Huffman code */
   41|      7|    unsigned incr;              /* for incrementing code, index */
   42|      7|    unsigned fill;              /* index for replicating entries */
   43|      7|    unsigned low;               /* low bits for current root entry */
   44|      7|    unsigned mask;              /* mask for low root bits */
   45|      7|    code here;                  /* table entry for duplication */
   46|      7|    code *next;                 /* next available space in table */
   47|      7|    const uint16_t *base;       /* base value table to use */
   48|      7|    const uint16_t *extra;      /* extra bits table to use */
   49|      7|    unsigned match;             /* use base and extra for symbol >= match */
   50|      7|    uint16_t count[MAX_BITS+1];  /* number of codes of each length */
   51|      7|    uint16_t offs[MAX_BITS+1];   /* offsets in table for each length */
   52|      7|    static const uint16_t lbase[31] = { /* Length codes 257..285 base */
   53|      7|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   54|      7|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   55|      7|    static const uint16_t lext[31] = { /* Length codes 257..285 extra */
   56|      7|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   57|      7|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77};
   58|      7|    static const uint16_t dbase[32] = { /* Distance codes 0..29 base */
   59|      7|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   60|      7|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   61|      7|        8193, 12289, 16385, 24577, 0, 0};
   62|      7|    static const uint16_t dext[32] = { /* Distance codes 0..29 extra */
   63|      7|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   64|      7|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   65|      7|        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|    119|    for (len = 0; len <= MAX_BITS; len++)
  ------------------
  |  |   39|    119|#define MAX_BITS 15
  ------------------
  |  Branch (99:19): [True: 112, False: 7]
  ------------------
  100|    112|        count[len] = 0;
  101|    629|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (101:19): [True: 622, False: 7]
  ------------------
  102|    622|        count[lens[sym]]++;
  103|       |
  104|       |    /* bound code lengths, force root to be within code lengths */
  105|      7|    root = *bits;
  106|     63|    for (max = MAX_BITS; max >= 1; max--)
  ------------------
  |  |   39|      7|#define MAX_BITS 15
  ------------------
  |  Branch (106:26): [True: 63, False: 0]
  ------------------
  107|     63|        if (count[max] != 0) break;
  ------------------
  |  Branch (107:13): [True: 7, False: 56]
  ------------------
  108|      7|    root = MIN(root, max);
  ------------------
  |  |  124|      7|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 3, False: 4]
  |  |  ------------------
  ------------------
  109|      7|    if (UNLIKELY(max == 0)) {           /* no symbols to code at all */
  ------------------
  |  |  214|      7|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 0, False: 7]
  |  |  ------------------
  ------------------
  110|      0|        here.op = (unsigned char)64;    /* invalid code marker */
  111|      0|        here.bits = (unsigned char)1;
  112|      0|        here.val = (uint16_t)0;
  113|      0|        *(*table)++ = here;             /* make a table to force an error */
  114|      0|        *(*table)++ = here;
  115|      0|        *bits = 1;
  116|      0|        return 0;     /* no symbols, but wait for decoding to report error */
  117|      0|    }
  118|     19|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (118:19): [True: 19, False: 0]
  ------------------
  119|     19|        if (count[min] != 0) break;
  ------------------
  |  Branch (119:13): [True: 7, False: 12]
  ------------------
  120|      7|    root = MAX(root, min);
  ------------------
  |  |  126|      7|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (126:20): [True: 0, False: 7]
  |  |  ------------------
  ------------------
  121|       |
  122|       |    /* check for an over-subscribed or incomplete set of lengths */
  123|      7|    left = 1;
  124|     84|    for (len = 1; len <= MAX_BITS; len++) {
  ------------------
  |  |   39|     84|#define MAX_BITS 15
  ------------------
  |  Branch (124:19): [True: 79, False: 5]
  ------------------
  125|     79|        left <<= 1;
  126|     79|        left -= count[len];
  127|     79|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (127:13): [True: 2, False: 77]
  ------------------
  128|     79|    }
  129|      5|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (129:9): [True: 2, False: 3]
  |  Branch (129:22): [True: 0, False: 2]
  |  Branch (129:39): [True: 2, False: 0]
  ------------------
  130|      2|        return -1;                      /* incomplete set */
  131|       |
  132|       |    /* generate offsets into symbol table for each length for sorting */
  133|      3|    offs[1] = 0;
  134|     45|    for (len = 1; len < MAX_BITS; len++)
  ------------------
  |  |   39|     45|#define MAX_BITS 15
  ------------------
  |  Branch (134:19): [True: 42, False: 3]
  ------------------
  135|     42|        offs[len + 1] = offs[len] + count[len];
  136|       |
  137|       |    /* sort symbols by length, by symbol order within each length */
  138|     60|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (138:19): [True: 57, False: 3]
  ------------------
  139|     57|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (uint16_t)sym;
  ------------------
  |  Branch (139:13): [True: 21, False: 36]
  ------------------
  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|      3|    switch (type) {
  174|      3|    case CODES:
  ------------------
  |  Branch (174:5): [True: 3, False: 0]
  ------------------
  175|      3|        base = extra = work;    /* dummy value--not used */
  176|      3|        match = 20;
  177|      3|        break;
  178|      0|    case LENS:
  ------------------
  |  Branch (178:5): [True: 0, False: 3]
  ------------------
  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: 3]
  ------------------
  184|      0|        base = dbase;
  185|      0|        extra = dext;
  186|      0|        match = 0;
  187|      3|    }
  188|       |
  189|       |    /* initialize state for loop */
  190|      3|    huff = 0;                   /* starting code */
  191|      3|    sym = 0;                    /* starting code symbol */
  192|      3|    len = min;                  /* starting code length */
  193|      3|    next = *table;              /* current table to fill in */
  194|      3|    curr = root;                /* current table index bits */
  195|      3|    drop = 0;                   /* current bits to drop from code for index */
  196|      3|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  197|      3|    used = 1U << root;          /* use root table entries */
  198|      3|    mask = used - 1;            /* mask for comparing low */
  199|       |
  200|       |    /* check available table space */
  201|      3|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   52|      0|#define ENOUGH_LENS 1332
  ------------------
  |  Branch (201:10): [True: 0, False: 3]
  |  Branch (201:26): [True: 0, False: 0]
  ------------------
  202|      3|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|      0|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (202:10): [True: 0, False: 3]
  |  Branch (202:27): [True: 0, False: 0]
  ------------------
  203|      0|        return 1;
  204|       |
  205|       |    /* process all codes and make table entries */
  206|     21|    for (;;) {
  207|       |        /* create table entry */
  208|     21|        here.bits = (unsigned char)(len - drop);
  209|     21|        if (LIKELY(work[sym] >= match)) {
  ------------------
  |  |  213|     21|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (213:33): [True: 0, False: 21]
  |  |  ------------------
  ------------------
  210|      0|            here.op = (unsigned char)(extra[work[sym] - match]);
  211|      0|            here.val = base[work[sym] - match];
  212|     21|        } else if (work[sym] + 1U < match) {
  ------------------
  |  Branch (212:20): [True: 21, False: 0]
  ------------------
  213|     21|            here.op = (unsigned char)0;
  214|     21|            here.val = work[sym];
  215|     21|        } 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|     21|        incr = 1U << (len - drop);
  222|     21|        fill = 1U << curr;
  223|     21|        min = fill;                 /* save offset to next table */
  224|    260|        do {
  225|    260|            fill -= incr;
  226|    260|            next[(huff >> drop) + fill] = here;
  227|    260|        } while (fill != 0);
  ------------------
  |  Branch (227:18): [True: 239, False: 21]
  ------------------
  228|       |
  229|       |        /* backwards increment the len-bit code huff */
  230|     21|        incr = 1U << (len - 1);
  231|     39|        while (huff & incr)
  ------------------
  |  Branch (231:16): [True: 18, False: 21]
  ------------------
  232|     18|            incr >>= 1;
  233|     21|        if (incr != 0) {
  ------------------
  |  Branch (233:13): [True: 18, False: 3]
  ------------------
  234|     18|            huff &= incr - 1;
  235|     18|            huff += incr;
  236|     18|        } else {
  237|      3|            huff = 0;
  238|      3|        }
  239|       |
  240|       |        /* go to next symbol, update count, len */
  241|     21|        sym++;
  242|     21|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (242:13): [True: 14, False: 7]
  ------------------
  243|     14|            if (len == max)
  ------------------
  |  Branch (243:17): [True: 3, False: 11]
  ------------------
  244|      3|                break;
  245|     11|            len = lens[work[sym]];
  246|     11|        }
  247|       |
  248|       |        /* create new sub-table if needed */
  249|     18|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (249:13): [True: 0, False: 18]
  |  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|     18|    }
  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|      3|    if (UNLIKELY(huff != 0)) {
  ------------------
  |  |  214|      3|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 0, False: 3]
  |  |  ------------------
  ------------------
  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|      3|    *table += used;
  293|      3|    *bits = root;
  294|      3|    return 0;
  295|      3|}

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

chunkset_avx2.c:zng_memread_2:
   12|      2|static inline uint16_t zng_memread_2(const void *ptr) {
   13|      2|#if defined(HAVE_MAY_ALIAS)
   14|      2|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   15|      2|    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|      2|}
chunkset_avx2.c:zng_memread_4:
   23|      1|static inline uint32_t zng_memread_4(const void *ptr) {
   24|      1|#if defined(HAVE_MAY_ALIAS)
   25|      1|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|      1|    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|      1|}

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

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

zstd_compress.c:ZSTD_customMalloc:
   27|     76|{
   28|     76|    if (customMem.customAlloc)
  ------------------
  |  Branch (28:9): [True: 0, False: 76]
  ------------------
   29|      0|        return customMem.customAlloc(customMem.opaque, size);
   30|     76|    return ZSTD_malloc(size);
  ------------------
  |  |   66|     76|#define ZSTD_malloc(s) malloc(s)
  ------------------
   31|     76|}
zstd_compress.c:ZSTD_customFree:
   46|    190|{
   47|    190|    if (ptr!=NULL) {
  ------------------
  |  Branch (47:9): [True: 76, False: 114]
  ------------------
   48|     76|        if (customMem.customFree)
  ------------------
  |  Branch (48:13): [True: 0, False: 76]
  ------------------
   49|      0|            customMem.customFree(customMem.opaque, ptr);
   50|     76|        else
   51|     76|            ZSTD_free(ptr);
  ------------------
  |  |   68|     76|#define ZSTD_free(p) free((p))
  ------------------
   52|     76|    }
   53|    190|}
zstd_decompress.c:ZSTD_customFree:
   46|    122|{
   47|    122|    if (ptr!=NULL) {
  ------------------
  |  Branch (47:9): [True: 61, False: 61]
  ------------------
   48|     61|        if (customMem.customFree)
  ------------------
  |  Branch (48:13): [True: 0, False: 61]
  ------------------
   49|      0|            customMem.customFree(customMem.opaque, ptr);
   50|     61|        else
   51|     61|            ZSTD_free(ptr);
  ------------------
  |  |   68|     61|#define ZSTD_free(p) free((p))
  ------------------
   52|     61|    }
   53|    122|}
zstd_decompress.c:ZSTD_customMalloc:
   27|     61|{
   28|     61|    if (customMem.customAlloc)
  ------------------
  |  Branch (28:9): [True: 0, False: 61]
  ------------------
   29|      0|        return customMem.customAlloc(customMem.opaque, size);
   30|     61|    return ZSTD_malloc(size);
  ------------------
  |  |   66|     61|#define ZSTD_malloc(s) malloc(s)
  ------------------
   31|     61|}

zstd_compress.c:ZSTD_highbit32:
  175|  22.0k|{
  176|  22.0k|    assert(val != 0);
  ------------------
  |  |   70|  22.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  22.0k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  22.0k|}
zstd_compress.c:ZSTD_countLeadingZeros32:
   70|  22.0k|{
   71|  22.0k|    assert(val != 0);
  ------------------
  |  |   70|  22.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|  22.0k|}
zstd_fast.c:ZSTD_NbCommonBytes:
  158|  2.23k|{
  159|  2.23k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (159:9): [True: 2.23k, False: 0]
  ------------------
  160|  2.23k|        if (MEM_64bits()) {
  ------------------
  |  Branch (160:13): [True: 2.23k, False: 0]
  ------------------
  161|  2.23k|            return ZSTD_countTrailingZeros64((U64)val) >> 3;
  162|  2.23k|        } else {
  163|      0|            return ZSTD_countTrailingZeros32((U32)val) >> 3;
  164|      0|        }
  165|  2.23k|    } 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|  2.23k|}
zstd_fast.c:ZSTD_countTrailingZeros64:
   94|  2.23k|{
   95|  2.23k|    assert(val != 0);
  ------------------
  |  |   70|  2.23k|#    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|  2.23k|}
zstd_lazy.c:ZSTD_NbCommonBytes:
  158|  13.2k|{
  159|  13.2k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (159:9): [True: 13.2k, False: 0]
  ------------------
  160|  13.2k|        if (MEM_64bits()) {
  ------------------
  |  Branch (160:13): [True: 13.2k, False: 0]
  ------------------
  161|  13.2k|            return ZSTD_countTrailingZeros64((U64)val) >> 3;
  162|  13.2k|        } else {
  163|      0|            return ZSTD_countTrailingZeros32((U32)val) >> 3;
  164|      0|        }
  165|  13.2k|    } 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|  13.2k|}
zstd_lazy.c:ZSTD_countTrailingZeros64:
   94|  13.2k|{
   95|  13.2k|    assert(val != 0);
  ------------------
  |  |   70|  13.2k|#    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|  13.2k|}
zstd_lazy.c:ZSTD_countLeadingZeros32:
   70|  29.4k|{
   71|  29.4k|    assert(val != 0);
  ------------------
  |  |   70|  29.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|  29.4k|}
zstd_lazy.c:ZSTD_highbit32:
  175|  29.4k|{
  176|  29.4k|    assert(val != 0);
  ------------------
  |  |   70|  29.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  29.4k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  29.4k|}
zstd_opt.c:ZSTD_NbCommonBytes:
  158|   552k|{
  159|   552k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (159:9): [True: 552k, False: 0]
  ------------------
  160|   552k|        if (MEM_64bits()) {
  ------------------
  |  Branch (160:13): [True: 552k, False: 0]
  ------------------
  161|   552k|            return ZSTD_countTrailingZeros64((U64)val) >> 3;
  162|   552k|        } else {
  163|      0|            return ZSTD_countTrailingZeros32((U32)val) >> 3;
  164|      0|        }
  165|   552k|    } 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|   552k|}
zstd_opt.c:ZSTD_countTrailingZeros64:
   94|   552k|{
   95|   552k|    assert(val != 0);
  ------------------
  |  |   70|   552k|#    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|   552k|}
zstd_opt.c:ZSTD_countLeadingZeros32:
   70|  3.39M|{
   71|  3.39M|    assert(val != 0);
  ------------------
  |  |   70|  3.39M|#    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|  3.39M|}
zstd_opt.c:ZSTD_highbit32:
  175|  3.39M|{
  176|  3.39M|    assert(val != 0);
  ------------------
  |  |   70|  3.39M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  3.39M|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  3.39M|}
zstd_decompress_block.c:ZSTD_highbit32:
  175|  43.8k|{
  176|  43.8k|    assert(val != 0);
  ------------------
  |  |   70|  43.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  43.8k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  43.8k|}
zstd_decompress_block.c:ZSTD_countLeadingZeros32:
   70|  43.8k|{
   71|  43.8k|    assert(val != 0);
  ------------------
  |  |   70|  43.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|  43.8k|}
entropy_common.c:ZSTD_countTrailingZeros32:
   29|  2.77k|{
   30|  2.77k|    assert(val != 0);
  ------------------
  |  |   70|  2.77k|#    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|  2.77k|}
entropy_common.c:ZSTD_highbit32:
  175|  19.0k|{
  176|  19.0k|    assert(val != 0);
  ------------------
  |  |   70|  19.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  19.0k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  19.0k|}
entropy_common.c:ZSTD_countLeadingZeros32:
   70|  19.0k|{
   71|  19.0k|    assert(val != 0);
  ------------------
  |  |   70|  19.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|  19.0k|}
fse_decompress.c:ZSTD_highbit32:
  175|   100k|{
  176|   100k|    assert(val != 0);
  ------------------
  |  |   70|   100k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|   100k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|   100k|}
fse_decompress.c:ZSTD_countLeadingZeros32:
   70|   100k|{
   71|   100k|    assert(val != 0);
  ------------------
  |  |   70|   100k|#    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|   100k|}
fse_compress.c:ZSTD_highbit32:
  175|   226k|{
  176|   226k|    assert(val != 0);
  ------------------
  |  |   70|   226k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|   226k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|   226k|}
fse_compress.c:ZSTD_countLeadingZeros32:
   70|   226k|{
   71|   226k|    assert(val != 0);
  ------------------
  |  |   70|   226k|#    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|   226k|}
huf_compress.c:ZSTD_highbit32:
  175|  3.85M|{
  176|  3.85M|    assert(val != 0);
  ------------------
  |  |   70|  3.85M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  3.85M|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  3.85M|}
huf_compress.c:ZSTD_countLeadingZeros32:
   70|  3.85M|{
   71|  3.85M|    assert(val != 0);
  ------------------
  |  |   70|  3.85M|#    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|  3.85M|}
huf_decompress.c:ZSTD_highbit32:
  175|  3.55k|{
  176|  3.55k|    assert(val != 0);
  ------------------
  |  |   70|  3.55k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  3.55k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  3.55k|}
huf_decompress.c:ZSTD_countLeadingZeros32:
   70|  3.55k|{
   71|  3.55k|    assert(val != 0);
  ------------------
  |  |   70|  3.55k|#    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|  3.55k|}

zstd_compress_sequences.c:BIT_initCStream:
  152|  3.36k|{
  153|  3.36k|    bitC->bitContainer = 0;
  154|  3.36k|    bitC->bitPos = 0;
  155|  3.36k|    bitC->startPtr = (char*)startPtr;
  156|  3.36k|    bitC->ptr = bitC->startPtr;
  157|  3.36k|    bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer);
  158|  3.36k|    if (dstCapacity <= sizeof(bitC->bitContainer)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|    276|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    276|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    276|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (158:9): [True: 276, False: 3.09k]
  ------------------
  159|  3.09k|    return 0;
  160|  3.36k|}
zstd_compress_sequences.c:BIT_addBits:
  182|  98.3k|{
  183|  98.3k|    DEBUG_STATIC_ASSERT(BIT_MASK_SIZE == 32);
  ------------------
  |  |   39|  98.3k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  184|  98.3k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  98.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  185|  98.3k|    assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  98.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  186|  98.3k|    bitC->bitContainer |= BIT_getLowerBits(value, nbBits) << bitC->bitPos;
  187|  98.3k|    bitC->bitPos += nbBits;
  188|  98.3k|}
zstd_compress_sequences.c:BIT_getLowerBits:
  163|  98.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|  98.3k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  98.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  173|  98.3k|    return bitContainer & BIT_mask[nbBits];
  174|  98.3k|#endif
  175|  98.3k|}
zstd_compress_sequences.c:BIT_flushBits:
  222|  28.7k|{
  223|  28.7k|    size_t const nbBytes = bitC->bitPos >> 3;
  224|  28.7k|    assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  28.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  225|  28.7k|    assert(bitC->ptr <= bitC->endPtr);
  ------------------
  |  |   70|  28.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  226|  28.7k|    MEM_writeLEST(bitC->ptr, bitC->bitContainer);
  227|  28.7k|    bitC->ptr += nbBytes;
  228|  28.7k|    if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr;
  ------------------
  |  Branch (228:9): [True: 619, False: 28.1k]
  ------------------
  229|  28.7k|    bitC->bitPos &= 7;
  230|  28.7k|    bitC->bitContainer >>= nbBytes*8;
  231|  28.7k|}
zstd_compress_sequences.c:BIT_closeCStream:
  237|  3.09k|{
  238|  3.09k|    BIT_addBitsFast(bitC, 1, 1);   /* endMark */
  239|  3.09k|    BIT_flushBits(bitC);
  240|  3.09k|    if (bitC->ptr >= bitC->endPtr) return 0; /* overflow detected */
  ------------------
  |  Branch (240:9): [True: 305, False: 2.78k]
  ------------------
  241|  2.78k|    return (size_t)(bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0);
  242|  3.09k|}
zstd_compress_sequences.c:BIT_addBitsFast:
  195|  3.09k|{
  196|  3.09k|    assert((value>>nbBits) == 0);
  ------------------
  |  |   70|  3.09k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  197|  3.09k|    assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  3.09k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  198|  3.09k|    bitC->bitContainer |= value << bitC->bitPos;
  199|  3.09k|    bitC->bitPos += nbBits;
  200|  3.09k|}
zstd_decompress_block.c:BIT_initDStream:
  255|  4.26k|{
  256|  4.26k|    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: 4.26k]
  ------------------
  257|       |
  258|  4.26k|    bitD->start = (const char*)srcBuffer;
  259|  4.26k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  4.26k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 3.08k, False: 1.17k]
  ------------------
  262|  3.08k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  3.08k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  3.08k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  3.08k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 3.08k, False: 0]
  ------------------
  266|  3.08k|          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: 3.08k]
  ------------------
  267|  3.08k|    } else {
  268|  1.17k|        bitD->ptr   = bitD->start;
  269|  1.17k|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|  1.17k|        switch(srcSize)
  271|  1.17k|        {
  272|    106|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 106, False: 1.07k]
  ------------------
  273|    106|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    106|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|    408|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 302, False: 874]
  ------------------
  276|    408|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    408|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|    632|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 224, False: 952]
  ------------------
  279|    632|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    632|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|    822|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 190, False: 986]
  ------------------
  282|    822|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    822|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|  1.16k|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 346, False: 830]
  ------------------
  285|  1.16k|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|  1.16k|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|  1.17k|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 4, False: 1.17k]
  ------------------
  288|  1.17k|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|  1.17k|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|  1.17k|        default: break;
  ------------------
  |  Branch (290:9): [True: 4, False: 1.17k]
  ------------------
  291|  1.17k|        }
  292|  1.17k|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|  1.17k|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 1.17k, False: 0]
  ------------------
  294|  1.17k|            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: 1.17k]
  ------------------
  295|  1.17k|        }
  296|  1.17k|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|  1.17k|    }
  298|       |
  299|  4.26k|    return srcSize;
  300|  4.26k|}
zstd_decompress_block.c:BIT_readBits:
  363|  69.5k|{
  364|  69.5k|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  69.5k|    BIT_skipBits(bitD, nbBits);
  366|  69.5k|    return value;
  367|  69.5k|}
zstd_decompress_block.c:BIT_lookBits:
  331|  69.5k|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  69.5k|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  69.5k|    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|  69.5k|}
zstd_decompress_block.c:BIT_getMiddleBits:
  308|  69.5k|{
  309|  69.5k|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  69.5k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  69.5k|#    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|  69.5k|#if defined(__x86_64__) || defined(_M_X64)
  318|  69.5k|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  69.5k|}
zstd_decompress_block.c:BIT_skipBits:
  354|  86.4k|{
  355|  86.4k|    bitD->bitsConsumed += nbBits;
  356|  86.4k|}
zstd_decompress_block.c:BIT_reloadDStream:
  413|  31.7k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  31.7k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  31.7k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 31.7k]
  |  |  ------------------
  ------------------
  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|  31.7k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  31.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  31.7k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 3.51k, False: 28.1k]
  ------------------
  425|  3.51k|        return BIT_reloadDStream_internal(bitD);
  426|  3.51k|    }
  427|  28.1k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 17.3k, False: 10.8k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  17.3k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 16.2k, False: 1.09k]
  ------------------
  430|  1.09k|        return BIT_DStream_completed;
  431|  17.3k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  10.8k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  10.8k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  10.8k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 1.08k, False: 9.78k]
  ------------------
  436|  1.08k|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|  1.08k|            result = BIT_DStream_endOfBuffer;
  438|  1.08k|        }
  439|  10.8k|        bitD->ptr -= nbBytes;
  440|  10.8k|        bitD->bitsConsumed -= nbBytes*8;
  441|  10.8k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  10.8k|        return result;
  443|  28.1k|    }
  444|  28.1k|}
zstd_decompress_block.c:BIT_reloadDStream_internal:
  385|  3.51k|{
  386|  3.51k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  3.51k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  3.51k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  3.51k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  3.51k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  3.51k|    bitD->bitsConsumed &= 7;
  390|  3.51k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  3.51k|    return BIT_DStream_unfinished;
  392|  3.51k|}
zstd_decompress_block.c:BIT_readBitsFast:
  372|  16.9k|{
  373|  16.9k|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  16.9k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  16.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  16.9k|    BIT_skipBits(bitD, nbBits);
  376|  16.9k|    return value;
  377|  16.9k|}
zstd_decompress_block.c:BIT_lookBitsFast:
  347|  16.9k|{
  348|  16.9k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  16.9k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  16.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  16.9k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  16.9k|}
zstd_decompress_block.c:BIT_endOfDStream:
  450|  4.26k|{
  451|  4.26k|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 4.26k, False: 0]
  |  Branch (451:49): [True: 4.26k, False: 0]
  ------------------
  452|  4.26k|}
fse_decompress.c:BIT_initDStream:
  255|  3.03k|{
  256|  3.03k|    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: 3.03k]
  ------------------
  257|       |
  258|  3.03k|    bitD->start = (const char*)srcBuffer;
  259|  3.03k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  3.03k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 2.82k, False: 214]
  ------------------
  262|  2.82k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  2.82k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  2.82k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  2.82k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 2.82k, False: 0]
  ------------------
  266|  2.82k|          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.82k]
  ------------------
  267|  2.82k|    } else {
  268|    214|        bitD->ptr   = bitD->start;
  269|    214|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|    214|        switch(srcSize)
  271|    214|        {
  272|     72|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 72, False: 142]
  ------------------
  273|     72|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     72|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|    152|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 80, False: 134]
  ------------------
  276|    152|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    152|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|    210|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 58, False: 156]
  ------------------
  279|    210|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    210|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|    210|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 0, False: 214]
  ------------------
  282|    210|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    210|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|    214|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 4, False: 210]
  ------------------
  285|    214|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    214|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|    214|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 0, False: 214]
  ------------------
  288|    214|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|    214|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|    214|        default: break;
  ------------------
  |  Branch (290:9): [True: 0, False: 214]
  ------------------
  291|    214|        }
  292|    214|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|    214|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 214, False: 0]
  ------------------
  294|    214|            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: 214]
  ------------------
  295|    214|        }
  296|    214|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|    214|    }
  298|       |
  299|  3.03k|    return srcSize;
  300|  3.03k|}
fse_decompress.c:BIT_readBits:
  363|   633k|{
  364|   633k|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|   633k|    BIT_skipBits(bitD, nbBits);
  366|   633k|    return value;
  367|   633k|}
fse_decompress.c:BIT_lookBits:
  331|   633k|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|   633k|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|   633k|    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|   633k|}
fse_decompress.c:BIT_getMiddleBits:
  308|   633k|{
  309|   633k|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|   633k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|   633k|#    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|   633k|#if defined(__x86_64__) || defined(_M_X64)
  318|   633k|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|   633k|}
fse_decompress.c:BIT_skipBits:
  354|   634k|{
  355|   634k|    bitD->bitsConsumed += nbBits;
  356|   634k|}
fse_decompress.c:BIT_reloadDStream:
  413|   475k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|   475k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|   475k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 3.03k, False: 472k]
  |  |  ------------------
  ------------------
  416|  3.03k|        static const BitContainerType zeroFilled = 0;
  417|  3.03k|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|  3.03k|        return BIT_DStream_overflow;
  420|  3.03k|    }
  421|       |
  422|   472k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|   472k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|   472k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 21.2k, False: 451k]
  ------------------
  425|  21.2k|        return BIT_reloadDStream_internal(bitD);
  426|  21.2k|    }
  427|   451k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 410k, False: 40.8k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|   410k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 388k, False: 21.5k]
  ------------------
  430|  21.5k|        return BIT_DStream_completed;
  431|   410k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  40.8k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  40.8k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  40.8k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 216, False: 40.6k]
  ------------------
  436|    216|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    216|            result = BIT_DStream_endOfBuffer;
  438|    216|        }
  439|  40.8k|        bitD->ptr -= nbBytes;
  440|  40.8k|        bitD->bitsConsumed -= nbBytes*8;
  441|  40.8k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  40.8k|        return result;
  443|   451k|    }
  444|   451k|}
fse_decompress.c:BIT_reloadDStream_internal:
  385|  21.2k|{
  386|  21.2k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  21.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  21.2k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  21.2k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  21.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  21.2k|    bitD->bitsConsumed &= 7;
  390|  21.2k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  21.2k|    return BIT_DStream_unfinished;
  392|  21.2k|}
fse_decompress.c:BIT_readBitsFast:
  372|    788|{
  373|    788|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|    788|    assert(nbBits >= 1);
  ------------------
  |  |   70|    788|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|    788|    BIT_skipBits(bitD, nbBits);
  376|    788|    return value;
  377|    788|}
fse_decompress.c:BIT_lookBitsFast:
  347|    788|{
  348|    788|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|    788|    assert(nbBits >= 1);
  ------------------
  |  |   70|    788|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|    788|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|    788|}
fse_compress.c:BIT_initCStream:
  152|  9.47k|{
  153|  9.47k|    bitC->bitContainer = 0;
  154|  9.47k|    bitC->bitPos = 0;
  155|  9.47k|    bitC->startPtr = (char*)startPtr;
  156|  9.47k|    bitC->ptr = bitC->startPtr;
  157|  9.47k|    bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer);
  158|  9.47k|    if (dstCapacity <= sizeof(bitC->bitContainer)) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   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 (158:9): [True: 7, False: 9.46k]
  ------------------
  159|  9.46k|    return 0;
  160|  9.47k|}
fse_compress.c:BIT_addBits:
  182|  1.80M|{
  183|  1.80M|    DEBUG_STATIC_ASSERT(BIT_MASK_SIZE == 32);
  ------------------
  |  |   39|  1.80M|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  184|  1.80M|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  1.80M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  185|  1.80M|    assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  1.80M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  186|  1.80M|    bitC->bitContainer |= BIT_getLowerBits(value, nbBits) << bitC->bitPos;
  187|  1.80M|    bitC->bitPos += nbBits;
  188|  1.80M|}
fse_compress.c:BIT_getLowerBits:
  163|  1.80M|{
  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.80M|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  1.80M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  173|  1.80M|    return bitContainer & BIT_mask[nbBits];
  174|  1.80M|#endif
  175|  1.80M|}
fse_compress.c:BIT_flushBitsFast:
  206|   245k|{
  207|   245k|    size_t const nbBytes = bitC->bitPos >> 3;
  208|   245k|    assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|   245k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  209|   245k|    assert(bitC->ptr <= bitC->endPtr);
  ------------------
  |  |   70|   245k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  210|   245k|    MEM_writeLEST(bitC->ptr, bitC->bitContainer);
  211|   245k|    bitC->ptr += nbBytes;
  212|   245k|    bitC->bitPos &= 7;
  213|   245k|    bitC->bitContainer >>= nbBytes*8;
  214|   245k|}
fse_compress.c:BIT_flushBits:
  222|   235k|{
  223|   235k|    size_t const nbBytes = bitC->bitPos >> 3;
  224|   235k|    assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|   235k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  225|   235k|    assert(bitC->ptr <= bitC->endPtr);
  ------------------
  |  |   70|   235k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  226|   235k|    MEM_writeLEST(bitC->ptr, bitC->bitContainer);
  227|   235k|    bitC->ptr += nbBytes;
  228|   235k|    if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr;
  ------------------
  |  Branch (228:9): [True: 80, False: 235k]
  ------------------
  229|   235k|    bitC->bitPos &= 7;
  230|   235k|    bitC->bitContainer >>= nbBytes*8;
  231|   235k|}
fse_compress.c:BIT_closeCStream:
  237|  9.46k|{
  238|  9.46k|    BIT_addBitsFast(bitC, 1, 1);   /* endMark */
  239|  9.46k|    BIT_flushBits(bitC);
  240|  9.46k|    if (bitC->ptr >= bitC->endPtr) return 0; /* overflow detected */
  ------------------
  |  Branch (240:9): [True: 7, False: 9.46k]
  ------------------
  241|  9.46k|    return (size_t)(bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0);
  242|  9.46k|}
fse_compress.c:BIT_addBitsFast:
  195|  9.46k|{
  196|  9.46k|    assert((value>>nbBits) == 0);
  ------------------
  |  |   70|  9.46k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  197|  9.46k|    assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
  ------------------
  |  |   70|  9.46k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  198|  9.46k|    bitC->bitContainer |= value << bitC->bitPos;
  199|  9.46k|    bitC->bitPos += nbBits;
  200|  9.46k|}
huf_decompress.c:BIT_initDStream:
  255|  3.55k|{
  256|  3.55k|    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: 3.55k]
  ------------------
  257|       |
  258|  3.55k|    bitD->start = (const char*)srcBuffer;
  259|  3.55k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  3.55k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 3.52k, False: 34]
  ------------------
  262|  3.52k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  3.52k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  3.52k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  3.52k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 3.52k, False: 0]
  ------------------
  266|  3.52k|          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: 3.52k]
  ------------------
  267|  3.52k|    } else {
  268|     34|        bitD->ptr   = bitD->start;
  269|     34|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|     34|        switch(srcSize)
  271|     34|        {
  272|     14|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 14, False: 20]
  ------------------
  273|     14|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     14|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     26|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 12, False: 22]
  ------------------
  276|     26|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     26|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     28|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 2, False: 32]
  ------------------
  279|     28|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     28|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     32|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 4, False: 30]
  ------------------
  282|     32|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     32|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     34|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 2, False: 32]
  ------------------
  285|     34|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     34|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|     34|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 0, False: 34]
  ------------------
  288|     34|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|     34|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|     34|        default: break;
  ------------------
  |  Branch (290:9): [True: 0, False: 34]
  ------------------
  291|     34|        }
  292|     34|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|     34|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 34, False: 0]
  ------------------
  294|     34|            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: 34]
  ------------------
  295|     34|        }
  296|     34|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|     34|    }
  298|       |
  299|  3.55k|    return srcSize;
  300|  3.55k|}
huf_decompress.c:BIT_reloadDStream:
  413|  79.1k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  79.1k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  188|  79.1k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 79.1k]
  |  |  ------------------
  ------------------
  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|  79.1k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  79.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  79.1k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 62.1k, False: 17.0k]
  ------------------
  425|  62.1k|        return BIT_reloadDStream_internal(bitD);
  426|  62.1k|    }
  427|  17.0k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 2.22k, False: 14.8k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  2.22k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 2.22k, False: 0]
  ------------------
  430|      0|        return BIT_DStream_completed;
  431|  2.22k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  14.8k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  14.8k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  14.8k|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (435:13): [True: 1.32k, False: 13.5k]
  ------------------
  436|  1.32k|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|  1.32k|            result = BIT_DStream_endOfBuffer;
  438|  1.32k|        }
  439|  14.8k|        bitD->ptr -= nbBytes;
  440|  14.8k|        bitD->bitsConsumed -= nbBytes*8;
  441|  14.8k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  14.8k|        return result;
  443|  17.0k|    }
  444|  17.0k|}
huf_decompress.c:BIT_reloadDStream_internal:
  385|  62.1k|{
  386|  62.1k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  62.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  62.1k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  62.1k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  62.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  62.1k|    bitD->bitsConsumed &= 7;
  390|  62.1k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  62.1k|    return BIT_DStream_unfinished;
  392|  62.1k|}
huf_decompress.c:BIT_lookBitsFast:
  347|   360k|{
  348|   360k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|   360k|    assert(nbBits >= 1);
  ------------------
  |  |   70|   360k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|   360k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|   360k|}
huf_decompress.c:BIT_skipBits:
  354|   360k|{
  355|   360k|    bitD->bitsConsumed += nbBits;
  356|   360k|}
huf_decompress.c:BIT_endOfDStream:
  450|  3.55k|{
  451|  3.55k|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 3.55k, False: 0]
  |  Branch (451:49): [True: 3.55k, False: 0]
  ------------------
  452|  3.55k|}

zstd_decompress_block.c:ZSTD_maybeNullPtrAdd:
  386|  9.98k|{
  387|  9.98k|    return add > 0 ? ptr + add : ptr;
  ------------------
  |  Branch (387:12): [True: 9.98k, False: 0]
  ------------------
  388|  9.98k|}
huf_decompress.c:ZSTD_maybeNullPtrAdd:
  386|  3.55k|{
  387|  3.55k|    return add > 0 ? ptr + add : ptr;
  ------------------
  |  Branch (387:12): [True: 3.55k, False: 0]
  ------------------
  388|  3.55k|}

zstd_compress.c:ZSTD_cpuid_bmi1:
  147|     38|  MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) {                 \
  148|     38|    return ((cpuid.r) & (1U << bit)) != 0;                                     \
  149|     38|  }
zstd_compress.c:ZSTD_cpuid_bmi2:
  147|     38|  MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) {                 \
  148|     38|    return ((cpuid.r) & (1U << bit)) != 0;                                     \
  149|     38|  }
zstd_compress.c:ZSTD_cpuid:
   32|     38|MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
   33|     38|    U32 f1c = 0;
   34|     38|    U32 f1d = 0;
   35|     38|    U32 f7b = 0;
   36|     38|    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|     38|    __asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx");
  124|     38|    if (n >= 1) {
  ------------------
  |  Branch (124:9): [True: 38, False: 0]
  ------------------
  125|     38|      U32 f1a;
  126|     38|      __asm__("cpuid" : "=a"(f1a), "=c"(f1c), "=d"(f1d) : "a"(1) : "ebx");
  127|     38|    }
  128|     38|    if (n >= 7) {
  ------------------
  |  Branch (128:9): [True: 38, False: 0]
  ------------------
  129|     38|      U32 f7a;
  130|     38|      __asm__("cpuid"
  131|     38|              : "=a"(f7a), "=b"(f7b), "=c"(f7c)
  132|     38|              : "a"(7), "c"(0)
  133|     38|              : "edx");
  134|     38|    }
  135|     38|#endif
  136|     38|    {
  137|     38|        ZSTD_cpuid_t cpuid;
  138|     38|        cpuid.f1c = f1c;
  139|     38|        cpuid.f1d = f1d;
  140|     38|        cpuid.f7b = f7b;
  141|     38|        cpuid.f7c = f7c;
  142|     38|        return cpuid;
  143|     38|    }
  144|     38|}
zstd_decompress.c:ZSTD_cpuid:
   32|     61|MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
   33|     61|    U32 f1c = 0;
   34|     61|    U32 f1d = 0;
   35|     61|    U32 f7b = 0;
   36|     61|    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|     61|    __asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx");
  124|     61|    if (n >= 1) {
  ------------------
  |  Branch (124:9): [True: 61, False: 0]
  ------------------
  125|     61|      U32 f1a;
  126|     61|      __asm__("cpuid" : "=a"(f1a), "=c"(f1c), "=d"(f1d) : "a"(1) : "ebx");
  127|     61|    }
  128|     61|    if (n >= 7) {
  ------------------
  |  Branch (128:9): [True: 61, False: 0]
  ------------------
  129|     61|      U32 f7a;
  130|     61|      __asm__("cpuid"
  131|     61|              : "=a"(f7a), "=b"(f7b), "=c"(f7c)
  132|     61|              : "a"(7), "c"(0)
  133|     61|              : "edx");
  134|     61|    }
  135|     61|#endif
  136|     61|    {
  137|     61|        ZSTD_cpuid_t cpuid;
  138|     61|        cpuid.f1c = f1c;
  139|     61|        cpuid.f1d = f1d;
  140|     61|        cpuid.f7b = f7b;
  141|     61|        cpuid.f7c = f7c;
  142|     61|        return cpuid;
  143|     61|    }
  144|     61|}
zstd_decompress.c:ZSTD_cpuid_bmi1:
  147|     61|  MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) {                 \
  148|     61|    return ((cpuid.r) & (1U << bit)) != 0;                                     \
  149|     61|  }
zstd_decompress.c:ZSTD_cpuid_bmi2:
  147|     61|  MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) {                 \
  148|     61|    return ((cpuid.r) & (1U << bit)) != 0;                                     \
  149|     61|  }

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

zstd_common.c:ERR_isError:
   52|  15.0k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  15.0k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  15.0k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  15.0k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_common.c:ERR_getErrorCode:
   54|  5.00k|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.99k, False: 10]
  ------------------
zstd_compress.c:ERR_isError:
   52|   134k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|   134k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|   134k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|   134k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_compress_literals.c:ERR_isError:
   52|  2.25k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  2.25k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  2.25k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  2.25k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_compress_sequences.c:ERR_isError:
   52|  22.0k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  22.0k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  22.0k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  22.0k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress.c:ERR_isError:
   52|  40.0k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  40.0k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  40.0k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  40.0k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress_block.c:ERR_isError:
   52|  55.0k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  55.0k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  55.0k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  55.0k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v05.c:ERR_isError:
   52|     44|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|     44|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     44|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     44|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v06.c:ERR_isError:
   52|     60|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|     60|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     60|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     60|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_v07.c:ERR_isError:
   52|     46|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
entropy_common.c:ERR_isError:
   52|  3.05k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  3.05k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  3.05k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  3.05k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
fse_decompress.c:ERR_isError:
   52|  9.10k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  9.10k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  9.10k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  9.10k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
fse_compress.c:ERR_isError:
   52|  9.52k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  9.52k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  9.52k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  9.52k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
huf_compress.c:ERR_isError:
   52|  78.6k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  78.6k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  78.6k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  78.6k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
huf_decompress.c:ERR_isError:
   52|  10.6k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  10.6k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  10.6k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  10.6k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------

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

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

zstd_compress.c:MEM_64bits:
  138|  14.8k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_compress.c:MEM_32bits:
  137|  17.1k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_compress.c:MEM_writeLE32:
  330|  4.97k|{
  331|  4.97k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (331:9): [True: 4.97k, False: 0]
  ------------------
  332|  4.97k|        MEM_write32(memPtr, val32);
  333|      0|    else
  334|      0|        MEM_write32(memPtr, MEM_swap32(val32));
  335|  4.97k|}
zstd_compress.c:MEM_isLittleEndian:
  141|  8.12k|{
  142|  8.12k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  8.12k|    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|  8.12k|}
zstd_compress.c:MEM_write32:
  188|  4.97k|MEM_STATIC void MEM_write32(void* memPtr, U32 value) { *(unalign32*)memPtr = value; }
zstd_compress.c:MEM_writeLE24:
  316|  3.15k|{
  317|  3.15k|    MEM_writeLE16(memPtr, (U16)val);
  318|  3.15k|    ((BYTE*)memPtr)[2] = (BYTE)(val>>16);
  319|  3.15k|}
zstd_compress.c:MEM_writeLE16:
  300|  3.15k|{
  301|  3.15k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (301:9): [True: 3.15k, False: 0]
  ------------------
  302|  3.15k|        MEM_write16(memPtr, val);
  303|  3.15k|    } else {
  304|      0|        BYTE* p = (BYTE*)memPtr;
  305|      0|        p[0] = (BYTE)val;
  306|      0|        p[1] = (BYTE)(val>>8);
  307|      0|    }
  308|  3.15k|}
zstd_compress.c:MEM_write16:
  187|  3.15k|MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(unalign16*)memPtr = value; }
zstd_compress_literals.c:MEM_writeLE16:
  300|  3.18k|{
  301|  3.18k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (301:9): [True: 3.18k, False: 0]
  ------------------
  302|  3.18k|        MEM_write16(memPtr, val);
  303|  3.18k|    } else {
  304|      0|        BYTE* p = (BYTE*)memPtr;
  305|      0|        p[0] = (BYTE)val;
  306|      0|        p[1] = (BYTE)(val>>8);
  307|      0|    }
  308|  3.18k|}
zstd_compress_literals.c:MEM_isLittleEndian:
  141|  3.18k|{
  142|  3.18k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  3.18k|    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|  3.18k|}
zstd_compress_literals.c:MEM_write16:
  187|  3.18k|MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(unalign16*)memPtr = value; }
zstd_compress_literals.c:MEM_writeLE24:
  316|  2.25k|{
  317|  2.25k|    MEM_writeLE16(memPtr, (U16)val);
  318|  2.25k|    ((BYTE*)memPtr)[2] = (BYTE)(val>>16);
  319|  2.25k|}
zstd_compress_sequences.c:MEM_read16:
  182|  9.27k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_compress_sequences.c:MEM_32bits:
  137|  88.1k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_compress_sequences.c:MEM_writeLEST:
  362|  28.7k|{
  363|  28.7k|    if (MEM_32bits())
  ------------------
  |  Branch (363:9): [True: 0, False: 28.7k]
  ------------------
  364|      0|        MEM_writeLE32(memPtr, (U32)val);
  365|  28.7k|    else
  366|  28.7k|        MEM_writeLE64(memPtr, (U64)val);
  367|  28.7k|}
zstd_compress_sequences.c:MEM_isLittleEndian:
  141|  28.7k|{
  142|  28.7k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  28.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|  28.7k|}
zstd_compress_sequences.c:MEM_writeLE64:
  346|  28.7k|{
  347|  28.7k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (347:9): [True: 28.7k, False: 0]
  ------------------
  348|  28.7k|        MEM_write64(memPtr, val64);
  349|      0|    else
  350|      0|        MEM_write64(memPtr, MEM_swap64(val64));
  351|  28.7k|}
zstd_compress_sequences.c:MEM_write64:
  189|  28.7k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
zstd_fast.c:MEM_isLittleEndian:
  141|  45.5k|{
  142|  45.5k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  45.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|  45.5k|}
zstd_fast.c:MEM_read32:
  183|   107k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_fast.c:MEM_readLE64:
  338|  43.2k|{
  339|  43.2k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 43.2k, False: 0]
  ------------------
  340|  43.2k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  43.2k|}
zstd_fast.c:MEM_read64:
  184|  43.2k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_fast.c:MEM_readST:
  185|  6.29k|MEM_STATIC size_t MEM_readST(const void* ptr) { return *(const unalignArch*)ptr; }
zstd_fast.c:MEM_64bits:
  138|  2.34k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_fast.c:MEM_read16:
  182|    208|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_lazy.c:MEM_readLE32:
  322|   369k|{
  323|   369k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 369k, False: 0]
  ------------------
  324|   369k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|   369k|}
zstd_lazy.c:MEM_isLittleEndian:
  141|   382k|{
  142|   382k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   382k|    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|   382k|}
zstd_lazy.c:MEM_read32:
  183|   842k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_lazy.c:MEM_readST:
  185|  32.7k|MEM_STATIC size_t MEM_readST(const void* ptr) { return *(const unalignArch*)ptr; }
zstd_lazy.c:MEM_64bits:
  138|  14.1k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_lazy.c:MEM_read16:
  182|  1.24k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_opt.c:MEM_readLE32:
  322|   919k|{
  323|   919k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 919k, False: 0]
  ------------------
  324|   919k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|   919k|}
zstd_opt.c:MEM_isLittleEndian:
  141|  3.34M|{
  142|  3.34M|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  3.34M|    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|  3.34M|}
zstd_opt.c:MEM_read32:
  183|  2.80M|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_opt.c:MEM_readST:
  185|  1.37M|MEM_STATIC size_t MEM_readST(const void* ptr) { return *(const unalignArch*)ptr; }
zstd_opt.c:MEM_64bits:
  138|   560k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_opt.c:MEM_read16:
  182|  13.9k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress.c:MEM_readLE32:
  322|  15.0k|{
  323|  15.0k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 15.0k, False: 0]
  ------------------
  324|  15.0k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  15.0k|}
zstd_decompress.c:MEM_isLittleEndian:
  141|  15.1k|{
  142|  15.1k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  15.1k|    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|  15.1k|}
zstd_decompress.c:MEM_read32:
  183|  15.0k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE16:
  290|      1|{
  291|      1|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 1, False: 0]
  ------------------
  292|      1|        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|      1|}
zstd_decompress.c:MEM_read16:
  182|      1|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress.c:MEM_readLE64:
  338|      1|{
  339|      1|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 1, False: 0]
  ------------------
  340|      1|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|      1|}
zstd_decompress.c:MEM_read64:
  184|      1|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_decompress_block.c:MEM_readLE24:
  311|  5.00k|{
  312|  5.00k|    return (U32)MEM_readLE16(memPtr) + ((U32)(((const BYTE*)memPtr)[2]) << 16);
  313|  5.00k|}
zstd_decompress_block.c:MEM_readLE32:
  322|  3.55k|{
  323|  3.55k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 3.55k, False: 0]
  ------------------
  324|  3.55k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  3.55k|}
zstd_decompress_block.c:MEM_isLittleEndian:
  141|  26.9k|{
  142|  26.9k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  26.9k|    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|  26.9k|}
zstd_decompress_block.c:MEM_read32:
  183|  3.55k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress_block.c:MEM_write64:
  189|  11.8k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
zstd_decompress_block.c:MEM_readLE16:
  290|  5.88k|{
  291|  5.88k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 5.88k, False: 0]
  ------------------
  292|  5.88k|        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.88k|}
zstd_decompress_block.c:MEM_read16:
  182|  5.88k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress_block.c:MEM_32bits:
  137|   123k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_decompress_block.c:MEM_64bits:
  138|  28.1k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_decompress_block.c:MEM_readLEST:
  354|  17.4k|{
  355|  17.4k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 17.4k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  17.4k|    else
  358|  17.4k|        return (size_t)MEM_readLE64(memPtr);
  359|  17.4k|}
zstd_decompress_block.c:MEM_readLE64:
  338|  17.4k|{
  339|  17.4k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 17.4k, False: 0]
  ------------------
  340|  17.4k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  17.4k|}
zstd_decompress_block.c:MEM_read64:
  184|  17.4k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_v05.c:MEM_readLE32:
  322|     14|{
  323|     14|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 14, False: 0]
  ------------------
  324|     14|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|     14|}
zstd_v05.c:MEM_isLittleEndian:
  141|     14|{
  142|     14|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|     14|    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|}
zstd_v05.c:MEM_read32:
  183|     14|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_v05.c:MEM_32bits:
  137|      4|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
entropy_common.c:MEM_readLE32:
  322|  22.4k|{
  323|  22.4k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 22.4k, False: 0]
  ------------------
  324|  22.4k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  22.4k|}
entropy_common.c:MEM_isLittleEndian:
  141|  22.4k|{
  142|  22.4k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  22.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|  22.4k|}
entropy_common.c:MEM_read32:
  183|  22.4k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
fse_decompress.c:MEM_write64:
  189|  24.1k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
fse_decompress.c:MEM_readLEST:
  354|  64.9k|{
  355|  64.9k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 64.9k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  64.9k|    else
  358|  64.9k|        return (size_t)MEM_readLE64(memPtr);
  359|  64.9k|}
fse_decompress.c:MEM_32bits:
  137|  64.9k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
fse_decompress.c:MEM_isLittleEndian:
  141|  64.9k|{
  142|  64.9k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  64.9k|    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|  64.9k|}
fse_decompress.c:MEM_readLE64:
  338|  64.9k|{
  339|  64.9k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 64.9k, False: 0]
  ------------------
  340|  64.9k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  64.9k|}
fse_decompress.c:MEM_read64:
  184|  64.9k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
fse_compress.c:MEM_write64:
  189|   566k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
fse_compress.c:MEM_read16:
  182|  18.9k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
fse_compress.c:MEM_writeLEST:
  362|   481k|{
  363|   481k|    if (MEM_32bits())
  ------------------
  |  Branch (363:9): [True: 0, False: 481k]
  ------------------
  364|      0|        MEM_writeLE32(memPtr, (U32)val);
  365|   481k|    else
  366|   481k|        MEM_writeLE64(memPtr, (U64)val);
  367|   481k|}
fse_compress.c:MEM_32bits:
  137|   481k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
fse_compress.c:MEM_isLittleEndian:
  141|   481k|{
  142|   481k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   481k|    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|   481k|}
fse_compress.c:MEM_writeLE64:
  346|   481k|{
  347|   481k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (347:9): [True: 481k, False: 0]
  ------------------
  348|   481k|        MEM_write64(memPtr, val64);
  349|      0|    else
  350|      0|        MEM_write64(memPtr, MEM_swap64(val64));
  351|   481k|}
huf_compress.c:MEM_writeLEST:
  362|  82.9k|{
  363|  82.9k|    if (MEM_32bits())
  ------------------
  |  Branch (363:9): [True: 0, False: 82.9k]
  ------------------
  364|      0|        MEM_writeLE32(memPtr, (U32)val);
  365|  82.9k|    else
  366|  82.9k|        MEM_writeLE64(memPtr, (U64)val);
  367|  82.9k|}
huf_compress.c:MEM_isLittleEndian:
  141|  82.9k|{
  142|  82.9k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  82.9k|    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|  82.9k|}
huf_compress.c:MEM_writeLE64:
  346|  82.9k|{
  347|  82.9k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (347:9): [True: 82.9k, False: 0]
  ------------------
  348|  82.9k|        MEM_write64(memPtr, val64);
  349|      0|    else
  350|      0|        MEM_write64(memPtr, MEM_swap64(val64));
  351|  82.9k|}
huf_compress.c:MEM_write64:
  189|  82.9k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
huf_compress.c:MEM_32bits:
  137|  86.7k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
huf_decompress.c:MEM_isLittleEndian:
  141|   148k|{
  142|   148k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   148k|    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|   148k|}
huf_decompress.c:MEM_write64:
  189|  1.81M|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
huf_decompress.c:MEM_readLEST:
  354|  80.4k|{
  355|  80.4k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 80.4k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  80.4k|    else
  358|  80.4k|        return (size_t)MEM_readLE64(memPtr);
  359|  80.4k|}
huf_decompress.c:MEM_32bits:
  137|  84.0k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
huf_decompress.c:MEM_readLE64:
  338|  80.4k|{
  339|  80.4k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 80.4k, False: 0]
  ------------------
  340|  80.4k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  80.4k|}
huf_decompress.c:MEM_read64:
  184|  80.4k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_64bits:
  138|   226k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }

ZSTD_XXH64_reset:
 3561|  5.00k|{
 3562|  5.00k|    XXH_ASSERT(statePtr != NULL);
  ------------------
  |  | 2430|  5.00k|#    define XXH_ASSERT(c)   XXH_ASSUME(c)
  |  |  ------------------
  |  |  |  | 2707|  5.00k|#  define XXH_ASSUME(c) __builtin_assume(c)
  |  |  ------------------
  ------------------
 3563|  5.00k|    memset(statePtr, 0, sizeof(*statePtr));
 3564|  5.00k|    statePtr->v[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2;
  ------------------
  |  | 3361|  5.00k|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
                  statePtr->v[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2;
  ------------------
  |  | 3362|  5.00k|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3565|  5.00k|    statePtr->v[1] = seed + XXH_PRIME64_2;
  ------------------
  |  | 3362|  5.00k|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3566|  5.00k|    statePtr->v[2] = seed + 0;
 3567|  5.00k|    statePtr->v[3] = seed - XXH_PRIME64_1;
  ------------------
  |  | 3361|  5.00k|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
 3568|  5.00k|    return XXH_OK;
 3569|  5.00k|}
ZSTD_XXH64_update:
 3574|      2|{
 3575|      2|    if (input==NULL) {
  ------------------
  |  Branch (3575:9): [True: 0, False: 2]
  ------------------
 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|      2|    {   const xxh_u8* p = (const xxh_u8*)input;
 3581|      2|        const xxh_u8* const bEnd = p + len;
 3582|       |
 3583|      2|        state->total_len += len;
 3584|       |
 3585|      2|        if (state->memsize + len < 32) {  /* fill in tmp buffer */
  ------------------
  |  Branch (3585:13): [True: 0, False: 2]
  ------------------
 3586|      0|            XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, len);
 3587|      0|            state->memsize += (xxh_u32)len;
 3588|      0|            return XXH_OK;
 3589|      0|        }
 3590|       |
 3591|      2|        if (state->memsize) {   /* tmp buffer is full */
  ------------------
  |  Branch (3591:13): [True: 0, False: 2]
  ------------------
 3592|      0|            XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize);
 3593|      0|            state->v[0] = XXH64_round(state->v[0], XXH_readLE64(state->mem64+0));
 3594|      0|            state->v[1] = XXH64_round(state->v[1], XXH_readLE64(state->mem64+1));
 3595|      0|            state->v[2] = XXH64_round(state->v[2], XXH_readLE64(state->mem64+2));
 3596|      0|            state->v[3] = XXH64_round(state->v[3], XXH_readLE64(state->mem64+3));
 3597|      0|            p += 32 - state->memsize;
 3598|      0|            state->memsize = 0;
 3599|      0|        }
 3600|       |
 3601|      2|        if (p+32 <= bEnd) {
  ------------------
  |  Branch (3601:13): [True: 2, False: 0]
  ------------------
 3602|      2|            const xxh_u8* const limit = bEnd - 32;
 3603|       |
 3604|  27.7k|            do {
 3605|  27.7k|                state->v[0] = XXH64_round(state->v[0], XXH_readLE64(p)); p+=8;
 3606|  27.7k|                state->v[1] = XXH64_round(state->v[1], XXH_readLE64(p)); p+=8;
 3607|  27.7k|                state->v[2] = XXH64_round(state->v[2], XXH_readLE64(p)); p+=8;
 3608|  27.7k|                state->v[3] = XXH64_round(state->v[3], XXH_readLE64(p)); p+=8;
 3609|  27.7k|            } while (p<=limit);
  ------------------
  |  Branch (3609:22): [True: 27.7k, False: 2]
  ------------------
 3610|       |
 3611|      2|        }
 3612|       |
 3613|      2|        if (p < bEnd) {
  ------------------
  |  Branch (3613:13): [True: 2, False: 0]
  ------------------
 3614|      2|            XXH_memcpy(state->mem64, p, (size_t)(bEnd-p));
 3615|      2|            state->memsize = (unsigned)(bEnd-p);
 3616|      2|        }
 3617|      2|    }
 3618|       |
 3619|      0|    return XXH_OK;
 3620|      2|}
xxhash.c:XXH_memcpy:
 2359|      2|{
 2360|      2|    return memcpy(dest,src,size);
 2361|      2|}
xxhash.c:XXH64_round:
 3377|   111k|{
 3378|   111k|    acc += input * XXH_PRIME64_2;
  ------------------
  |  | 3362|   111k|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3379|   111k|    acc  = XXH_rotl64(acc, 31);
  ------------------
  |  | 2728|   111k|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
 3380|   111k|    acc *= XXH_PRIME64_1;
  ------------------
  |  | 3361|   111k|#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|   111k|    return acc;
 3399|   111k|}
xxhash.c:XXH_readLE64:
 3331|   111k|{
 3332|   111k|    return XXH_CPU_LITTLE_ENDIAN ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr));
  ------------------
  |  | 2629|   111k|#    define XXH_CPU_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (2629:35): [True: 111k, Folded]
  |  |  ------------------
  ------------------
 3333|   111k|}
xxhash.c:XXH_read64:
 3261|   111k|{
 3262|   111k|    typedef __attribute__((aligned(1))) xxh_u64 xxh_unalign64;
 3263|   111k|    return *((const xxh_unalign64*)ptr);
 3264|   111k|}

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

zstd_compress.c:ZSTD_cpuSupportsBmi2:
  319|     38|{
  320|     38|    ZSTD_cpuid_t cpuid = ZSTD_cpuid();
  321|     38|    return ZSTD_cpuid_bmi1(cpuid) && ZSTD_cpuid_bmi2(cpuid);
  ------------------
  |  Branch (321:12): [True: 38, False: 0]
  |  Branch (321:38): [True: 38, False: 0]
  ------------------
  322|     38|}
zstd_fast.c:ZSTD_copy16:
  183|  3.55k|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(__clang__)
  189|       |    ZSTD_memmove(dst, src, 16);
  190|       |#else
  191|       |    /* ZSTD_memmove is not inlined properly by gcc */
  192|       |    BYTE copy16_buf[16];
  193|       |    ZSTD_memcpy(copy16_buf, src, 16);
  194|       |    ZSTD_memcpy(dst, copy16_buf, 16);
  195|       |#endif
  196|  3.55k|}
zstd_fast.c:ZSTD_wildcopy:
  217|    929|{
  218|    929|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  219|    929|    const BYTE* ip = (const BYTE*)src;
  220|    929|    BYTE* op = (BYTE*)dst;
  221|    929|    BYTE* const oend = op + length;
  222|       |
  223|    929|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  200|      0|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (223:9): [True: 0, False: 929]
  |  Branch (223:50): [True: 0, False: 0]
  ------------------
  224|       |        /* Handle short offset copies. */
  225|      0|        do {
  226|      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]
  |  |  ------------------
  ------------------
  227|      0|        } while (op < oend);
  ------------------
  |  Branch (227:18): [True: 0, False: 0]
  ------------------
  228|    929|    } else {
  229|    929|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|    929|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  230|       |        /* Separate out the first COPY16() call because the copy length is
  231|       |         * almost certain to be short, so the branches have different
  232|       |         * probabilities. Since it is almost certain to be short, only do
  233|       |         * one COPY16() in the first call. Then, do two calls per loop since
  234|       |         * at that point it is more likely to have a high trip count.
  235|       |         */
  236|    929|        ZSTD_copy16(op, ip);
  237|    929|        if (16 >= length) return;
  ------------------
  |  Branch (237:13): [True: 599, False: 330]
  ------------------
  238|    330|        op += 16;
  239|    330|        ip += 16;
  240|    392|        do {
  241|    392|            COPY16(op, ip);
  ------------------
  |  |  197|    392|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 392]
  |  |  ------------------
  ------------------
  242|    392|            COPY16(op, ip);
  ------------------
  |  |  197|    392|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 392]
  |  |  ------------------
  ------------------
  243|    392|        }
  244|    392|        while (op < oend);
  ------------------
  |  Branch (244:16): [True: 62, False: 330]
  ------------------
  245|    330|    }
  246|    929|}
zstd_lazy.c:ZSTD_copy16:
  183|  11.0k|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(__clang__)
  189|       |    ZSTD_memmove(dst, src, 16);
  190|       |#else
  191|       |    /* ZSTD_memmove is not inlined properly by gcc */
  192|       |    BYTE copy16_buf[16];
  193|       |    ZSTD_memcpy(copy16_buf, src, 16);
  194|       |    ZSTD_memcpy(dst, copy16_buf, 16);
  195|       |#endif
  196|  11.0k|}
zstd_lazy.c:ZSTD_wildcopy:
  217|  2.53k|{
  218|  2.53k|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  219|  2.53k|    const BYTE* ip = (const BYTE*)src;
  220|  2.53k|    BYTE* op = (BYTE*)dst;
  221|  2.53k|    BYTE* const oend = op + length;
  222|       |
  223|  2.53k|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  200|      0|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (223:9): [True: 0, False: 2.53k]
  |  Branch (223:50): [True: 0, False: 0]
  ------------------
  224|       |        /* Handle short offset copies. */
  225|      0|        do {
  226|      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]
  |  |  ------------------
  ------------------
  227|      0|        } while (op < oend);
  ------------------
  |  Branch (227:18): [True: 0, False: 0]
  ------------------
  228|  2.53k|    } else {
  229|  2.53k|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|  2.53k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  230|       |        /* Separate out the first COPY16() call because the copy length is
  231|       |         * almost certain to be short, so the branches have different
  232|       |         * probabilities. Since it is almost certain to be short, only do
  233|       |         * one COPY16() in the first call. Then, do two calls per loop since
  234|       |         * at that point it is more likely to have a high trip count.
  235|       |         */
  236|  2.53k|        ZSTD_copy16(op, ip);
  237|  2.53k|        if (16 >= length) return;
  ------------------
  |  Branch (237:13): [True: 1.40k, False: 1.12k]
  ------------------
  238|  1.12k|        op += 16;
  239|  1.12k|        ip += 16;
  240|  1.85k|        do {
  241|  1.85k|            COPY16(op, ip);
  ------------------
  |  |  197|  1.85k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 1.85k]
  |  |  ------------------
  ------------------
  242|  1.85k|            COPY16(op, ip);
  ------------------
  |  |  197|  1.85k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 1.85k]
  |  |  ------------------
  ------------------
  243|  1.85k|        }
  244|  1.85k|        while (op < oend);
  ------------------
  |  Branch (244:16): [True: 724, False: 1.12k]
  ------------------
  245|  1.12k|    }
  246|  2.53k|}
zstd_opt.c:ZSTD_copy16:
  183|  15.0k|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(__clang__)
  189|       |    ZSTD_memmove(dst, src, 16);
  190|       |#else
  191|       |    /* ZSTD_memmove is not inlined properly by gcc */
  192|       |    BYTE copy16_buf[16];
  193|       |    ZSTD_memcpy(copy16_buf, src, 16);
  194|       |    ZSTD_memcpy(dst, copy16_buf, 16);
  195|       |#endif
  196|  15.0k|}
zstd_opt.c:ZSTD_wildcopy:
  217|  2.76k|{
  218|  2.76k|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  219|  2.76k|    const BYTE* ip = (const BYTE*)src;
  220|  2.76k|    BYTE* op = (BYTE*)dst;
  221|  2.76k|    BYTE* const oend = op + length;
  222|       |
  223|  2.76k|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  200|      0|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (223:9): [True: 0, False: 2.76k]
  |  Branch (223:50): [True: 0, False: 0]
  ------------------
  224|       |        /* Handle short offset copies. */
  225|      0|        do {
  226|      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]
  |  |  ------------------
  ------------------
  227|      0|        } while (op < oend);
  ------------------
  |  Branch (227:18): [True: 0, False: 0]
  ------------------
  228|  2.76k|    } else {
  229|  2.76k|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|  2.76k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  230|       |        /* Separate out the first COPY16() call because the copy length is
  231|       |         * almost certain to be short, so the branches have different
  232|       |         * probabilities. Since it is almost certain to be short, only do
  233|       |         * one COPY16() in the first call. Then, do two calls per loop since
  234|       |         * at that point it is more likely to have a high trip count.
  235|       |         */
  236|  2.76k|        ZSTD_copy16(op, ip);
  237|  2.76k|        if (16 >= length) return;
  ------------------
  |  Branch (237:13): [True: 1.79k, False: 971]
  ------------------
  238|    971|        op += 16;
  239|    971|        ip += 16;
  240|  1.41k|        do {
  241|  1.41k|            COPY16(op, ip);
  ------------------
  |  |  197|  1.41k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 1.41k]
  |  |  ------------------
  ------------------
  242|  1.41k|            COPY16(op, ip);
  ------------------
  |  |  197|  1.41k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 1.41k]
  |  |  ------------------
  ------------------
  243|  1.41k|        }
  244|  1.41k|        while (op < oend);
  ------------------
  |  Branch (244:16): [True: 445, False: 971]
  ------------------
  245|    971|    }
  246|  2.76k|}
zstd_decompress.c:ZSTD_cpuSupportsBmi2:
  319|     61|{
  320|     61|    ZSTD_cpuid_t cpuid = ZSTD_cpuid();
  321|     61|    return ZSTD_cpuid_bmi1(cpuid) && ZSTD_cpuid_bmi2(cpuid);
  ------------------
  |  Branch (321:12): [True: 61, False: 0]
  |  Branch (321:38): [True: 61, False: 0]
  ------------------
  322|     61|}
zstd_decompress_block.c:ZSTD_wildcopy:
  217|  15.5k|{
  218|  15.5k|    ptrdiff_t diff = (BYTE*)dst - (const BYTE*)src;
  219|  15.5k|    const BYTE* ip = (const BYTE*)src;
  220|  15.5k|    BYTE* op = (BYTE*)dst;
  221|  15.5k|    BYTE* const oend = op + length;
  222|       |
  223|  15.5k|    if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) {
  ------------------
  |  |  200|  3.30k|#define WILDCOPY_VECLEN 16
  ------------------
  |  Branch (223:9): [True: 3.30k, False: 12.2k]
  |  Branch (223:50): [True: 3.14k, False: 164]
  ------------------
  224|       |        /* Handle short offset copies. */
  225|  3.98k|        do {
  226|  3.98k|            COPY8(op, ip);
  ------------------
  |  |  177|  3.98k|#define COPY8(d,s) do { ZSTD_copy8(d,s); d+=8; s+=8; } while (0)
  |  |  ------------------
  |  |  |  Branch (177:63): [Folded, False: 3.98k]
  |  |  ------------------
  ------------------
  227|  3.98k|        } while (op < oend);
  ------------------
  |  Branch (227:18): [True: 838, False: 3.14k]
  ------------------
  228|  12.4k|    } else {
  229|  12.4k|        assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN);
  ------------------
  |  |   70|  12.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  230|       |        /* Separate out the first COPY16() call because the copy length is
  231|       |         * almost certain to be short, so the branches have different
  232|       |         * probabilities. Since it is almost certain to be short, only do
  233|       |         * one COPY16() in the first call. Then, do two calls per loop since
  234|       |         * at that point it is more likely to have a high trip count.
  235|       |         */
  236|  12.4k|        ZSTD_copy16(op, ip);
  237|  12.4k|        if (16 >= length) return;
  ------------------
  |  Branch (237:13): [True: 9.74k, False: 2.67k]
  ------------------
  238|  2.67k|        op += 16;
  239|  2.67k|        ip += 16;
  240|  3.43k|        do {
  241|  3.43k|            COPY16(op, ip);
  ------------------
  |  |  197|  3.43k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 3.43k]
  |  |  ------------------
  ------------------
  242|  3.43k|            COPY16(op, ip);
  ------------------
  |  |  197|  3.43k|#define COPY16(d,s) do { ZSTD_copy16(d,s); d+=16; s+=16; } while (0)
  |  |  ------------------
  |  |  |  Branch (197:67): [Folded, False: 3.43k]
  |  |  ------------------
  ------------------
  243|  3.43k|        }
  244|  3.43k|        while (op < oend);
  ------------------
  |  Branch (244:16): [True: 756, False: 2.67k]
  ------------------
  245|  2.67k|    }
  246|  15.5k|}
zstd_decompress_block.c:ZSTD_copy8:
  170|  7.30k|static void ZSTD_copy8(void* dst, const void* src) {
  171|       |#if defined(ZSTD_ARCH_ARM_NEON)
  172|       |    vst1_u8((uint8_t*)dst, vld1_u8((const uint8_t*)src));
  173|       |#else
  174|  7.30k|    ZSTD_memcpy(dst, src, 8);
  ------------------
  |  |   44|  7.30k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  175|  7.30k|#endif
  176|  7.30k|}
zstd_decompress_block.c:ZSTD_copy16:
  183|  36.0k|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(__clang__)
  189|       |    ZSTD_memmove(dst, src, 16);
  190|       |#else
  191|       |    /* ZSTD_memmove is not inlined properly by gcc */
  192|       |    BYTE copy16_buf[16];
  193|       |    ZSTD_memcpy(copy16_buf, src, 16);
  194|       |    ZSTD_memcpy(dst, copy16_buf, 16);
  195|       |#endif
  196|  36.0k|}

FSE_buildCTable_wksp:
   71|  18.9k|{
   72|  18.9k|    U32 const tableSize = 1 << tableLog;
   73|  18.9k|    U32 const tableMask = tableSize - 1;
   74|  18.9k|    void* const ptr = ct;
   75|  18.9k|    U16* const tableU16 = ( (U16*) ptr) + 2;
   76|  18.9k|    void* const FSCT = ((U32*)ptr) + 1 /* header */ + (tableLog ? tableSize>>1 : 1) ;
  ------------------
  |  Branch (76:56): [True: 18.9k, False: 0]
  ------------------
   77|  18.9k|    FSE_symbolCompressionTransform* const symbolTT = (FSE_symbolCompressionTransform*) (FSCT);
   78|  18.9k|    U32 const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|  18.9k|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
   79|  18.9k|    U32 const maxSV1 = maxSymbolValue+1;
   80|       |
   81|  18.9k|    U16* cumul = (U16*)workSpace;   /* size = maxSV1 */
   82|  18.9k|    FSE_FUNCTION_TYPE* const tableSymbol = (FSE_FUNCTION_TYPE*)(cumul + (maxSV1+1));  /* size = tableSize */
  ------------------
  |  |  601|  18.9k|#define FSE_FUNCTION_TYPE BYTE
  ------------------
   83|       |
   84|  18.9k|    U32 highThreshold = tableSize-1;
   85|       |
   86|  18.9k|    assert(((size_t)workSpace & 1) == 0);  /* Must be 2 bytes-aligned */
  ------------------
  |  |   70|  18.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   87|  18.9k|    if (FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |  264|  18.9k|#define FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) (sizeof(unsigned) * FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog))
  |  |  ------------------
  |  |  |  |  263|  18.9k|#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: 18.9k]
  ------------------
   88|       |    /* CTable header */
   89|  18.9k|    tableU16[-2] = (U16) tableLog;
   90|  18.9k|    tableU16[-1] = (U16) maxSymbolValue;
   91|  18.9k|    assert(tableLog < 16);   /* required for threshold strategy to work */
  ------------------
  |  |   70|  18.9k|#    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|  18.9k|    {   U32 u;
  102|  18.9k|        cumul[0] = 0;
  103|   423k|        for (u=1; u <= maxSV1; u++) {
  ------------------
  |  Branch (103:19): [True: 404k, False: 18.9k]
  ------------------
  104|   404k|            if (normalizedCounter[u-1]==-1) {  /* Low proba symbol */
  ------------------
  |  Branch (104:17): [True: 46.0k, False: 358k]
  ------------------
  105|  46.0k|                cumul[u] = cumul[u-1] + 1;
  106|  46.0k|                tableSymbol[highThreshold--] = (FSE_FUNCTION_TYPE)(u-1);
  107|   358k|            } else {
  108|   358k|                assert(normalizedCounter[u-1] >= 0);
  ------------------
  |  |   70|   358k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  109|   358k|                cumul[u] = cumul[u-1] + (U16)normalizedCounter[u-1];
  110|   358k|                assert(cumul[u] >= cumul[u-1]);  /* no overflow */
  ------------------
  |  |   70|   358k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  111|   358k|        }   }
  112|  18.9k|        cumul[maxSV1] = (U16)(tableSize+1);
  113|  18.9k|    }
  114|       |
  115|       |    /* Spread symbols */
  116|  18.9k|    if (highThreshold == tableSize - 1) {
  ------------------
  |  Branch (116:9): [True: 10.3k, False: 8.67k]
  ------------------
  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|  10.3k|        BYTE* const spread = tableSymbol + tableSize; /* size = tableSize + 8 (may write beyond tableSize) */
  121|  10.3k|        {   U64 const add = 0x0101010101010101ull;
  122|  10.3k|            size_t pos = 0;
  123|  10.3k|            U64 sv = 0;
  124|  10.3k|            U32 s;
  125|  67.6k|            for (s=0; s<maxSV1; ++s, sv += add) {
  ------------------
  |  Branch (125:23): [True: 57.3k, False: 10.3k]
  ------------------
  126|  57.3k|                int i;
  127|  57.3k|                int const n = normalizedCounter[s];
  128|  57.3k|                MEM_write64(spread + pos, sv);
  129|  84.6k|                for (i = 8; i < n; i += 8) {
  ------------------
  |  Branch (129:29): [True: 27.3k, False: 57.3k]
  ------------------
  130|  27.3k|                    MEM_write64(spread + pos + i, sv);
  131|  27.3k|                }
  132|  57.3k|                assert(n>=0);
  ------------------
  |  |   70|  57.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  133|  57.3k|                pos += (size_t)n;
  134|  57.3k|            }
  135|  10.3k|        }
  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|  10.3k|        {   size_t position = 0;
  141|  10.3k|            size_t s;
  142|  10.3k|            size_t const unroll = 2; /* Experimentally determined optimal unroll */
  143|  10.3k|            assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
  ------------------
  |  |   70|  10.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  144|   175k|            for (s = 0; s < (size_t)tableSize; s += unroll) {
  ------------------
  |  Branch (144:25): [True: 164k, False: 10.3k]
  ------------------
  145|   164k|                size_t u;
  146|   494k|                for (u = 0; u < unroll; ++u) {
  ------------------
  |  Branch (146:29): [True: 329k, False: 164k]
  ------------------
  147|   329k|                    size_t const uPosition = (position + (u * step)) & tableMask;
  148|   329k|                    tableSymbol[uPosition] = spread[s + u];
  149|   329k|                }
  150|   164k|                position = (position + (unroll * step)) & tableMask;
  151|   164k|            }
  152|  10.3k|            assert(position == 0);   /* Must have initialized all positions */
  ------------------
  |  |   70|  10.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  153|  10.3k|        }
  154|  10.3k|    } else {
  155|  8.67k|        U32 position = 0;
  156|  8.67k|        U32 symbol;
  157|   355k|        for (symbol=0; symbol<maxSV1; symbol++) {
  ------------------
  |  Branch (157:24): [True: 346k, False: 8.67k]
  ------------------
  158|   346k|            int nbOccurrences;
  159|   346k|            int const freq = normalizedCounter[symbol];
  160|   780k|            for (nbOccurrences=0; nbOccurrences<freq; nbOccurrences++) {
  ------------------
  |  Branch (160:35): [True: 433k, False: 346k]
  ------------------
  161|   433k|                tableSymbol[position] = (FSE_FUNCTION_TYPE)symbol;
  162|   433k|                position = (position + step) & tableMask;
  163|   480k|                while (position > highThreshold)
  ------------------
  |  Branch (163:24): [True: 46.0k, False: 433k]
  ------------------
  164|  46.0k|                    position = (position + step) & tableMask;   /* Low proba area */
  165|   433k|        }   }
  166|  8.67k|        assert(position==0);  /* Must have initialized all positions */
  ------------------
  |  |   70|  8.67k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  167|  8.67k|    }
  168|       |
  169|       |    /* Build table */
  170|   828k|    {   U32 u; for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (170:26): [True: 809k, False: 18.9k]
  ------------------
  171|   809k|        FSE_FUNCTION_TYPE s = tableSymbol[u];   /* note : static analyzer may not understand tableSymbol is properly initialized */
  ------------------
  |  |  601|   809k|#define FSE_FUNCTION_TYPE BYTE
  ------------------
  172|   809k|        tableU16[cumul[s]++] = (U16) (tableSize+u);   /* TableU16 : sorted by symbol order; gives next state value */
  173|   809k|    }   }
  174|       |
  175|       |    /* Build Symbol Transformation Table */
  176|  18.9k|    {   unsigned total = 0;
  177|  18.9k|        unsigned s;
  178|   423k|        for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (178:19): [True: 404k, False: 18.9k]
  ------------------
  179|   404k|            switch (normalizedCounter[s])
  180|   404k|            {
  181|  9.45k|            case  0:
  ------------------
  |  Branch (181:13): [True: 9.45k, False: 394k]
  ------------------
  182|       |                /* filling nonetheless, for compatibility with FSE_getMaxNbBits() */
  183|  9.45k|                symbolTT[s].deltaNbBits = ((tableLog+1) << 16) - (1<<tableLog);
  184|  9.45k|                break;
  185|       |
  186|  46.0k|            case -1:
  ------------------
  |  Branch (186:13): [True: 46.0k, False: 358k]
  ------------------
  187|   259k|            case  1:
  ------------------
  |  Branch (187:13): [True: 213k, False: 190k]
  ------------------
  188|   259k|                symbolTT[s].deltaNbBits = (tableLog << 16) - (1<<tableLog);
  189|   259k|                assert(total <= INT_MAX);
  ------------------
  |  |   70|   259k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  190|   259k|                symbolTT[s].deltaFindState = (int)(total - 1);
  191|   259k|                total ++;
  192|   259k|                break;
  193|   135k|            default :
  ------------------
  |  Branch (193:13): [True: 135k, False: 268k]
  ------------------
  194|   135k|                assert(normalizedCounter[s] > 1);
  ------------------
  |  |   70|   135k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  195|   135k|                {   U32 const maxBitsOut = tableLog - ZSTD_highbit32 ((U32)normalizedCounter[s]-1);
  196|   135k|                    U32 const minStatePlus = (U32)normalizedCounter[s] << maxBitsOut;
  197|   135k|                    symbolTT[s].deltaNbBits = (maxBitsOut << 16) - minStatePlus;
  198|   135k|                    symbolTT[s].deltaFindState = (int)(total - (unsigned)normalizedCounter[s]);
  199|   135k|                    total +=  (unsigned)normalizedCounter[s];
  200|   135k|    }   }   }   }
  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|  18.9k|    return 0;
  214|  18.9k|}
FSE_NCountWriteBound:
  224|  17.1k|{
  225|  17.1k|    size_t const maxHeaderSize = (((maxSymbolValue+1) * tableLog
  226|  17.1k|                                   + 4 /* bitCount initialized at 4 */
  227|  17.1k|                                   + 2 /* first two symbols may use one additional bit each */) / 8)
  228|  17.1k|                                   + 1 /* round up to whole nb bytes */
  229|  17.1k|                                   + 2 /* additional two bytes for bitstream flush */;
  230|  17.1k|    return maxSymbolValue ? maxHeaderSize : FSE_NCOUNTBOUND;  /* maxSymbolValue==0 ? use default */
  ------------------
  |  |  235|      0|#define FSE_NCOUNTBOUND 512
  ------------------
  |  Branch (230:12): [True: 17.1k, False: 0]
  ------------------
  231|  17.1k|}
FSE_writeNCount:
  332|  17.1k|{
  333|  17.1k|    if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);   /* Unsupported */
  ------------------
  |  |  612|  17.1k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  17.1k|#  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: 17.1k]
  ------------------
  334|  17.1k|    if (tableLog < FSE_MIN_TABLELOG) return ERROR(GENERIC);   /* Unsupported */
  ------------------
  |  |  616|  17.1k|#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: 17.1k]
  ------------------
  335|       |
  336|  17.1k|    if (bufferSize < FSE_NCountWriteBound(maxSymbolValue, tableLog))
  ------------------
  |  Branch (336:9): [True: 32, False: 17.1k]
  ------------------
  337|     32|        return FSE_writeNCount_generic(buffer, bufferSize, normalizedCounter, maxSymbolValue, tableLog, 0);
  338|       |
  339|  17.1k|    return FSE_writeNCount_generic(buffer, bufferSize, normalizedCounter, maxSymbolValue, tableLog, 1 /* write in buffer is safe */);
  340|  17.1k|}
FSE_optimalTableLog_internal:
  358|  18.9k|{
  359|  18.9k|    U32 maxBitsSrc = ZSTD_highbit32((U32)(srcSize - 1)) - minus;
  360|  18.9k|    U32 tableLog = maxTableLog;
  361|  18.9k|    U32 minBits = FSE_minTableLog(srcSize, maxSymbolValue);
  362|  18.9k|    assert(srcSize > 1); /* Not supported, RLE should be used instead */
  ------------------
  |  |   70|  18.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  363|  18.9k|    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: 18.9k]
  ------------------
  364|  18.9k|    if (maxBitsSrc < tableLog) tableLog = maxBitsSrc;   /* Accuracy can be reduced */
  ------------------
  |  Branch (364:9): [True: 16.3k, False: 2.54k]
  ------------------
  365|  18.9k|    if (minBits > tableLog) tableLog = minBits;   /* Need a minimum to safely represent all symbol values */
  ------------------
  |  Branch (365:9): [True: 8.39k, False: 10.5k]
  ------------------
  366|  18.9k|    if (tableLog < FSE_MIN_TABLELOG) tableLog = FSE_MIN_TABLELOG;
  ------------------
  |  |  616|  18.9k|#define FSE_MIN_TABLELOG 5
  ------------------
                  if (tableLog < FSE_MIN_TABLELOG) tableLog = FSE_MIN_TABLELOG;
  ------------------
  |  |  616|  7.18k|#define FSE_MIN_TABLELOG 5
  ------------------
  |  Branch (366:9): [True: 7.18k, False: 11.7k]
  ------------------
  367|  18.9k|    if (tableLog > FSE_MAX_TABLELOG) tableLog = FSE_MAX_TABLELOG;
  ------------------
  |  |  612|  18.9k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  18.9k|#  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: 18.9k]
  ------------------
  368|  18.9k|    return tableLog;
  369|  18.9k|}
FSE_optimalTableLog:
  372|  17.1k|{
  373|  17.1k|    return FSE_optimalTableLog_internal(maxTableLog, srcSize, maxSymbolValue, 2);
  374|  17.1k|}
FSE_normalizeCount:
  468|  17.1k|{
  469|       |    /* Sanity checks */
  470|  17.1k|    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: 17.1k]
  ------------------
  471|  17.1k|    if (tableLog < FSE_MIN_TABLELOG) return ERROR(GENERIC);   /* Unsupported size */
  ------------------
  |  |  616|  17.1k|#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: 17.1k]
  ------------------
  472|  17.1k|    if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);   /* Unsupported size */
  ------------------
  |  |  612|  17.1k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  17.1k|#  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: 17.1k]
  ------------------
  473|  17.1k|    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: 17.1k]
  ------------------
  474|       |
  475|  17.1k|    {   static U32 const rtbTable[] = {     0, 473195, 504333, 520860, 550000, 700000, 750000, 830000 };
  476|  17.1k|        short const lowProbCount = useLowProbCount ? -1 : 1;
  ------------------
  |  Branch (476:36): [True: 0, False: 17.1k]
  ------------------
  477|  17.1k|        U64 const scale = 62 - tableLog;
  478|  17.1k|        U64 const step = ZSTD_div64((U64)1<<62, (U32)total);   /* <== here, one division ! */
  ------------------
  |  |   82|  17.1k|#define ZSTD_div64(dividend, divisor) ((dividend) / (divisor))
  ------------------
  479|  17.1k|        U64 const vStep = 1ULL<<(scale-20);
  480|  17.1k|        int stillToDistribute = 1<<tableLog;
  481|  17.1k|        unsigned s;
  482|  17.1k|        unsigned largest=0;
  483|  17.1k|        short largestP=0;
  484|  17.1k|        U32 lowThreshold = (U32)(total >> tableLog);
  485|       |
  486|   162k|        for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (486:19): [True: 145k, False: 17.1k]
  ------------------
  487|   145k|            if (count[s] == total) return 0;   /* rle special case */
  ------------------
  |  Branch (487:17): [True: 0, False: 145k]
  ------------------
  488|   145k|            if (count[s] == 0) { normalizedCounter[s]=0; continue; }
  ------------------
  |  Branch (488:17): [True: 72.9k, False: 72.8k]
  ------------------
  489|  72.8k|            if (count[s] <= lowThreshold) {
  ------------------
  |  Branch (489:17): [True: 19.7k, False: 53.0k]
  ------------------
  490|  19.7k|                normalizedCounter[s] = lowProbCount;
  491|  19.7k|                stillToDistribute--;
  492|  53.0k|            } else {
  493|  53.0k|                short proba = (short)((count[s]*step) >> scale);
  494|  53.0k|                if (proba<8) {
  ------------------
  |  Branch (494:21): [True: 30.5k, False: 22.5k]
  ------------------
  495|  30.5k|                    U64 restToBeat = vStep * rtbTable[proba];
  496|  30.5k|                    proba += (count[s]*step) - ((U64)proba<<scale) > restToBeat;
  497|  30.5k|                }
  498|  53.0k|                if (proba > largestP) { largestP=proba; largest=s; }
  ------------------
  |  Branch (498:21): [True: 20.3k, False: 32.7k]
  ------------------
  499|  53.0k|                normalizedCounter[s] = proba;
  500|  53.0k|                stillToDistribute -= proba;
  501|  53.0k|        }   }
  502|  17.1k|        if (-stillToDistribute >= (normalizedCounter[largest] >> 1)) {
  ------------------
  |  Branch (502:13): [True: 50, False: 17.1k]
  ------------------
  503|       |            /* corner case, need another normalization method */
  504|     50|            size_t const errorCode = FSE_normalizeM2(normalizedCounter, tableLog, count, total, maxSymbolValue, lowProbCount);
  505|     50|            if (FSE_isError(errorCode)) return errorCode;
  ------------------
  |  |   35|     50|#define FSE_isError ERR_isError
  ------------------
  |  Branch (505:17): [True: 0, False: 50]
  ------------------
  506|     50|        }
  507|  17.1k|        else normalizedCounter[largest] += (short)stillToDistribute;
  508|  17.1k|    }
  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|  17.1k|    return tableLog;
  525|  17.1k|}
FSE_buildCTable_rle:
  529|    613|{
  530|    613|    void* ptr = ct;
  531|    613|    U16* tableU16 = ( (U16*) ptr) + 2;
  532|    613|    void* FSCTptr = (U32*)ptr + 2;
  533|    613|    FSE_symbolCompressionTransform* symbolTT = (FSE_symbolCompressionTransform*) FSCTptr;
  534|       |
  535|       |    /* header */
  536|    613|    tableU16[-2] = (U16) 0;
  537|    613|    tableU16[-1] = (U16) symbolValue;
  538|       |
  539|       |    /* Build table */
  540|    613|    tableU16[0] = 0;
  541|    613|    tableU16[1] = 0;   /* just in case */
  542|       |
  543|       |    /* Build Symbol Transformation Table */
  544|    613|    symbolTT[symbolValue].deltaNbBits = 0;
  545|    613|    symbolTT[symbolValue].deltaFindState = 0;
  546|       |
  547|    613|    return 0;
  548|    613|}
FSE_compress_usingCTable:
  613|  9.47k|{
  614|  9.47k|    unsigned const fast = (dstSize >= FSE_BLOCKBOUND(srcSize));
  ------------------
  |  |  236|  9.47k|#define FSE_BLOCKBOUND(size) ((size) + ((size)>>7) + 4 /* fse states */ + sizeof(size_t) /* bitContainer */)
  ------------------
  615|       |
  616|  9.47k|    if (fast)
  ------------------
  |  Branch (616:9): [True: 5.98k, False: 3.48k]
  ------------------
  617|  5.98k|        return FSE_compress_usingCTable_generic(dst, dstSize, src, srcSize, ct, 1);
  618|  3.48k|    else
  619|  3.48k|        return FSE_compress_usingCTable_generic(dst, dstSize, src, srcSize, ct, 0);
  620|  9.47k|}
fse_compress.c:FSE_writeNCount_generic:
  237|  17.1k|{
  238|  17.1k|    BYTE* const ostart = (BYTE*) header;
  239|  17.1k|    BYTE* out = ostart;
  240|  17.1k|    BYTE* const oend = ostart + headerBufferSize;
  241|  17.1k|    int nbBits;
  242|  17.1k|    const int tableSize = 1 << tableLog;
  243|  17.1k|    int remaining;
  244|  17.1k|    int threshold;
  245|  17.1k|    U32 bitStream = 0;
  246|  17.1k|    int bitCount = 0;
  247|  17.1k|    unsigned symbol = 0;
  248|  17.1k|    unsigned const alphabetSize = maxSymbolValue + 1;
  249|  17.1k|    int previousIs0 = 0;
  250|       |
  251|       |    /* Table Size */
  252|  17.1k|    bitStream += (tableLog-FSE_MIN_TABLELOG) << bitCount;
  ------------------
  |  |  616|  17.1k|#define FSE_MIN_TABLELOG 5
  ------------------
  253|  17.1k|    bitCount  += 4;
  254|       |
  255|       |    /* Init */
  256|  17.1k|    remaining = tableSize+1;   /* +1 for extra accuracy */
  257|  17.1k|    threshold = tableSize;
  258|  17.1k|    nbBits = (int)tableLog+1;
  259|       |
  260|   109k|    while ((symbol < alphabetSize) && (remaining>1)) {  /* stops at 1 */
  ------------------
  |  Branch (260:12): [True: 92.6k, False: 17.1k]
  |  Branch (260:39): [True: 92.6k, False: 0]
  ------------------
  261|  92.6k|        if (previousIs0) {
  ------------------
  |  Branch (261:13): [True: 19.8k, False: 72.8k]
  ------------------
  262|  19.8k|            unsigned start = symbol;
  263|  72.9k|            while ((symbol < alphabetSize) && !normalizedCounter[symbol]) symbol++;
  ------------------
  |  Branch (263:20): [True: 72.9k, False: 0]
  |  Branch (263:47): [True: 53.1k, False: 19.8k]
  ------------------
  264|  19.8k|            if (symbol == alphabetSize) break;   /* incorrect distribution */
  ------------------
  |  Branch (264:17): [True: 0, False: 19.8k]
  ------------------
  265|  19.9k|            while (symbol >= start+24) {
  ------------------
  |  Branch (265:20): [True: 198, False: 19.7k]
  ------------------
  266|    198|                start+=24;
  267|    198|                bitStream += 0xFFFFU << bitCount;
  268|    198|                if ((!writeIsSafe) && (out > oend-2))
  ------------------
  |  Branch (268:21): [True: 18, False: 180]
  |  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|    189|                out[0] = (BYTE) bitStream;
  271|    189|                out[1] = (BYTE)(bitStream>>8);
  272|    189|                out+=2;
  273|    189|                bitStream>>=16;
  274|    189|            }
  275|  31.3k|            while (symbol >= start+3) {
  ------------------
  |  Branch (275:20): [True: 11.5k, False: 19.7k]
  ------------------
  276|  11.5k|                start+=3;
  277|  11.5k|                bitStream += 3U << bitCount;
  278|  11.5k|                bitCount += 2;
  279|  11.5k|            }
  280|  19.7k|            bitStream += (symbol-start) << bitCount;
  281|  19.7k|            bitCount += 2;
  282|  19.7k|            if (bitCount>16) {
  ------------------
  |  Branch (282:17): [True: 4.42k, False: 15.3k]
  ------------------
  283|  4.42k|                if ((!writeIsSafe) && (out > oend - 2))
  ------------------
  |  Branch (283:21): [True: 0, False: 4.42k]
  |  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|  4.42k|                out[0] = (BYTE)bitStream;
  286|  4.42k|                out[1] = (BYTE)(bitStream>>8);
  287|  4.42k|                out += 2;
  288|  4.42k|                bitStream >>= 16;
  289|  4.42k|                bitCount -= 16;
  290|  4.42k|        }   }
  291|  92.6k|        {   int count = normalizedCounter[symbol++];
  292|  92.6k|            int const max = (2*threshold-1) - remaining;
  293|  92.6k|            remaining -= count < 0 ? -count : count;
  ------------------
  |  Branch (293:26): [True: 0, False: 92.6k]
  ------------------
  294|  92.6k|            count++;   /* +1 for extra accuracy */
  295|  92.6k|            if (count>=threshold)
  ------------------
  |  Branch (295:17): [True: 28.2k, False: 64.3k]
  ------------------
  296|  28.2k|                count += max;   /* [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ */
  297|  92.6k|            bitStream += (U32)count << bitCount;
  298|  92.6k|            bitCount  += nbBits;
  299|  92.6k|            bitCount  -= (count<max);
  300|  92.6k|            previousIs0  = (count==1);
  301|  92.6k|            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: 92.6k]
  ------------------
  302|   187k|            while (remaining<threshold) { nbBits--; threshold>>=1; }
  ------------------
  |  Branch (302:20): [True: 95.1k, False: 92.6k]
  ------------------
  303|  92.6k|        }
  304|  92.6k|        if (bitCount>16) {
  ------------------
  |  Branch (304:13): [True: 18.5k, False: 74.0k]
  ------------------
  305|  18.5k|            if ((!writeIsSafe) && (out > oend - 2))
  ------------------
  |  Branch (305:17): [True: 31, False: 18.5k]
  |  Branch (305:35): [True: 0, False: 31]
  ------------------
  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|  18.5k|            out[0] = (BYTE)bitStream;
  308|  18.5k|            out[1] = (BYTE)(bitStream>>8);
  309|  18.5k|            out += 2;
  310|  18.5k|            bitStream >>= 16;
  311|  18.5k|            bitCount -= 16;
  312|  18.5k|    }   }
  313|       |
  314|  17.1k|    if (remaining != 1)
  ------------------
  |  Branch (314:9): [True: 0, False: 17.1k]
  ------------------
  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|  17.1k|    assert(symbol <= alphabetSize);
  ------------------
  |  |   70|  17.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  317|       |
  318|       |    /* flush remaining bitStream */
  319|  17.1k|    if ((!writeIsSafe) && (out > oend - 2))
  ------------------
  |  Branch (319:9): [True: 23, False: 17.1k]
  |  Branch (319:27): [True: 2, False: 21]
  ------------------
  320|      2|        return ERROR(dstSize_tooSmall);   /* Buffer overflow */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  321|  17.1k|    out[0] = (BYTE)bitStream;
  322|  17.1k|    out[1] = (BYTE)(bitStream>>8);
  323|  17.1k|    out+= (bitCount+7) /8;
  324|       |
  325|  17.1k|    assert(out >= ostart);
  ------------------
  |  |   70|  17.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  326|  17.1k|    return (size_t)(out-ostart);
  327|  17.1k|}
fse_compress.c:FSE_minTableLog:
  349|  36.1k|{
  350|  36.1k|    U32 minBitsSrc = ZSTD_highbit32((U32)(srcSize)) + 1;
  351|  36.1k|    U32 minBitsSymbols = ZSTD_highbit32(maxSymbolValue) + 2;
  352|  36.1k|    U32 minBits = minBitsSrc < minBitsSymbols ? minBitsSrc : minBitsSymbols;
  ------------------
  |  Branch (352:19): [True: 13.8k, False: 22.3k]
  ------------------
  353|  36.1k|    assert(srcSize > 1); /* Not supported, RLE should be used instead */
  ------------------
  |  |   70|  36.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  354|  36.1k|    return minBits;
  355|  36.1k|}
fse_compress.c:FSE_normalizeM2:
  380|     50|{
  381|     50|    short const NOT_YET_ASSIGNED = -2;
  382|     50|    U32 s;
  383|     50|    U32 distributed = 0;
  384|     50|    U32 ToDistribute;
  385|       |
  386|       |    /* Init */
  387|     50|    U32 const lowThreshold = (U32)(total >> tableLog);
  388|     50|    U32 lowOne = (U32)((total * 3) >> (tableLog + 1));
  389|       |
  390|  1.03k|    for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (390:15): [True: 987, False: 50]
  ------------------
  391|    987|        if (count[s] == 0) {
  ------------------
  |  Branch (391:13): [True: 630, False: 357]
  ------------------
  392|    630|            norm[s]=0;
  393|    630|            continue;
  394|    630|        }
  395|    357|        if (count[s] <= lowThreshold) {
  ------------------
  |  Branch (395:13): [True: 0, False: 357]
  ------------------
  396|      0|            norm[s] = lowProbCount;
  397|      0|            distributed++;
  398|      0|            total -= count[s];
  399|      0|            continue;
  400|      0|        }
  401|    357|        if (count[s] <= lowOne) {
  ------------------
  |  Branch (401:13): [True: 0, False: 357]
  ------------------
  402|      0|            norm[s] = 1;
  403|      0|            distributed++;
  404|      0|            total -= count[s];
  405|      0|            continue;
  406|      0|        }
  407|       |
  408|    357|        norm[s]=NOT_YET_ASSIGNED;
  409|    357|    }
  410|     50|    ToDistribute = (1 << tableLog) - distributed;
  411|       |
  412|     50|    if (ToDistribute == 0)
  ------------------
  |  Branch (412:9): [True: 0, False: 50]
  ------------------
  413|      0|        return 0;
  414|       |
  415|     50|    if ((total / ToDistribute) > lowOne) {
  ------------------
  |  Branch (415:9): [True: 0, False: 50]
  ------------------
  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|     50|    if (distributed == maxSymbolValue+1) {
  ------------------
  |  Branch (428:9): [True: 0, False: 50]
  ------------------
  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|     50|    if (total == 0) {
  ------------------
  |  Branch (439:9): [True: 0, False: 50]
  ------------------
  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|     50|    {   U64 const vStepLog = 62 - tableLog;
  447|     50|        U64 const mid = (1ULL << (vStepLog-1)) - 1;
  448|     50|        U64 const rStep = ZSTD_div64((((U64)1<<vStepLog) * ToDistribute) + mid, (U32)total);   /* scale on remaining */
  ------------------
  |  |   82|     50|#define ZSTD_div64(dividend, divisor) ((dividend) / (divisor))
  ------------------
  449|     50|        U64 tmpTotal = mid;
  450|  1.03k|        for (s=0; s<=maxSymbolValue; s++) {
  ------------------
  |  Branch (450:19): [True: 987, False: 50]
  ------------------
  451|    987|            if (norm[s]==NOT_YET_ASSIGNED) {
  ------------------
  |  Branch (451:17): [True: 357, False: 630]
  ------------------
  452|    357|                U64 const end = tmpTotal + (count[s] * rStep);
  453|    357|                U32 const sStart = (U32)(tmpTotal >> vStepLog);
  454|    357|                U32 const sEnd = (U32)(end >> vStepLog);
  455|    357|                U32 const weight = sEnd - sStart;
  456|    357|                if (weight < 1)
  ------------------
  |  Branch (456:21): [True: 0, False: 357]
  ------------------
  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|    357|                norm[s] = (short)weight;
  459|    357|                tmpTotal = end;
  460|    357|    }   }   }
  461|       |
  462|     50|    return 0;
  463|     50|}
fse_compress.c:FSE_compress_usingCTable_generic:
  554|  9.47k|{
  555|  9.47k|    const BYTE* const istart = (const BYTE*) src;
  556|  9.47k|    const BYTE* const iend = istart + srcSize;
  557|  9.47k|    const BYTE* ip=iend;
  558|       |
  559|  9.47k|    BIT_CStream_t bitC;
  560|  9.47k|    FSE_CState_t CState1, CState2;
  561|       |
  562|       |    /* init */
  563|  9.47k|    if (srcSize <= 2) return 0;
  ------------------
  |  Branch (563:9): [True: 0, False: 9.47k]
  ------------------
  564|  9.47k|    { size_t const initError = BIT_initCStream(&bitC, dst, dstSize);
  565|  9.47k|      if (FSE_isError(initError)) return 0; /* not enough space available to write a bitstream */ }
  ------------------
  |  |   35|  9.47k|#define FSE_isError ERR_isError
  ------------------
  |  Branch (565:11): [True: 7, False: 9.46k]
  ------------------
  566|       |
  567|  9.46k|#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
  568|       |
  569|  9.46k|    if (srcSize & 1) {
  ------------------
  |  Branch (569:9): [True: 5.85k, False: 3.61k]
  ------------------
  570|  5.85k|        FSE_initCState2(&CState1, ct, *--ip);
  571|  5.85k|        FSE_initCState2(&CState2, ct, *--ip);
  572|  5.85k|        FSE_encodeSymbol(&bitC, &CState1, *--ip);
  573|  5.85k|        FSE_FLUSHBITS(&bitC);
  ------------------
  |  |  567|  5.85k|#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
  |  |  ------------------
  |  |  |  Branch (567:28): [True: 3.16k, False: 2.69k]
  |  |  ------------------
  ------------------
  574|  5.85k|    } else {
  575|  3.61k|        FSE_initCState2(&CState2, ct, *--ip);
  576|  3.61k|        FSE_initCState2(&CState1, ct, *--ip);
  577|  3.61k|    }
  578|       |
  579|       |    /* join to mod 4 */
  580|  9.46k|    srcSize -= 2;
  581|  9.46k|    if ((sizeof(bitC.bitContainer)*8 > FSE_MAX_TABLELOG*4+7 ) && (srcSize & 2)) {  /* test bit 2 */
  ------------------
  |  |  612|  9.46k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|  9.46k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (581:9): [True: 9.46k, Folded]
  |  Branch (581:66): [True: 3.66k, False: 5.80k]
  ------------------
  582|  3.66k|        FSE_encodeSymbol(&bitC, &CState2, *--ip);
  583|  3.66k|        FSE_encodeSymbol(&bitC, &CState1, *--ip);
  584|  3.66k|        FSE_FLUSHBITS(&bitC);
  ------------------
  |  |  567|  3.66k|#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
  |  |  ------------------
  |  |  |  Branch (567:28): [True: 2.86k, False: 799]
  |  |  ------------------
  ------------------
  585|  3.66k|    }
  586|       |
  587|       |    /* 2 or 4 encoding per loop */
  588|   452k|    while ( ip>istart ) {
  ------------------
  |  Branch (588:13): [True: 443k, False: 9.46k]
  ------------------
  589|       |
  590|   443k|        FSE_encodeSymbol(&bitC, &CState2, *--ip);
  591|       |
  592|   443k|        if (sizeof(bitC.bitContainer)*8 < FSE_MAX_TABLELOG*2+7 )   /* this test must be static */
  ------------------
  |  |  612|   443k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|   443k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (592:13): [Folded, False: 443k]
  ------------------
  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|   443k|        FSE_encodeSymbol(&bitC, &CState1, *--ip);
  596|       |
  597|   443k|        if (sizeof(bitC.bitContainer)*8 > FSE_MAX_TABLELOG*4+7 ) {  /* this test must be static */
  ------------------
  |  |  612|   443k|#define FSE_MAX_TABLELOG  (FSE_MAX_MEMORY_USAGE-2)
  |  |  ------------------
  |  |  |  |  582|   443k|#  define FSE_MAX_MEMORY_USAGE 14
  |  |  ------------------
  ------------------
  |  Branch (597:13): [True: 443k, Folded]
  ------------------
  598|   443k|            FSE_encodeSymbol(&bitC, &CState2, *--ip);
  599|   443k|            FSE_encodeSymbol(&bitC, &CState1, *--ip);
  600|   443k|        }
  601|       |
  602|   443k|        FSE_FLUSHBITS(&bitC);
  ------------------
  |  |  567|   443k|#define FSE_FLUSHBITS(s)  (fast ? BIT_flushBitsFast(s) : BIT_flushBits(s))
  |  |  ------------------
  |  |  |  Branch (567:28): [True: 239k, False: 203k]
  |  |  ------------------
  ------------------
  603|   443k|    }
  604|       |
  605|  9.46k|    FSE_flushCState(&bitC, &CState2);
  606|  9.46k|    FSE_flushCState(&bitC, &CState1);
  607|  9.46k|    return BIT_closeCStream(&bitC);
  608|  9.47k|}

HIST_count_simple:
   41|  26.0k|{
   42|  26.0k|    const BYTE* ip = (const BYTE*)src;
   43|  26.0k|    const BYTE* const end = ip + srcSize;
   44|  26.0k|    unsigned maxSymbolValue = *maxSymbolValuePtr;
   45|  26.0k|    unsigned largestCount=0;
   46|       |
   47|  26.0k|    ZSTD_memset(count, 0, (maxSymbolValue+1) * sizeof(*count));
  ------------------
  |  |   46|  26.0k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
   48|  26.0k|    if (srcSize==0) { *maxSymbolValuePtr = 0; return 0; }
  ------------------
  |  Branch (48:9): [True: 0, False: 26.0k]
  ------------------
   49|       |
   50|  2.58M|    while (ip<end) {
  ------------------
  |  Branch (50:12): [True: 2.55M, False: 26.0k]
  ------------------
   51|  2.55M|        assert(*ip <= maxSymbolValue);
  ------------------
  |  |   70|  2.55M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   52|  2.55M|        count[*ip++]++;
   53|  2.55M|    }
   54|       |
   55|   714k|    while (!count[maxSymbolValue]) maxSymbolValue--;
  ------------------
  |  Branch (55:12): [True: 688k, False: 26.0k]
  ------------------
   56|  26.0k|    *maxSymbolValuePtr = maxSymbolValue;
   57|       |
   58|  26.0k|    {   U32 s;
   59|  1.52M|        for (s=0; s<=maxSymbolValue; s++)
  ------------------
  |  Branch (59:19): [True: 1.49M, False: 26.0k]
  ------------------
   60|  1.49M|            if (count[s] > largestCount) largestCount = count[s];
  ------------------
  |  Branch (60:17): [True: 35.1k, False: 1.45M]
  ------------------
   61|  26.0k|    }
   62|       |
   63|  26.0k|    return largestCount;
   64|  26.0k|}
HIST_countFast_wksp:
  153|  14.1k|{
  154|  14.1k|    if (sourceSize < 1500) /* heuristic threshold */
  ------------------
  |  Branch (154:9): [True: 14.1k, False: 0]
  ------------------
  155|  14.1k|        return HIST_count_simple(count, maxSymbolValuePtr, source, sourceSize);
  156|      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 (156:9): [True: 0, False: 0]
  ------------------
  157|      0|    if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall);
  ------------------
  |  |   39|      0|#define HIST_WKSP_SIZE    (HIST_WKSP_SIZE_U32 * sizeof(unsigned))
  |  |  ------------------
  |  |  |  |   38|      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 (157:9): [True: 0, False: 0]
  ------------------
  158|      0|    return HIST_count_parallel_wksp(count, maxSymbolValuePtr, source, sourceSize, trustInput, (U32*)workSpace);
  159|      0|}
HIST_count_wksp:
  167|  3.97k|{
  168|  3.97k|    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 (168:9): [True: 0, False: 3.97k]
  ------------------
  169|  3.97k|    if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall);
  ------------------
  |  |   39|  3.97k|#define HIST_WKSP_SIZE    (HIST_WKSP_SIZE_U32 * sizeof(unsigned))
  |  |  ------------------
  |  |  |  |   38|  3.97k|#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 (169:9): [True: 0, False: 3.97k]
  ------------------
  170|  3.97k|    if (*maxSymbolValuePtr < 255)
  ------------------
  |  Branch (170:9): [True: 0, False: 3.97k]
  ------------------
  171|      0|        return HIST_count_parallel_wksp(count, maxSymbolValuePtr, source, sourceSize, checkMaxSymbolValue, (U32*)workSpace);
  172|  3.97k|    *maxSymbolValuePtr = 255;
  173|  3.97k|    return HIST_countFast_wksp(count, maxSymbolValuePtr, source, sourceSize, workSpace, workSpaceSize);
  174|  3.97k|}

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

ZSTD_createCCtx:
   98|     38|{
   99|     38|    return ZSTD_createCCtx_advanced(ZSTD_defaultCMem);
  100|     38|}
ZSTD_createCCtx_advanced:
  115|     38|{
  116|     38|    ZSTD_STATIC_ASSERT(zcss_init==0);
  ------------------
  |  |   43|     38|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|     38|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  117|     38|    ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN==(0ULL - 1));
  ------------------
  |  |   43|     38|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|     38|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  118|     38|    if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL;
  ------------------
  |  Branch (118:9): [True: 0, False: 38]
  ------------------
  119|     38|    {   ZSTD_CCtx* const cctx = (ZSTD_CCtx*)ZSTD_customMalloc(sizeof(ZSTD_CCtx), customMem);
  120|     38|        if (!cctx) return NULL;
  ------------------
  |  Branch (120:13): [True: 0, False: 38]
  ------------------
  121|     38|        ZSTD_initCCtx(cctx, customMem);
  122|     38|        return cctx;
  123|     38|    }
  124|     38|}
ZSTD_freeCCtx:
  182|     38|{
  183|     38|    DEBUGLOG(3, "ZSTD_freeCCtx (address: %p)", (void*)cctx);
  ------------------
  |  |  104|     38|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 38]
  |  |  ------------------
  ------------------
  184|     38|    if (cctx==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (184:9): [True: 0, False: 38]
  ------------------
  185|     38|    RETURN_ERROR_IF(cctx->staticSize, memory_allocation,
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
  186|     38|                    "not compatible with static CCtx");
  187|     38|    {   int cctxInWorkspace = ZSTD_cwksp_owns_buffer(&cctx->workspace, cctx);
  188|     38|        ZSTD_freeCCtxContent(cctx);
  189|     38|        if (!cctxInWorkspace) ZSTD_customFree(cctx, cctx->customMem);
  ------------------
  |  Branch (189:13): [True: 38, False: 0]
  ------------------
  190|     38|    }
  191|     38|    return 0;
  192|     38|}
ZSTD_sizeof_CCtx:
  207|  2.98k|{
  208|  2.98k|    if (cctx==NULL) return 0;   /* support sizeof on NULL */
  ------------------
  |  Branch (208:9): [True: 0, False: 2.98k]
  ------------------
  209|       |    /* cctx may be in the workspace */
  210|  2.98k|    return (cctx->workspace.workspace == cctx ? 0 : sizeof(*cctx))
  ------------------
  |  Branch (210:13): [True: 0, False: 2.98k]
  ------------------
  211|  2.98k|           + ZSTD_cwksp_sizeof(&cctx->workspace)
  212|  2.98k|           + ZSTD_sizeof_localDict(cctx->localDict)
  213|  2.98k|           + ZSTD_sizeof_mtctx(cctx);
  214|  2.98k|}
ZSTD_CCtxParams_reset:
  354|     38|{
  355|     38|    return ZSTD_CCtxParams_init(params, ZSTD_CLEVEL_DEFAULT);
  ------------------
  |  |  134|     38|#  define ZSTD_CLEVEL_DEFAULT 3
  ------------------
  356|     38|}
ZSTD_CCtxParams_init:
  358|     38|size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel) {
  359|     38|    RETURN_ERROR_IF(!cctxParams, GENERIC, "NULL pointer!");
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
  360|     38|    ZSTD_memset(cctxParams, 0, sizeof(*cctxParams));
  ------------------
  |  |   46|     38|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  361|     38|    cctxParams->compressionLevel = compressionLevel;
  362|     38|    cctxParams->fParams.contentSizeFlag = 1;
  363|     38|    return 0;
  364|     38|}
ZSTD_CCtx_reset:
 1368|     38|{
 1369|     38|    if ( (reset == ZSTD_reset_session_only)
  ------------------
  |  Branch (1369:10): [True: 0, False: 38]
  ------------------
 1370|     38|      || (reset == ZSTD_reset_session_and_parameters) ) {
  ------------------
  |  Branch (1370:10): [True: 0, False: 38]
  ------------------
 1371|      0|        cctx->streamStage = zcss_init;
 1372|      0|        cctx->pledgedSrcSizePlusOne = 0;
 1373|      0|    }
 1374|     38|    if ( (reset == ZSTD_reset_parameters)
  ------------------
  |  Branch (1374:10): [True: 38, False: 0]
  ------------------
 1375|     38|      || (reset == ZSTD_reset_session_and_parameters) ) {
  ------------------
  |  Branch (1375:10): [True: 0, False: 0]
  ------------------
 1376|     38|        RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong,
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
 1377|     38|                        "Reset parameters is only possible during init stage.");
 1378|     38|        ZSTD_clearAllDicts(cctx);
 1379|     38|        return ZSTD_CCtxParams_reset(&cctx->requestedParams);
 1380|     38|    }
 1381|      0|    return 0;
 1382|     38|}
ZSTD_cycleLog:
 1426|  9.97k|{
 1427|  9.97k|    U32 const btScale = ((U32)strat >= (U32)ZSTD_btlazy2);
 1428|  9.97k|    return hashLog - btScale;
 1429|  9.97k|}
ZSTD_reset_compressedBlockState:
 1919|  5.00k|{
 1920|  5.00k|    int i;
 1921|  20.0k|    for (i = 0; i < ZSTD_REP_NUM; ++i)
  ------------------
  |  |   64|  20.0k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1921:17): [True: 15.0k, False: 5.00k]
  ------------------
 1922|  15.0k|        bs->rep[i] = repStartValue[i];
 1923|  5.00k|    bs->entropy.huf.repeatMode = HUF_repeat_none;
 1924|  5.00k|    bs->entropy.fse.offcode_repeatMode = FSE_repeat_none;
 1925|  5.00k|    bs->entropy.fse.matchlength_repeatMode = FSE_repeat_none;
 1926|  5.00k|    bs->entropy.fse.litlength_repeatMode = FSE_repeat_none;
 1927|  5.00k|}
ZSTD_seqToCodes:
 2694|  3.37k|{
 2695|  3.37k|    const SeqDef* const sequences = seqStorePtr->sequencesStart;
 2696|  3.37k|    BYTE* const llCodeTable = seqStorePtr->llCode;
 2697|  3.37k|    BYTE* const ofCodeTable = seqStorePtr->ofCode;
 2698|  3.37k|    BYTE* const mlCodeTable = seqStorePtr->mlCode;
 2699|  3.37k|    U32 const nbSeq = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
 2700|  3.37k|    U32 u;
 2701|  3.37k|    int longOffsets = 0;
 2702|  3.37k|    assert(nbSeq <= seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  3.37k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2703|  20.5k|    for (u=0; u<nbSeq; u++) {
  ------------------
  |  Branch (2703:15): [True: 17.1k, False: 3.37k]
  ------------------
 2704|  17.1k|        U32 const llv = sequences[u].litLength;
 2705|  17.1k|        U32 const ofCode = ZSTD_highbit32(sequences[u].offBase);
 2706|  17.1k|        U32 const mlv = sequences[u].mlBase;
 2707|  17.1k|        llCodeTable[u] = (BYTE)ZSTD_LLcode(llv);
 2708|  17.1k|        ofCodeTable[u] = (BYTE)ofCode;
 2709|  17.1k|        mlCodeTable[u] = (BYTE)ZSTD_MLcode(mlv);
 2710|  17.1k|        assert(!(MEM_64bits() && ofCode >= STREAM_ACCUMULATOR_MIN));
  ------------------
  |  |   70|  17.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2711|  17.1k|        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 (2711:13): [True: 0, False: 17.1k]
  |  Branch (2711:29): [True: 0, False: 0]
  ------------------
 2712|      0|            longOffsets = 1;
 2713|  17.1k|    }
 2714|  3.37k|    if (seqStorePtr->longLengthType==ZSTD_llt_literalLength)
  ------------------
  |  Branch (2714:9): [True: 0, False: 3.37k]
  ------------------
 2715|      0|        llCodeTable[seqStorePtr->longLengthPos] = MaxLL;
  ------------------
  |  |  104|      0|#define MaxLL   35
  ------------------
 2716|  3.37k|    if (seqStorePtr->longLengthType==ZSTD_llt_matchLength)
  ------------------
  |  Branch (2716:9): [True: 0, False: 3.37k]
  ------------------
 2717|      0|        mlCodeTable[seqStorePtr->longLengthPos] = MaxML;
  ------------------
  |  |  103|      0|#define MaxML   52
  ------------------
 2718|  3.37k|    return longOffsets;
 2719|  3.37k|}
ZSTD_selectBlockCompressor:
 3070|  4.97k|{
 3071|  4.97k|    static const ZSTD_BlockCompressor_f blockCompressor[4][ZSTD_STRATEGY_MAX+1] = {
 3072|  4.97k|        { ZSTD_compressBlock_fast  /* default for 0 */,
 3073|  4.97k|          ZSTD_compressBlock_fast,
 3074|  4.97k|          ZSTD_COMPRESSBLOCK_DOUBLEFAST,
  ------------------
  |  |   33|  4.97k|#define ZSTD_COMPRESSBLOCK_DOUBLEFAST ZSTD_compressBlock_doubleFast
  ------------------
 3075|  4.97k|          ZSTD_COMPRESSBLOCK_GREEDY,
  ------------------
  |  |   64|  4.97k|#define ZSTD_COMPRESSBLOCK_GREEDY ZSTD_compressBlock_greedy
  ------------------
 3076|  4.97k|          ZSTD_COMPRESSBLOCK_LAZY,
  ------------------
  |  |  109|  4.97k|#define ZSTD_COMPRESSBLOCK_LAZY ZSTD_compressBlock_lazy
  ------------------
 3077|  4.97k|          ZSTD_COMPRESSBLOCK_LAZY2,
  ------------------
  |  |  154|  4.97k|#define ZSTD_COMPRESSBLOCK_LAZY2 ZSTD_compressBlock_lazy2
  ------------------
 3078|  4.97k|          ZSTD_COMPRESSBLOCK_BTLAZY2,
  ------------------
  |  |  184|  4.97k|#define ZSTD_COMPRESSBLOCK_BTLAZY2 ZSTD_compressBlock_btlazy2
  ------------------
 3079|  4.97k|          ZSTD_COMPRESSBLOCK_BTOPT,
  ------------------
  |  |   34|  4.97k|#define ZSTD_COMPRESSBLOCK_BTOPT ZSTD_compressBlock_btopt
  ------------------
 3080|  4.97k|          ZSTD_COMPRESSBLOCK_BTULTRA,
  ------------------
  |  |   61|  4.97k|#define ZSTD_COMPRESSBLOCK_BTULTRA ZSTD_compressBlock_btultra
  ------------------
 3081|  4.97k|          ZSTD_COMPRESSBLOCK_BTULTRA2
  ------------------
  |  |   64|  4.97k|#define ZSTD_COMPRESSBLOCK_BTULTRA2 ZSTD_compressBlock_btultra2
  ------------------
 3082|  4.97k|        },
 3083|  4.97k|        { ZSTD_compressBlock_fast_extDict  /* default for 0 */,
 3084|  4.97k|          ZSTD_compressBlock_fast_extDict,
 3085|  4.97k|          ZSTD_COMPRESSBLOCK_DOUBLEFAST_EXTDICT,
  ------------------
  |  |   35|  4.97k|#define ZSTD_COMPRESSBLOCK_DOUBLEFAST_EXTDICT ZSTD_compressBlock_doubleFast_extDict
  ------------------
 3086|  4.97k|          ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT,
  ------------------
  |  |   70|  4.97k|#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT ZSTD_compressBlock_greedy_extDict
  ------------------
 3087|  4.97k|          ZSTD_COMPRESSBLOCK_LAZY_EXTDICT,
  ------------------
  |  |  115|  4.97k|#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT ZSTD_compressBlock_lazy_extDict
  ------------------
 3088|  4.97k|          ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT,
  ------------------
  |  |  160|  4.97k|#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT ZSTD_compressBlock_lazy2_extDict
  ------------------
 3089|  4.97k|          ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT,
  ------------------
  |  |  186|  4.97k|#define ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT ZSTD_compressBlock_btlazy2_extDict
  ------------------
 3090|  4.97k|          ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT,
  ------------------
  |  |   36|  4.97k|#define ZSTD_COMPRESSBLOCK_BTOPT_EXTDICT ZSTD_compressBlock_btopt_extDict
  ------------------
 3091|  4.97k|          ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT,
  ------------------
  |  |   63|  4.97k|#define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT ZSTD_compressBlock_btultra_extDict
  ------------------
 3092|  4.97k|          ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT
  ------------------
  |  |   63|  4.97k|#define ZSTD_COMPRESSBLOCK_BTULTRA_EXTDICT ZSTD_compressBlock_btultra_extDict
  ------------------
 3093|  4.97k|        },
 3094|  4.97k|        { ZSTD_compressBlock_fast_dictMatchState  /* default for 0 */,
 3095|  4.97k|          ZSTD_compressBlock_fast_dictMatchState,
 3096|  4.97k|          ZSTD_COMPRESSBLOCK_DOUBLEFAST_DICTMATCHSTATE,
  ------------------
  |  |   34|  4.97k|#define ZSTD_COMPRESSBLOCK_DOUBLEFAST_DICTMATCHSTATE ZSTD_compressBlock_doubleFast_dictMatchState
  ------------------
 3097|  4.97k|          ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE,
  ------------------
  |  |   66|  4.97k|#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE ZSTD_compressBlock_greedy_dictMatchState
  ------------------
 3098|  4.97k|          ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE,
  ------------------
  |  |  111|  4.97k|#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE ZSTD_compressBlock_lazy_dictMatchState
  ------------------
 3099|  4.97k|          ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE,
  ------------------
  |  |  156|  4.97k|#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE ZSTD_compressBlock_lazy2_dictMatchState
  ------------------
 3100|  4.97k|          ZSTD_COMPRESSBLOCK_BTLAZY2_DICTMATCHSTATE,
  ------------------
  |  |  185|  4.97k|#define ZSTD_COMPRESSBLOCK_BTLAZY2_DICTMATCHSTATE ZSTD_compressBlock_btlazy2_dictMatchState
  ------------------
 3101|  4.97k|          ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE,
  ------------------
  |  |   35|  4.97k|#define ZSTD_COMPRESSBLOCK_BTOPT_DICTMATCHSTATE ZSTD_compressBlock_btopt_dictMatchState
  ------------------
 3102|  4.97k|          ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE,
  ------------------
  |  |   62|  4.97k|#define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE ZSTD_compressBlock_btultra_dictMatchState
  ------------------
 3103|  4.97k|          ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE
  ------------------
  |  |   62|  4.97k|#define ZSTD_COMPRESSBLOCK_BTULTRA_DICTMATCHSTATE ZSTD_compressBlock_btultra_dictMatchState
  ------------------
 3104|  4.97k|        },
 3105|  4.97k|        { NULL  /* default for 0 */,
 3106|  4.97k|          NULL,
 3107|  4.97k|          NULL,
 3108|  4.97k|          ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH,
  ------------------
  |  |   68|  4.97k|#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH ZSTD_compressBlock_greedy_dedicatedDictSearch
  ------------------
 3109|  4.97k|          ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH,
  ------------------
  |  |  113|  4.97k|#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH ZSTD_compressBlock_lazy_dedicatedDictSearch
  ------------------
 3110|  4.97k|          ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH,
  ------------------
  |  |  158|  4.97k|#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH ZSTD_compressBlock_lazy2_dedicatedDictSearch
  ------------------
 3111|  4.97k|          NULL,
 3112|  4.97k|          NULL,
 3113|  4.97k|          NULL,
 3114|  4.97k|          NULL }
 3115|  4.97k|    };
 3116|  4.97k|    ZSTD_BlockCompressor_f selectedCompressor;
 3117|  4.97k|    ZSTD_STATIC_ASSERT((unsigned)ZSTD_fast == 1);
  ------------------
  |  |   43|  4.97k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  4.97k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 3118|       |
 3119|  4.97k|    assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat));
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3120|  4.97k|    DEBUGLOG(5, "Selected block compressor: dictMode=%d strat=%d rowMatchfinder=%d", (int)dictMode, (int)strat, (int)useRowMatchFinder);
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 3121|  4.97k|    if (ZSTD_rowMatchFinderUsed(strat, useRowMatchFinder)) {
  ------------------
  |  Branch (3121:9): [True: 0, False: 4.97k]
  ------------------
 3122|      0|        static const ZSTD_BlockCompressor_f rowBasedBlockCompressors[4][3] = {
 3123|      0|            {
 3124|      0|                ZSTD_COMPRESSBLOCK_GREEDY_ROW,
  ------------------
  |  |   65|      0|#define ZSTD_COMPRESSBLOCK_GREEDY_ROW ZSTD_compressBlock_greedy_row
  ------------------
 3125|      0|                ZSTD_COMPRESSBLOCK_LAZY_ROW,
  ------------------
  |  |  110|      0|#define ZSTD_COMPRESSBLOCK_LAZY_ROW ZSTD_compressBlock_lazy_row
  ------------------
 3126|      0|                ZSTD_COMPRESSBLOCK_LAZY2_ROW
  ------------------
  |  |  155|      0|#define ZSTD_COMPRESSBLOCK_LAZY2_ROW ZSTD_compressBlock_lazy2_row
  ------------------
 3127|      0|            },
 3128|      0|            {
 3129|      0|                ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT_ROW,
  ------------------
  |  |   71|      0|#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT_ROW ZSTD_compressBlock_greedy_extDict_row
  ------------------
 3130|      0|                ZSTD_COMPRESSBLOCK_LAZY_EXTDICT_ROW,
  ------------------
  |  |  116|      0|#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT_ROW ZSTD_compressBlock_lazy_extDict_row
  ------------------
 3131|      0|                ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT_ROW
  ------------------
  |  |  161|      0|#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT_ROW ZSTD_compressBlock_lazy2_extDict_row
  ------------------
 3132|      0|            },
 3133|      0|            {
 3134|      0|                ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE_ROW,
  ------------------
  |  |   67|      0|#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE_ROW ZSTD_compressBlock_greedy_dictMatchState_row
  ------------------
 3135|      0|                ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE_ROW,
  ------------------
  |  |  112|      0|#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE_ROW ZSTD_compressBlock_lazy_dictMatchState_row
  ------------------
 3136|      0|                ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE_ROW
  ------------------
  |  |  157|      0|#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE_ROW ZSTD_compressBlock_lazy2_dictMatchState_row
  ------------------
 3137|      0|            },
 3138|      0|            {
 3139|      0|                ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH_ROW,
  ------------------
  |  |   69|      0|#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_greedy_dedicatedDictSearch_row
  ------------------
 3140|      0|                ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH_ROW,
  ------------------
  |  |  114|      0|#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_lazy_dedicatedDictSearch_row
  ------------------
 3141|      0|                ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH_ROW
  ------------------
  |  |  159|      0|#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_lazy2_dedicatedDictSearch_row
  ------------------
 3142|      0|            }
 3143|      0|        };
 3144|      0|        DEBUGLOG(5, "Selecting a row-based matchfinder");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3145|      0|        assert(useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3146|      0|        selectedCompressor = rowBasedBlockCompressors[(int)dictMode][(int)strat - (int)ZSTD_greedy];
 3147|  4.97k|    } else {
 3148|  4.97k|        selectedCompressor = blockCompressor[(int)dictMode][(int)strat];
 3149|  4.97k|    }
 3150|  4.97k|    assert(selectedCompressor != NULL);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3151|  4.97k|    return selectedCompressor;
 3152|  4.97k|}
ZSTD_resetSeqStore:
 3162|  5.50k|{
 3163|  5.50k|    ssPtr->lit = ssPtr->litStart;
 3164|  5.50k|    ssPtr->sequences = ssPtr->sequencesStart;
 3165|  5.50k|    ssPtr->longLengthType = ZSTD_llt_none;
 3166|  5.50k|}
ZSTD_sequenceBound:
 3514|  5.00k|size_t ZSTD_sequenceBound(size_t srcSize) {
 3515|  5.00k|    const size_t maxNbSeq = (srcSize / ZSTD_MINMATCH_MIN) + 1;
  ------------------
  |  | 1276|  5.00k|#define ZSTD_MINMATCH_MIN         3   /* only for ZSTD_btopt+, faster strategies are limited to 4 */
  ------------------
 3516|  5.00k|    const size_t maxNbDelims = (srcSize / ZSTD_BLOCKSIZE_MAX_MIN) + 1;
  ------------------
  |  | 1281|  5.00k|#define ZSTD_BLOCKSIZE_MAX_MIN (1 << 10) /* The minimum valid max blocksize. Maximum blocksizes smaller than this make compressBound() inaccurate. */
  ------------------
 3517|  5.00k|    return maxNbSeq + maxNbDelims;
 3518|  5.00k|}
ZSTD_referenceExternalSequences:
 4781|  5.00k|{
 4782|  5.00k|    assert(cctx->stage == ZSTDcs_init);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4783|  5.00k|    assert(nbSeq == 0 || cctx->appliedParams.ldmParams.enableLdm != ZSTD_ps_enable);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4784|  5.00k|    cctx->externSeqStore.seq = seq;
 4785|  5.00k|    cctx->externSeqStore.size = nbSeq;
 4786|  5.00k|    cctx->externSeqStore.capacity = nbSeq;
 4787|  5.00k|    cctx->externSeqStore.pos = 0;
 4788|  5.00k|    cctx->externSeqStore.posInSequence = 0;
 4789|  5.00k|}
ZSTD_CCtx_trace:
 5384|  3.15k|{
 5385|  3.15k|#if ZSTD_TRACE
 5386|  3.15k|    if (cctx->traceCtx && ZSTD_trace_compress_end != NULL) {
  ------------------
  |  Branch (5386:9): [True: 0, False: 3.15k]
  |  Branch (5386:27): [True: 0, False: 0]
  ------------------
 5387|      0|        int const streaming = cctx->inBuffSize > 0 || cctx->outBuffSize > 0 || cctx->appliedParams.nbWorkers > 0;
  ------------------
  |  Branch (5387:31): [True: 0, False: 0]
  |  Branch (5387:55): [True: 0, False: 0]
  |  Branch (5387:80): [True: 0, False: 0]
  ------------------
 5388|      0|        ZSTD_Trace trace;
 5389|      0|        ZSTD_memset(&trace, 0, sizeof(trace));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 5390|      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    5
  |  |  ------------------
  |  |               #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  114|      0|#define ZSTD_VERSION_RELEASE  7
  |  |  ------------------
  ------------------
 5391|      0|        trace.streaming = streaming;
 5392|      0|        trace.dictionaryID = cctx->dictID;
 5393|      0|        trace.dictionarySize = cctx->dictContentSize;
 5394|      0|        trace.uncompressedSize = cctx->consumedSrcSize;
 5395|      0|        trace.compressedSize = cctx->producedCSize + extraCSize;
 5396|      0|        trace.params = &cctx->appliedParams;
 5397|      0|        trace.cctx = cctx;
 5398|      0|        ZSTD_trace_compress_end(cctx->traceCtx, &trace);
 5399|      0|    }
 5400|  3.15k|    cctx->traceCtx = 0;
 5401|       |#else
 5402|       |    (void)cctx;
 5403|       |    (void)extraCSize;
 5404|       |#endif
 5405|  3.15k|}
ZSTD_compressEnd_public:
 5410|  5.00k|{
 5411|  5.00k|    size_t endResult;
 5412|  5.00k|    size_t const cSize = ZSTD_compressContinue_internal(cctx,
 5413|  5.00k|                                dst, dstCapacity, src, srcSize,
 5414|  5.00k|                                1 /* frame mode */, 1 /* last chunk */);
 5415|  5.00k|    FORWARD_IF_ERROR(cSize, "ZSTD_compressContinue_internal failed");
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 1.84k, False: 3.15k]
  |  |  ------------------
  |  |  149|  1.84k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  1.84k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  1.84k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  1.84k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  1.84k|    do {                                           \
  |  |  |  |   99|  1.84k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.84k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.84k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  1.84k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  1.84k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.84k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  1.84k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.84k|            return err_code;                                                       \
  |  |  155|  1.84k|        }                                                                          \
  |  |  156|  5.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 5416|  3.15k|    endResult = ZSTD_writeEpilogue(cctx, (char*)dst + cSize, dstCapacity-cSize);
 5417|  3.15k|    FORWARD_IF_ERROR(endResult, "ZSTD_writeEpilogue failed");
  ------------------
  |  |  146|  3.15k|    do {                                                                           \
  |  |  147|  3.15k|        size_t const err_code = (err);                                             \
  |  |  148|  3.15k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 3.15k]
  |  |  ------------------
  |  |  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|  3.15k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 5418|  3.15k|    assert(!(cctx->appliedParams.fParams.contentSizeFlag && cctx->pledgedSrcSizePlusOne == 0));
  ------------------
  |  |   70|  3.15k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5419|  3.15k|    if (cctx->pledgedSrcSizePlusOne != 0) {  /* control src size */
  ------------------
  |  Branch (5419:9): [True: 3.15k, False: 0]
  ------------------
 5420|  3.15k|        ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN == (unsigned long long)-1);
  ------------------
  |  |   43|  3.15k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  3.15k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 5421|  3.15k|        DEBUGLOG(4, "end of frame : controlling src size");
  ------------------
  |  |  104|  3.15k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 5422|  3.15k|        RETURN_ERROR_IF(
  ------------------
  |  |  114|  3.15k|    do {                                                                       \
  |  |  115|  3.15k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.15k]
  |  |  ------------------
  |  |  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.15k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 5423|  3.15k|            cctx->pledgedSrcSizePlusOne != cctx->consumedSrcSize+1,
 5424|  3.15k|            srcSize_wrong,
 5425|  3.15k|             "error : pledgedSrcSize = %u, while realSrcSize = %u",
 5426|  3.15k|            (unsigned)cctx->pledgedSrcSizePlusOne-1,
 5427|  3.15k|            (unsigned)cctx->consumedSrcSize);
 5428|  3.15k|    }
 5429|  3.15k|    ZSTD_CCtx_trace(cctx, endResult);
 5430|  3.15k|    return cSize + endResult;
 5431|  3.15k|}
ZSTD_compress_advanced_internal:
 5464|  5.00k|{
 5465|  5.00k|    DEBUGLOG(4, "ZSTD_compress_advanced_internal (srcSize:%u)", (unsigned)srcSize);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 5466|  5.00k|    FORWARD_IF_ERROR( ZSTD_compressBegin_internal(cctx,
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 5467|  5.00k|                         dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast, NULL,
 5468|  5.00k|                         params, srcSize, ZSTDb_not_buffered) , "");
 5469|  5.00k|    return ZSTD_compressEnd_public(cctx, dst, dstCapacity, src, srcSize);
 5470|  5.00k|}
ZSTD_compress_usingDict:
 5477|  5.00k|{
 5478|  5.00k|    {
 5479|  5.00k|        ZSTD_parameters const params = ZSTD_getParams_internal(compressionLevel, srcSize, dict ? dictSize : 0, ZSTD_cpm_noAttachDict);
  ------------------
  |  Branch (5479:91): [True: 0, False: 5.00k]
  ------------------
 5480|  5.00k|        assert(params.fParams.contentSizeFlag == 1);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5481|  5.00k|        ZSTD_CCtxParams_init_internal(&cctx->simpleApiParams, &params, (compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT: compressionLevel);
  ------------------
  |  |  134|      0|#  define ZSTD_CLEVEL_DEFAULT 3
  ------------------
  |  Branch (5481:72): [True: 0, False: 5.00k]
  ------------------
 5482|  5.00k|    }
 5483|  5.00k|    DEBUGLOG(4, "ZSTD_compress_usingDict (srcSize=%u)", (unsigned)srcSize);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 5484|  5.00k|    return ZSTD_compress_advanced_internal(cctx, dst, dstCapacity, src, srcSize, dict, dictSize, &cctx->simpleApiParams);
 5485|  5.00k|}
ZSTD_compressCCtx:
 5491|  5.00k|{
 5492|  5.00k|    DEBUGLOG(4, "ZSTD_compressCCtx (srcSize=%u)", (unsigned)srcSize);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 5493|  5.00k|    assert(cctx != NULL);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5494|       |    return ZSTD_compress_usingDict(cctx, dst, dstCapacity, src, srcSize, NULL, 0, compressionLevel);
 5495|  5.00k|}
ZSTD_sizeof_CDict:
 5543|  2.98k|{
 5544|  2.98k|    if (cdict==NULL) return 0;   /* support sizeof on NULL */
  ------------------
  |  Branch (5544:9): [True: 2.98k, False: 0]
  ------------------
 5545|      0|    DEBUGLOG(5, "sizeof(*cdict) : %u", (unsigned)sizeof(*cdict));
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5546|       |    /* cdict may be in the workspace */
 5547|      0|    return (cdict->workspace.workspace == cdict ? 0 : sizeof(*cdict))
  ------------------
  |  Branch (5547:13): [True: 0, False: 0]
  ------------------
 5548|      0|        + ZSTD_cwksp_sizeof(&cdict->workspace);
 5549|  2.98k|}
ZSTD_freeCDict:
 5733|     76|{
 5734|     76|    if (cdict==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (5734:9): [True: 76, False: 0]
  ------------------
 5735|      0|    {   ZSTD_customMem const cMem = cdict->customMem;
 5736|      0|        int cdictInWorkspace = ZSTD_cwksp_owns_buffer(&cdict->workspace, cdict);
 5737|      0|        ZSTD_cwksp_free(&cdict->workspace, cMem);
 5738|      0|        if (!cdictInWorkspace) {
  ------------------
  |  Branch (5738:13): [True: 0, False: 0]
  ------------------
 5739|      0|            ZSTD_customFree(cdict, cMem);
 5740|      0|        }
 5741|      0|        return 0;
 5742|     76|    }
 5743|     76|}
ZSTD_maxCLevel:
 7673|    528|int ZSTD_maxCLevel(void) { return ZSTD_MAX_CLEVEL; }
  ------------------
  |  |   19|    528|#define ZSTD_MAX_CLEVEL     22
  ------------------
zstd_compress.c:ZSTD_initCCtx:
  103|     38|{
  104|     38|    assert(cctx != NULL);
  ------------------
  |  |   70|     38|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  105|     38|    ZSTD_memset(cctx, 0, sizeof(*cctx));
  ------------------
  |  |   46|     38|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  106|     38|    cctx->customMem = memManager;
  107|     38|    cctx->bmi2 = ZSTD_cpuSupportsBmi2();
  108|     38|    {   size_t const err = ZSTD_CCtx_reset(cctx, ZSTD_reset_parameters);
  109|     38|        assert(!ZSTD_isError(err));
  ------------------
  |  |   70|     38|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  110|     38|        (void)err;
  111|     38|    }
  112|     38|}
zstd_compress.c:ZSTD_freeCCtxContent:
  171|     38|{
  172|     38|    assert(cctx != NULL);
  ------------------
  |  |   70|     38|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  173|     38|    assert(cctx->staticSize == 0);
  ------------------
  |  |   70|     38|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  174|     38|    ZSTD_clearAllDicts(cctx);
  175|       |#ifdef ZSTD_MULTITHREAD
  176|       |    ZSTDMT_freeCCtx(cctx->mtctx); cctx->mtctx = NULL;
  177|       |#endif
  178|     38|    ZSTD_cwksp_free(&cctx->workspace, cctx->customMem);
  179|     38|}
zstd_compress.c:ZSTD_sizeof_localDict:
  164|  2.98k|{
  165|  2.98k|    size_t const bufferSize = dict.dictBuffer != NULL ? dict.dictSize : 0;
  ------------------
  |  Branch (165:31): [True: 0, False: 2.98k]
  ------------------
  166|  2.98k|    size_t const cdictSize = ZSTD_sizeof_CDict(dict.cdict);
  167|  2.98k|    return bufferSize + cdictSize;
  168|  2.98k|}
zstd_compress.c:ZSTD_sizeof_mtctx:
  196|  2.98k|{
  197|       |#ifdef ZSTD_MULTITHREAD
  198|       |    return ZSTDMT_sizeof_CCtx(cctx->mtctx);
  199|       |#else
  200|  2.98k|    (void)cctx;
  201|  2.98k|    return 0;
  202|  2.98k|#endif
  203|  2.98k|}
zstd_compress.c:ZSTD_CCtxParams_init_internal:
  376|  5.00k|{
  377|  5.00k|    assert(!ZSTD_checkCParams(params->cParams));
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  378|  5.00k|    ZSTD_memset(cctxParams, 0, sizeof(*cctxParams));
  ------------------
  |  |   46|  5.00k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  379|  5.00k|    cctxParams->cParams = params->cParams;
  380|  5.00k|    cctxParams->fParams = params->fParams;
  381|       |    /* Should not matter, as all cParams are presumed properly defined.
  382|       |     * But, set it for tracing anyway.
  383|       |     */
  384|  5.00k|    cctxParams->compressionLevel = compressionLevel;
  385|  5.00k|    cctxParams->useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(cctxParams->useRowMatchFinder, &params->cParams);
  386|  5.00k|    cctxParams->postBlockSplitter = ZSTD_resolveBlockSplitterMode(cctxParams->postBlockSplitter, &params->cParams);
  387|  5.00k|    cctxParams->ldmParams.enableLdm = ZSTD_resolveEnableLdm(cctxParams->ldmParams.enableLdm, &params->cParams);
  388|  5.00k|    cctxParams->validateSequences = ZSTD_resolveExternalSequenceValidation(cctxParams->validateSequences);
  389|  5.00k|    cctxParams->maxBlockSize = ZSTD_resolveMaxBlockSize(cctxParams->maxBlockSize);
  390|  5.00k|    cctxParams->searchForExternalRepcodes = ZSTD_resolveExternalRepcodeSearch(cctxParams->searchForExternalRepcodes, compressionLevel);
  391|  5.00k|    DEBUGLOG(4, "ZSTD_CCtxParams_init_internal: useRowMatchFinder=%d, useBlockSplitter=%d ldm=%d",
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  392|  5.00k|                cctxParams->useRowMatchFinder, cctxParams->postBlockSplitter, cctxParams->ldmParams.enableLdm);
  393|  5.00k|}
zstd_compress.c:ZSTD_resolveBlockSplitterMode:
  249|  5.00k|                                                        const ZSTD_compressionParameters* const cParams) {
  250|  5.00k|    if (mode != ZSTD_ps_auto) return mode;
  ------------------
  |  Branch (250:9): [True: 0, False: 5.00k]
  ------------------
  251|  5.00k|    return (cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 17) ? ZSTD_ps_enable : ZSTD_ps_disable;
  ------------------
  |  Branch (251:13): [True: 2.48k, False: 2.52k]
  |  Branch (251:48): [True: 0, False: 2.48k]
  ------------------
  252|  5.00k|}
zstd_compress.c:ZSTD_resolveEnableLdm:
  270|  5.00k|                                 const ZSTD_compressionParameters* const cParams) {
  271|  5.00k|    if (mode != ZSTD_ps_auto) return mode;
  ------------------
  |  Branch (271:9): [True: 0, False: 5.00k]
  ------------------
  272|  5.00k|    return (cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 27) ? ZSTD_ps_enable : ZSTD_ps_disable;
  ------------------
  |  Branch (272:13): [True: 2.48k, False: 2.52k]
  |  Branch (272:48): [True: 0, False: 2.48k]
  ------------------
  273|  5.00k|}
zstd_compress.c:ZSTD_resolveExternalSequenceValidation:
  275|  5.00k|static int ZSTD_resolveExternalSequenceValidation(int mode) {
  276|  5.00k|    return mode;
  277|  5.00k|}
zstd_compress.c:ZSTD_resolveExternalRepcodeSearch:
  288|  5.00k|static ZSTD_ParamSwitch_e ZSTD_resolveExternalRepcodeSearch(ZSTD_ParamSwitch_e value, int cLevel) {
  289|  5.00k|    if (value != ZSTD_ps_auto) return value;
  ------------------
  |  Branch (289:9): [True: 0, False: 5.00k]
  ------------------
  290|  5.00k|    if (cLevel < 10) {
  ------------------
  |  Branch (290:9): [True: 2.52k, False: 2.48k]
  ------------------
  291|  2.52k|        return ZSTD_ps_disable;
  292|  2.52k|    } else {
  293|  2.48k|        return ZSTD_ps_enable;
  294|  2.48k|    }
  295|  5.00k|}
zstd_compress.c:ZSTD_clearAllDicts:
  155|     76|{
  156|     76|    ZSTD_customFree(cctx->localDict.dictBuffer, cctx->customMem);
  157|     76|    ZSTD_freeCDict(cctx->localDict.cdict);
  158|     76|    ZSTD_memset(&cctx->localDict, 0, sizeof(cctx->localDict));
  ------------------
  |  |   46|     76|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  159|     76|    ZSTD_memset(&cctx->prefixDict, 0, sizeof(cctx->prefixDict));
  ------------------
  |  |   46|     76|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  160|       |    cctx->cdict = NULL;
  161|     76|}
zstd_compress.c:ZSTD_adjustCParams_internal:
 1478|  5.00k|{
 1479|  5.00k|    const U64 minSrcSize = 513; /* (1<<9) + 1 */
 1480|  5.00k|    const U64 maxWindowResize = 1ULL << (ZSTD_WINDOWLOG_MAX-1);
  ------------------
  |  | 1265|  5.00k|#define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |               #define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1264|  5.00k|#define ZSTD_WINDOWLOG_MAX_64    31
  |  |  ------------------
  |  |  |  Branch (1265:39): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 1481|  5.00k|    assert(ZSTD_checkCParams(cPar)==0);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1482|       |
 1483|       |    /* Cascade the selected strategy down to the next-highest one built into
 1484|       |     * this binary. */
 1485|       |#ifdef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
 1486|       |    if (cPar.strategy == ZSTD_btultra2) {
 1487|       |        cPar.strategy = ZSTD_btultra;
 1488|       |    }
 1489|       |    if (cPar.strategy == ZSTD_btultra) {
 1490|       |        cPar.strategy = ZSTD_btopt;
 1491|       |    }
 1492|       |#endif
 1493|       |#ifdef ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR
 1494|       |    if (cPar.strategy == ZSTD_btopt) {
 1495|       |        cPar.strategy = ZSTD_btlazy2;
 1496|       |    }
 1497|       |#endif
 1498|       |#ifdef ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR
 1499|       |    if (cPar.strategy == ZSTD_btlazy2) {
 1500|       |        cPar.strategy = ZSTD_lazy2;
 1501|       |    }
 1502|       |#endif
 1503|       |#ifdef ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR
 1504|       |    if (cPar.strategy == ZSTD_lazy2) {
 1505|       |        cPar.strategy = ZSTD_lazy;
 1506|       |    }
 1507|       |#endif
 1508|       |#ifdef ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR
 1509|       |    if (cPar.strategy == ZSTD_lazy) {
 1510|       |        cPar.strategy = ZSTD_greedy;
 1511|       |    }
 1512|       |#endif
 1513|       |#ifdef ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR
 1514|       |    if (cPar.strategy == ZSTD_greedy) {
 1515|       |        cPar.strategy = ZSTD_dfast;
 1516|       |    }
 1517|       |#endif
 1518|       |#ifdef ZSTD_EXCLUDE_DFAST_BLOCK_COMPRESSOR
 1519|       |    if (cPar.strategy == ZSTD_dfast) {
 1520|       |        cPar.strategy = ZSTD_fast;
 1521|       |        cPar.targetLength = 0;
 1522|       |    }
 1523|       |#endif
 1524|       |
 1525|  5.00k|    switch (mode) {
 1526|      0|    case ZSTD_cpm_unknown:
  ------------------
  |  Branch (1526:5): [True: 0, False: 5.00k]
  ------------------
 1527|  5.00k|    case ZSTD_cpm_noAttachDict:
  ------------------
  |  Branch (1527:5): [True: 5.00k, False: 0]
  ------------------
 1528|       |        /* If we don't know the source size, don't make any
 1529|       |         * assumptions about it. We will already have selected
 1530|       |         * smaller parameters if a dictionary is in use.
 1531|       |         */
 1532|  5.00k|        break;
 1533|      0|    case ZSTD_cpm_createCDict:
  ------------------
  |  Branch (1533:5): [True: 0, False: 5.00k]
  ------------------
 1534|       |        /* Assume a small source size when creating a dictionary
 1535|       |         * with an unknown source size.
 1536|       |         */
 1537|      0|        if (dictSize && srcSize == ZSTD_CONTENTSIZE_UNKNOWN)
  ------------------
  |  |  203|      0|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1537:13): [True: 0, False: 0]
  |  Branch (1537:25): [True: 0, False: 0]
  ------------------
 1538|      0|            srcSize = minSrcSize;
 1539|      0|        break;
 1540|      0|    case ZSTD_cpm_attachDict:
  ------------------
  |  Branch (1540:5): [True: 0, False: 5.00k]
  ------------------
 1541|       |        /* Dictionary has its own dedicated parameters which have
 1542|       |         * already been selected. We are selecting parameters
 1543|       |         * for only the source.
 1544|       |         */
 1545|      0|        dictSize = 0;
 1546|      0|        break;
 1547|      0|    default:
  ------------------
  |  Branch (1547:5): [True: 0, False: 5.00k]
  ------------------
 1548|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1549|      0|        break;
 1550|  5.00k|    }
 1551|       |
 1552|       |    /* resize windowLog if input is small enough, to use less memory */
 1553|  5.00k|    if ( (srcSize <= maxWindowResize)
  ------------------
  |  Branch (1553:10): [True: 5.00k, False: 0]
  ------------------
 1554|  5.00k|      && (dictSize <= maxWindowResize) )  {
  ------------------
  |  Branch (1554:10): [True: 5.00k, False: 0]
  ------------------
 1555|  5.00k|        U32 const tSize = (U32)(srcSize + dictSize);
 1556|  5.00k|        static U32 const hashSizeMin = 1 << ZSTD_HASHLOG_MIN;
  ------------------
  |  | 1268|  5.00k|#define ZSTD_HASHLOG_MIN          6
  ------------------
 1557|  5.00k|        U32 const srcLog = (tSize < hashSizeMin) ? ZSTD_HASHLOG_MIN :
  ------------------
  |  | 1268|    573|#define ZSTD_HASHLOG_MIN          6
  ------------------
  |  Branch (1557:28): [True: 573, False: 4.42k]
  ------------------
 1558|  5.00k|                            ZSTD_highbit32(tSize-1) + 1;
 1559|  5.00k|        if (cPar.windowLog > srcLog) cPar.windowLog = srcLog;
  ------------------
  |  Branch (1559:13): [True: 5.00k, False: 0]
  ------------------
 1560|  5.00k|    }
 1561|  5.00k|    if (srcSize != ZSTD_CONTENTSIZE_UNKNOWN) {
  ------------------
  |  |  203|  5.00k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1561:9): [True: 5.00k, False: 0]
  ------------------
 1562|  5.00k|        U32 const dictAndWindowLog = ZSTD_dictAndWindowLog(cPar.windowLog, (U64)srcSize, (U64)dictSize);
 1563|  5.00k|        U32 const cycleLog = ZSTD_cycleLog(cPar.chainLog, cPar.strategy);
 1564|  5.00k|        if (cPar.hashLog > dictAndWindowLog+1) cPar.hashLog = dictAndWindowLog+1;
  ------------------
  |  Branch (1564:13): [True: 5.00k, False: 0]
  ------------------
 1565|  5.00k|        if (cycleLog > dictAndWindowLog)
  ------------------
  |  Branch (1565:13): [True: 5.00k, False: 0]
  ------------------
 1566|  5.00k|            cPar.chainLog -= (cycleLog - dictAndWindowLog);
 1567|  5.00k|    }
 1568|       |
 1569|  5.00k|    if (cPar.windowLog < ZSTD_WINDOWLOG_ABSOLUTEMIN)
  ------------------
  |  |   78|  5.00k|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
  |  Branch (1569:9): [True: 5.00k, False: 0]
  ------------------
 1570|  5.00k|        cPar.windowLog = ZSTD_WINDOWLOG_ABSOLUTEMIN;  /* minimum wlog required for valid frame header */
  ------------------
  |  |   78|  5.00k|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
 1571|       |
 1572|       |    /* We can't use more than 32 bits of hash in total, so that means that we require:
 1573|       |     * (hashLog + 8) <= 32 && (chainLog + 8) <= 32
 1574|       |     */
 1575|  5.00k|    if (mode == ZSTD_cpm_createCDict && ZSTD_CDictIndicesAreTagged(&cPar)) {
  ------------------
  |  Branch (1575:9): [True: 0, False: 5.00k]
  |  Branch (1575:41): [True: 0, False: 0]
  ------------------
 1576|      0|        U32 const maxShortCacheHashLog = 32 - ZSTD_SHORT_CACHE_TAG_BITS;
  ------------------
  |  | 1482|      0|#define ZSTD_SHORT_CACHE_TAG_BITS 8
  ------------------
 1577|      0|        if (cPar.hashLog > maxShortCacheHashLog) {
  ------------------
  |  Branch (1577:13): [True: 0, False: 0]
  ------------------
 1578|      0|            cPar.hashLog = maxShortCacheHashLog;
 1579|      0|        }
 1580|      0|        if (cPar.chainLog > maxShortCacheHashLog) {
  ------------------
  |  Branch (1580:13): [True: 0, False: 0]
  ------------------
 1581|      0|            cPar.chainLog = maxShortCacheHashLog;
 1582|      0|        }
 1583|      0|    }
 1584|       |
 1585|       |
 1586|       |    /* At this point, we aren't 100% sure if we are using the row match finder.
 1587|       |     * Unless it is explicitly disabled, conservatively assume that it is enabled.
 1588|       |     * In this case it will only be disabled for small sources, so shrinking the
 1589|       |     * hash log a little bit shouldn't result in any ratio loss.
 1590|       |     */
 1591|  5.00k|    if (useRowMatchFinder == ZSTD_ps_auto)
  ------------------
  |  Branch (1591:9): [True: 5.00k, False: 0]
  ------------------
 1592|  5.00k|        useRowMatchFinder = ZSTD_ps_enable;
 1593|       |
 1594|       |    /* We can't hash more than 32-bits in total. So that means that we require:
 1595|       |     * (hashLog - rowLog + 8) <= 32
 1596|       |     */
 1597|  5.00k|    if (ZSTD_rowMatchFinderUsed(cPar.strategy, useRowMatchFinder)) {
  ------------------
  |  Branch (1597:9): [True: 1.77k, False: 3.22k]
  ------------------
 1598|       |        /* Switch to 32-entry rows if searchLog is 5 (or more) */
 1599|  1.77k|        U32 const rowLog = BOUNDED(4, cPar.searchLog, 6);
  ------------------
  |  |   56|  1.77k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|  3.55k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 256, False: 1.52k]
  |  |  |  |  |  Branch (55:24): [True: 256, False: 1.52k]
  |  |  |  |  |  Branch (55:36): [True: 0, False: 1.52k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1600|  1.77k|        U32 const maxRowHashLog = 32 - ZSTD_ROW_HASH_TAG_BITS;
  ------------------
  |  |   24|  1.77k|#define ZSTD_ROW_HASH_TAG_BITS 8        /* nb bits to use for the tag */
  ------------------
 1601|  1.77k|        U32 const maxHashLog = maxRowHashLog + rowLog;
 1602|  1.77k|        assert(cPar.hashLog >= rowLog);
  ------------------
  |  |   70|  1.77k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1603|  1.77k|        if (cPar.hashLog > maxHashLog) {
  ------------------
  |  Branch (1603:13): [True: 0, False: 1.77k]
  ------------------
 1604|      0|            cPar.hashLog = maxHashLog;
 1605|      0|        }
 1606|  1.77k|    }
 1607|       |
 1608|  5.00k|    return cPar;
 1609|  5.00k|}
zstd_compress.c:ZSTD_dictAndWindowLog:
 1440|  5.00k|{
 1441|  5.00k|    const U64 maxWindowSize = 1ULL << ZSTD_WINDOWLOG_MAX;
  ------------------
  |  | 1265|  5.00k|#define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |               #define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1264|  5.00k|#define ZSTD_WINDOWLOG_MAX_64    31
  |  |  ------------------
  |  |  |  Branch (1265:39): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 1442|       |    /* No dictionary ==> No change */
 1443|  5.00k|    if (dictSize == 0) {
  ------------------
  |  Branch (1443:9): [True: 5.00k, False: 0]
  ------------------
 1444|  5.00k|        return windowLog;
 1445|  5.00k|    }
 1446|      0|    assert(windowLog <= ZSTD_WINDOWLOG_MAX);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1447|      0|    assert(srcSize != ZSTD_CONTENTSIZE_UNKNOWN); /* Handled in ZSTD_adjustCParams_internal() */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1448|      0|    {
 1449|      0|        U64 const windowSize = 1ULL << windowLog;
 1450|      0|        U64 const dictAndWindowSize = dictSize + windowSize;
 1451|       |        /* If the window size is already large enough to fit both the source and the dictionary
 1452|       |         * then just use the window size. Otherwise adjust so that it fits the dictionary and
 1453|       |         * the window.
 1454|       |         */
 1455|      0|        if (windowSize >= dictSize + srcSize) {
  ------------------
  |  Branch (1455:13): [True: 0, False: 0]
  ------------------
 1456|      0|            return windowLog; /* Window size large enough already */
 1457|      0|        } else if (dictAndWindowSize >= maxWindowSize) {
  ------------------
  |  Branch (1457:20): [True: 0, False: 0]
  ------------------
 1458|      0|            return ZSTD_WINDOWLOG_MAX; /* Larger than max window log */
  ------------------
  |  | 1265|      0|#define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |               #define ZSTD_WINDOWLOG_MAX     ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  | 1264|      0|#define ZSTD_WINDOWLOG_MAX_64    31
  |  |  ------------------
  |  |  |  Branch (1265:39): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1459|      0|        } else  {
 1460|      0|            return ZSTD_highbit32((U32)dictAndWindowSize - 1) + 1;
 1461|      0|        }
 1462|      0|    }
 1463|      0|}
zstd_compress.c:ZSTD_resolveRowMatchFinderMode:
  239|  5.00k|                                                         const ZSTD_compressionParameters* const cParams) {
  240|  5.00k|    if (mode != ZSTD_ps_auto) return mode; /* if requested enabled, but no SIMD, we still will use row matchfinder */
  ------------------
  |  Branch (240:9): [True: 0, False: 5.00k]
  ------------------
  241|  5.00k|    mode = ZSTD_ps_disable;
  242|  5.00k|    if (!ZSTD_rowMatchFinderSupported(cParams->strategy)) return mode;
  ------------------
  |  Branch (242:9): [True: 3.22k, False: 1.77k]
  ------------------
  243|  1.77k|    if (cParams->windowLog > 14) mode = ZSTD_ps_enable;
  ------------------
  |  Branch (243:9): [True: 0, False: 1.77k]
  ------------------
  244|  1.77k|    return mode;
  245|  5.00k|}
zstd_compress.c:ZSTD_estimateCCtxSize_usingCCtxParams_internal:
 1712|  5.00k|{
 1713|  5.00k|    size_t const windowSize = (size_t) BOUNDED(1ULL, 1ULL << cParams->windowLog, pledgedSrcSize);
  ------------------
  |  |   56|  5.00k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|  10.0k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 0, False: 5.00k]
  |  |  |  |  |  Branch (55:24): [True: 0, False: 5.00k]
  |  |  |  |  |  Branch (55:36): [True: 0, False: 5.00k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1714|  5.00k|    size_t const blockSize = MIN(ZSTD_resolveMaxBlockSize(maxBlockSize), windowSize);
  ------------------
  |  |   54|  5.00k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 5.00k]
  |  |  ------------------
  ------------------
 1715|  5.00k|    size_t const maxNbSeq = ZSTD_maxNbSeq(blockSize, cParams->minMatch, useSequenceProducer);
 1716|  5.00k|    size_t const tokenSpace = ZSTD_cwksp_alloc_size(WILDCOPY_OVERLENGTH + blockSize)
  ------------------
  |  |  199|  5.00k|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1717|  5.00k|                            + ZSTD_cwksp_aligned64_alloc_size(maxNbSeq * sizeof(SeqDef))
 1718|  5.00k|                            + 3 * ZSTD_cwksp_alloc_size(maxNbSeq * sizeof(BYTE));
 1719|  5.00k|    size_t const tmpWorkSpace = ZSTD_cwksp_alloc_size(TMP_WORKSPACE_SIZE);
  ------------------
  |  |  444|  5.00k|#define TMP_WORKSPACE_SIZE (MAX(ENTROPY_WORKSPACE_SIZE, ZSTD_SLIPBLOCK_WORKSPACESIZE))
  |  |  ------------------
  |  |  |  |   55|  10.0k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 5.00k, Folded]
  |  |  |  |  |  Branch (55:20): [Folded, False: 5.00k]
  |  |  |  |  |  Branch (55:30): [Folded, False: 5.00k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1720|  5.00k|    size_t const blockStateSpace = 2 * ZSTD_cwksp_alloc_size(sizeof(ZSTD_compressedBlockState_t));
 1721|  5.00k|    size_t const matchStateSize = ZSTD_sizeof_matchState(cParams, useRowMatchFinder, /* enableDedicatedDictSearch */ 0, /* forCCtx */ 1);
 1722|       |
 1723|  5.00k|    size_t const ldmSpace = ZSTD_ldm_getTableSize(*ldmParams);
 1724|  5.00k|    size_t const maxNbLdmSeq = ZSTD_ldm_getMaxNbSeq(*ldmParams, blockSize);
 1725|  5.00k|    size_t const ldmSeqSpace = ldmParams->enableLdm == ZSTD_ps_enable ?
  ------------------
  |  Branch (1725:32): [True: 0, False: 5.00k]
  ------------------
 1726|  5.00k|        ZSTD_cwksp_aligned64_alloc_size(maxNbLdmSeq * sizeof(rawSeq)) : 0;
 1727|       |
 1728|       |
 1729|  5.00k|    size_t const bufferSpace = ZSTD_cwksp_alloc_size(buffInSize)
 1730|  5.00k|                             + ZSTD_cwksp_alloc_size(buffOutSize);
 1731|       |
 1732|  5.00k|    size_t const cctxSpace = isStatic ? ZSTD_cwksp_alloc_size(sizeof(ZSTD_CCtx)) : 0;
  ------------------
  |  Branch (1732:30): [True: 0, False: 5.00k]
  ------------------
 1733|       |
 1734|  5.00k|    size_t const maxNbExternalSeq = ZSTD_sequenceBound(blockSize);
 1735|  5.00k|    size_t const externalSeqSpace = useSequenceProducer
  ------------------
  |  Branch (1735:37): [True: 0, False: 5.00k]
  ------------------
 1736|  5.00k|        ? ZSTD_cwksp_aligned64_alloc_size(maxNbExternalSeq * sizeof(ZSTD_Sequence))
 1737|  5.00k|        : 0;
 1738|       |
 1739|  5.00k|    size_t const neededSpace =
 1740|  5.00k|        cctxSpace +
 1741|  5.00k|        tmpWorkSpace +
 1742|  5.00k|        blockStateSpace +
 1743|  5.00k|        ldmSpace +
 1744|  5.00k|        ldmSeqSpace +
 1745|  5.00k|        matchStateSize +
 1746|  5.00k|        tokenSpace +
 1747|  5.00k|        bufferSpace +
 1748|  5.00k|        externalSeqSpace;
 1749|       |
 1750|  5.00k|    DEBUGLOG(5, "estimate workspace : %u", (U32)neededSpace);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 1751|  5.00k|    return neededSpace;
 1752|  5.00k|}
zstd_compress.c:ZSTD_maxNbSeq:
 1697|  10.0k|static size_t ZSTD_maxNbSeq(size_t blockSize, unsigned minMatch, int useSequenceProducer) {
 1698|  10.0k|    U32 const divider = (minMatch==3 || useSequenceProducer) ? 3 : 4;
  ------------------
  |  Branch (1698:26): [True: 4.96k, False: 5.04k]
  |  Branch (1698:41): [True: 0, False: 5.04k]
  ------------------
 1699|  10.0k|    return blockSize / divider;
 1700|  10.0k|}
zstd_compress.c:ZSTD_rowMatchFinderSupported:
  225|  34.0k|static int ZSTD_rowMatchFinderSupported(const ZSTD_strategy strategy) {
  226|  34.0k|    return (strategy >= ZSTD_greedy && strategy <= ZSTD_lazy2);
  ------------------
  |  Branch (226:13): [True: 31.5k, False: 2.52k]
  |  Branch (226:40): [True: 12.4k, False: 19.1k]
  ------------------
  227|  34.0k|}
zstd_compress.c:ZSTD_resolveMaxBlockSize:
  280|  10.0k|static size_t ZSTD_resolveMaxBlockSize(size_t maxBlockSize) {
  281|  10.0k|    if (maxBlockSize == 0) {
  ------------------
  |  Branch (281:9): [True: 5.00k, False: 5.00k]
  ------------------
  282|  5.00k|        return ZSTD_BLOCKSIZE_MAX;
  ------------------
  |  |  148|  5.00k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|  5.00k|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  283|  5.00k|    } else {
  284|  5.00k|        return maxBlockSize;
  285|  5.00k|    }
  286|  10.0k|}
zstd_compress.c:ZSTD_resetCCtx_internal:
 2106|  5.00k|{
 2107|  5.00k|    ZSTD_cwksp* const ws = &zc->workspace;
 2108|  5.00k|    DEBUGLOG(4, "ZSTD_resetCCtx_internal: pledgedSrcSize=%u, wlog=%u, useRowMatchFinder=%d useBlockSplitter=%d",
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2109|  5.00k|                (U32)pledgedSrcSize, params->cParams.windowLog, (int)params->useRowMatchFinder, (int)params->postBlockSplitter);
 2110|  5.00k|    assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams)));
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2111|       |
 2112|  5.00k|    zc->isFirstBlock = 1;
 2113|       |
 2114|       |    /* Set applied params early so we can modify them for LDM,
 2115|       |     * and point params at the applied params.
 2116|       |     */
 2117|  5.00k|    zc->appliedParams = *params;
 2118|  5.00k|    params = &zc->appliedParams;
 2119|       |
 2120|  5.00k|    assert(params->useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2121|  5.00k|    assert(params->postBlockSplitter != ZSTD_ps_auto);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2122|  5.00k|    assert(params->ldmParams.enableLdm != ZSTD_ps_auto);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2123|  5.00k|    assert(params->maxBlockSize != 0);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2124|  5.00k|    if (params->ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (2124:9): [True: 0, False: 5.00k]
  ------------------
 2125|       |        /* Adjust long distance matching parameters */
 2126|      0|        ZSTD_ldm_adjustParameters(&zc->appliedParams.ldmParams, &params->cParams);
 2127|      0|        assert(params->ldmParams.hashLog >= params->ldmParams.bucketSizeLog);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2128|      0|        assert(params->ldmParams.hashRateLog < 32);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2129|      0|    }
 2130|       |
 2131|  5.00k|    {   size_t const windowSize = MAX(1, (size_t)MIN(((U64)1 << params->cParams.windowLog), pledgedSrcSize));
  ------------------
  |  |   55|  10.0k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 0, False: 5.00k]
  |  |  |  Branch (55:24): [True: 0, False: 5.00k]
  |  |  |  Branch (55:36): [True: 0, False: 5.00k]
  |  |  ------------------
  ------------------
 2132|  5.00k|        size_t const blockSize = MIN(params->maxBlockSize, windowSize);
  ------------------
  |  |   54|  5.00k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 5.00k]
  |  |  ------------------
  ------------------
 2133|  5.00k|        size_t const maxNbSeq = ZSTD_maxNbSeq(blockSize, params->cParams.minMatch, ZSTD_hasExtSeqProd(params));
 2134|  5.00k|        size_t const buffOutSize = (zbuff == ZSTDb_buffered && params->outBufferMode == ZSTD_bm_buffered)
  ------------------
  |  Branch (2134:37): [True: 0, False: 5.00k]
  |  Branch (2134:64): [True: 0, False: 0]
  ------------------
 2135|  5.00k|                ? ZSTD_compressBound(blockSize) + 1
 2136|  5.00k|                : 0;
 2137|  5.00k|        size_t const buffInSize = (zbuff == ZSTDb_buffered && params->inBufferMode == ZSTD_bm_buffered)
  ------------------
  |  Branch (2137:36): [True: 0, False: 5.00k]
  |  Branch (2137:63): [True: 0, False: 0]
  ------------------
 2138|  5.00k|                ? windowSize + blockSize
 2139|  5.00k|                : 0;
 2140|  5.00k|        size_t const maxNbLdmSeq = ZSTD_ldm_getMaxNbSeq(params->ldmParams, blockSize);
 2141|       |
 2142|  5.00k|        int const indexTooClose = ZSTD_indexTooCloseToMax(zc->blockState.matchState.window);
 2143|  5.00k|        int const dictTooBig = ZSTD_dictTooBig(loadedDictSize);
 2144|  5.00k|        ZSTD_indexResetPolicy_e needsIndexReset =
 2145|  5.00k|            (indexTooClose || dictTooBig || !zc->initialized) ? ZSTDirp_reset : ZSTDirp_continue;
  ------------------
  |  Branch (2145:14): [True: 0, False: 5.00k]
  |  Branch (2145:31): [True: 0, False: 5.00k]
  |  Branch (2145:45): [True: 38, False: 4.96k]
  ------------------
 2146|       |
 2147|  5.00k|        size_t const neededSpace =
 2148|  5.00k|            ZSTD_estimateCCtxSize_usingCCtxParams_internal(
 2149|  5.00k|                &params->cParams, &params->ldmParams, zc->staticSize != 0, params->useRowMatchFinder,
 2150|  5.00k|                buffInSize, buffOutSize, pledgedSrcSize, ZSTD_hasExtSeqProd(params), params->maxBlockSize);
 2151|       |
 2152|  5.00k|        FORWARD_IF_ERROR(neededSpace, "cctx size estimate failed!");
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2153|       |
 2154|  5.00k|        if (!zc->staticSize) ZSTD_cwksp_bump_oversized_duration(ws, 0);
  ------------------
  |  Branch (2154:13): [True: 5.00k, False: 0]
  ------------------
 2155|       |
 2156|  5.00k|        {   /* Check if workspace is large enough, alloc a new one if needed */
 2157|  5.00k|            int const workspaceTooSmall = ZSTD_cwksp_sizeof(ws) < neededSpace;
 2158|  5.00k|            int const workspaceWasteful = ZSTD_cwksp_check_wasteful(ws, neededSpace);
 2159|  5.00k|            int resizeWorkspace = workspaceTooSmall || workspaceWasteful;
  ------------------
  |  Branch (2159:35): [True: 38, False: 4.96k]
  |  Branch (2159:56): [True: 0, False: 4.96k]
  ------------------
 2160|  5.00k|            DEBUGLOG(4, "Need %zu B workspace", neededSpace);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2161|  5.00k|            DEBUGLOG(4, "windowSize: %zu - blockSize: %zu", windowSize, blockSize);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2162|       |
 2163|  5.00k|            if (resizeWorkspace) {
  ------------------
  |  Branch (2163:17): [True: 38, False: 4.96k]
  ------------------
 2164|     38|                DEBUGLOG(4, "Resize workspaceSize from %zuKB to %zuKB",
  ------------------
  |  |  104|     38|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2165|     38|                            ZSTD_cwksp_sizeof(ws) >> 10,
 2166|     38|                            neededSpace >> 10);
 2167|       |
 2168|     38|                RETURN_ERROR_IF(zc->staticSize, memory_allocation, "static cctx : no resize");
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2169|       |
 2170|     38|                needsIndexReset = ZSTDirp_reset;
 2171|       |
 2172|     38|                ZSTD_cwksp_free(ws, zc->customMem);
 2173|     38|                FORWARD_IF_ERROR(ZSTD_cwksp_create(ws, neededSpace, zc->customMem), "");
  ------------------
  |  |  146|     38|    do {                                                                           \
  |  |  147|     38|        size_t const err_code = (err);                                             \
  |  |  148|     38|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2174|       |
 2175|     38|                DEBUGLOG(5, "reserving object space");
  ------------------
  |  |  104|     38|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2176|       |                /* Statically sized space.
 2177|       |                 * tmpWorkspace never moves,
 2178|       |                 * though prev/next block swap places */
 2179|     38|                assert(ZSTD_cwksp_check_available(ws, 2 * sizeof(ZSTD_compressedBlockState_t)));
  ------------------
  |  |   70|     38|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2180|     38|                zc->blockState.prevCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t));
 2181|     38|                RETURN_ERROR_IF(zc->blockState.prevCBlock == NULL, memory_allocation, "couldn't allocate prevCBlock");
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2182|     38|                zc->blockState.nextCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t));
 2183|     38|                RETURN_ERROR_IF(zc->blockState.nextCBlock == NULL, memory_allocation, "couldn't allocate nextCBlock");
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2184|     38|                zc->tmpWorkspace = ZSTD_cwksp_reserve_object(ws, TMP_WORKSPACE_SIZE);
  ------------------
  |  |  444|     38|#define TMP_WORKSPACE_SIZE (MAX(ENTROPY_WORKSPACE_SIZE, ZSTD_SLIPBLOCK_WORKSPACESIZE))
  |  |  ------------------
  |  |  |  |   55|     76|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 38, Folded]
  |  |  |  |  |  Branch (55:20): [Folded, False: 38]
  |  |  |  |  |  Branch (55:30): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2185|     38|                RETURN_ERROR_IF(zc->tmpWorkspace == NULL, memory_allocation, "couldn't allocate tmpWorkspace");
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
 2186|     38|                zc->tmpWkspSize = TMP_WORKSPACE_SIZE;
  ------------------
  |  |  444|     38|#define TMP_WORKSPACE_SIZE (MAX(ENTROPY_WORKSPACE_SIZE, ZSTD_SLIPBLOCK_WORKSPACESIZE))
  |  |  ------------------
  |  |  |  |   55|     76|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 38, Folded]
  |  |  |  |  |  Branch (55:20): [Folded, False: 38]
  |  |  |  |  |  Branch (55:30): [Folded, False: 38]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2187|     38|        }   }
 2188|       |
 2189|  5.00k|        ZSTD_cwksp_clear(ws);
 2190|       |
 2191|       |        /* init params */
 2192|  5.00k|        zc->blockState.matchState.cParams = params->cParams;
 2193|  5.00k|        zc->blockState.matchState.prefetchCDictTables = params->prefetchCDictTables == ZSTD_ps_enable;
 2194|  5.00k|        zc->pledgedSrcSizePlusOne = pledgedSrcSize+1;
 2195|  5.00k|        zc->consumedSrcSize = 0;
 2196|  5.00k|        zc->producedCSize = 0;
 2197|  5.00k|        if (pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN)
  ------------------
  |  |  203|  5.00k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (2197:13): [True: 0, False: 5.00k]
  ------------------
 2198|      0|            zc->appliedParams.fParams.contentSizeFlag = 0;
 2199|  5.00k|        DEBUGLOG(4, "pledged content size : %u ; flag : %u",
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2200|  5.00k|            (unsigned)pledgedSrcSize, zc->appliedParams.fParams.contentSizeFlag);
 2201|  5.00k|        zc->blockSizeMax = blockSize;
 2202|       |
 2203|  5.00k|        XXH64_reset(&zc->xxhState, 0);
  ------------------
  |  |  459|  5.00k|#  define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
  |  |  ------------------
  |  |  |  |  443|  5.00k|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|  5.00k|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2204|  5.00k|        zc->stage = ZSTDcs_init;
 2205|  5.00k|        zc->dictID = 0;
 2206|  5.00k|        zc->dictContentSize = 0;
 2207|       |
 2208|  5.00k|        ZSTD_reset_compressedBlockState(zc->blockState.prevCBlock);
 2209|       |
 2210|  5.00k|        FORWARD_IF_ERROR(ZSTD_reset_matchState(
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2211|  5.00k|                &zc->blockState.matchState,
 2212|  5.00k|                ws,
 2213|  5.00k|                &params->cParams,
 2214|  5.00k|                params->useRowMatchFinder,
 2215|  5.00k|                crp,
 2216|  5.00k|                needsIndexReset,
 2217|  5.00k|                ZSTD_resetTarget_CCtx), "");
 2218|       |
 2219|  5.00k|        zc->seqStore.sequencesStart = (SeqDef*)ZSTD_cwksp_reserve_aligned64(ws, maxNbSeq * sizeof(SeqDef));
 2220|       |
 2221|       |        /* ldm hash table */
 2222|  5.00k|        if (params->ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (2222:13): [True: 0, False: 5.00k]
  ------------------
 2223|       |            /* TODO: avoid memset? */
 2224|      0|            size_t const ldmHSize = ((size_t)1) << params->ldmParams.hashLog;
 2225|      0|            zc->ldmState.hashTable = (ldmEntry_t*)ZSTD_cwksp_reserve_aligned64(ws, ldmHSize * sizeof(ldmEntry_t));
 2226|      0|            ZSTD_memset(zc->ldmState.hashTable, 0, ldmHSize * sizeof(ldmEntry_t));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 2227|      0|            zc->ldmSequences = (rawSeq*)ZSTD_cwksp_reserve_aligned64(ws, maxNbLdmSeq * sizeof(rawSeq));
 2228|      0|            zc->maxNbLdmSequences = maxNbLdmSeq;
 2229|       |
 2230|      0|            ZSTD_window_init(&zc->ldmState.window);
 2231|      0|            zc->ldmState.loadedDictEnd = 0;
 2232|      0|        }
 2233|       |
 2234|       |        /* reserve space for block-level external sequences */
 2235|  5.00k|        if (ZSTD_hasExtSeqProd(params)) {
  ------------------
  |  Branch (2235:13): [True: 0, False: 5.00k]
  ------------------
 2236|      0|            size_t const maxNbExternalSeq = ZSTD_sequenceBound(blockSize);
 2237|      0|            zc->extSeqBufCapacity = maxNbExternalSeq;
 2238|      0|            zc->extSeqBuf =
 2239|      0|                (ZSTD_Sequence*)ZSTD_cwksp_reserve_aligned64(ws, maxNbExternalSeq * sizeof(ZSTD_Sequence));
 2240|      0|        }
 2241|       |
 2242|       |        /* buffers */
 2243|       |
 2244|       |        /* ZSTD_wildcopy() is used to copy into the literals buffer,
 2245|       |         * so we have to oversize the buffer by WILDCOPY_OVERLENGTH bytes.
 2246|       |         */
 2247|  5.00k|        zc->seqStore.litStart = ZSTD_cwksp_reserve_buffer(ws, blockSize + WILDCOPY_OVERLENGTH);
  ------------------
  |  |  199|  5.00k|#define WILDCOPY_OVERLENGTH 32
  ------------------
 2248|  5.00k|        zc->seqStore.maxNbLit = blockSize;
 2249|       |
 2250|  5.00k|        zc->bufferedPolicy = zbuff;
 2251|  5.00k|        zc->inBuffSize = buffInSize;
 2252|  5.00k|        zc->inBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffInSize);
 2253|  5.00k|        zc->outBuffSize = buffOutSize;
 2254|  5.00k|        zc->outBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffOutSize);
 2255|       |
 2256|       |        /* ldm bucketOffsets table */
 2257|  5.00k|        if (params->ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (2257:13): [True: 0, False: 5.00k]
  ------------------
 2258|       |            /* TODO: avoid memset? */
 2259|      0|            size_t const numBuckets =
 2260|      0|                  ((size_t)1) << (params->ldmParams.hashLog -
 2261|      0|                                  params->ldmParams.bucketSizeLog);
 2262|      0|            zc->ldmState.bucketOffsets = ZSTD_cwksp_reserve_buffer(ws, numBuckets);
 2263|      0|            ZSTD_memset(zc->ldmState.bucketOffsets, 0, numBuckets);
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 2264|      0|        }
 2265|       |
 2266|       |        /* sequences storage */
 2267|  5.00k|        ZSTD_referenceExternalSequences(zc, NULL, 0);
 2268|  5.00k|        zc->seqStore.maxNbSeq = maxNbSeq;
 2269|  5.00k|        zc->seqStore.llCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE));
 2270|  5.00k|        zc->seqStore.mlCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE));
 2271|  5.00k|        zc->seqStore.ofCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE));
 2272|       |
 2273|  5.00k|        DEBUGLOG(3, "wksp: finished allocating, %zd bytes remain available", ZSTD_cwksp_available_space(ws));
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2274|  5.00k|        assert(ZSTD_cwksp_estimated_space_within_bounds(ws, neededSpace));
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2275|       |
 2276|  5.00k|        zc->initialized = 1;
 2277|       |
 2278|  5.00k|        return 0;
 2279|  5.00k|    }
 2280|  5.00k|}
zstd_compress.c:ZSTD_indexTooCloseToMax:
 2080|  5.00k|{
 2081|  5.00k|    return (size_t)(w.nextSrc - w.base) > (ZSTD_CURRENT_MAX - ZSTD_INDEXOVERFLOW_MARGIN);
  ------------------
  |  | 1031|  5.00k|#define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  ------------------
  |  |  |  |   68|  5.00k|#define MB *(1 <<20)
  |  |  ------------------
  |  |               #define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  ------------------
  |  |  |  |   68|      0|#define MB *(1 <<20)
  |  |  ------------------
  |  |  |  Branch (1031:27): [True: 5.00k, False: 0]
  |  |  ------------------
  ------------------
                  return (size_t)(w.nextSrc - w.base) > (ZSTD_CURRENT_MAX - ZSTD_INDEXOVERFLOW_MARGIN);
  ------------------
  |  | 2078|  5.00k|#define ZSTD_INDEXOVERFLOW_MARGIN (16 MB)
  |  |  ------------------
  |  |  |  |   68|  5.00k|#define MB *(1 <<20)
  |  |  ------------------
  ------------------
 2082|  5.00k|}
zstd_compress.c:ZSTD_dictTooBig:
 2090|  5.00k|{
 2091|  5.00k|    return loadedDictSize > ZSTD_CHUNKSIZE_MAX;
  ------------------
  |  | 1034|  5.00k|    ( ((U32)-1)                  /* Maximum ending current index */            \
  |  | 1035|  5.00k|    - ZSTD_CURRENT_MAX)          /* Maximum beginning lowLimit */
  |  |  ------------------
  |  |  |  | 1031|  5.00k|#define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  |  |  ------------------
  |  |  |  |  |  |   68|  5.00k|#define MB *(1 <<20)
  |  |  |  |  ------------------
  |  |  |  |               #define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  |  |  ------------------
  |  |  |  |  |  |   68|      0|#define MB *(1 <<20)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1031:27): [True: 5.00k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2092|  5.00k|}
zstd_compress.c:ZSTD_reset_matchState:
 1992|  5.00k|{
 1993|       |    /* disable chain table allocation for fast or row-based strategies */
 1994|  5.00k|    size_t const chainSize = ZSTD_allocateChainTable(cParams->strategy, useRowMatchFinder,
  ------------------
  |  Branch (1994:30): [True: 4.49k, False: 505]
  ------------------
 1995|  5.00k|                                                     ms->dedicatedDictSearch && (forWho == ZSTD_resetTarget_CDict))
  ------------------
  |  Branch (1995:54): [True: 0, False: 5.00k]
  |  Branch (1995:81): [True: 0, False: 0]
  ------------------
 1996|  5.00k|                                ? ((size_t)1 << cParams->chainLog)
 1997|  5.00k|                                : 0;
 1998|  5.00k|    size_t const hSize = ((size_t)1) << cParams->hashLog;
 1999|  5.00k|    U32    const hashLog3 = ((forWho == ZSTD_resetTarget_CCtx) && cParams->minMatch==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0;
  ------------------
  |  |   54|  2.48k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 2.48k]
  |  |  ------------------
  ------------------
  |  Branch (1999:30): [True: 5.00k, False: 0]
  |  Branch (1999:67): [True: 2.48k, False: 2.52k]
  ------------------
 2000|  5.00k|    size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0;
  ------------------
  |  Branch (2000:27): [True: 2.48k, False: 2.52k]
  ------------------
 2001|       |
 2002|  5.00k|    DEBUGLOG(4, "reset indices : %u", forceResetIndex == ZSTDirp_reset);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2003|  5.00k|    assert(useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2004|  5.00k|    if (forceResetIndex == ZSTDirp_reset) {
  ------------------
  |  Branch (2004:9): [True: 38, False: 4.96k]
  ------------------
 2005|     38|        ZSTD_window_init(&ms->window);
 2006|     38|        ZSTD_cwksp_mark_tables_dirty(ws);
 2007|     38|    }
 2008|       |
 2009|  5.00k|    ms->hashLog3 = hashLog3;
 2010|  5.00k|    ms->lazySkipping = 0;
 2011|       |
 2012|  5.00k|    ZSTD_invalidateMatchState(ms);
 2013|       |
 2014|  5.00k|    assert(!ZSTD_cwksp_reserve_failed(ws)); /* check that allocation hasn't already failed */
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2015|       |
 2016|  5.00k|    ZSTD_cwksp_clear_tables(ws);
 2017|       |
 2018|  5.00k|    DEBUGLOG(5, "reserving table space");
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2019|       |    /* table Space */
 2020|  5.00k|    ms->hashTable = (U32*)ZSTD_cwksp_reserve_table(ws, hSize * sizeof(U32));
 2021|  5.00k|    ms->chainTable = (U32*)ZSTD_cwksp_reserve_table(ws, chainSize * sizeof(U32));
 2022|  5.00k|    ms->hashTable3 = (U32*)ZSTD_cwksp_reserve_table(ws, h3Size * sizeof(U32));
 2023|  5.00k|    RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation,
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2024|  5.00k|                    "failed a workspace allocation in ZSTD_reset_matchState");
 2025|       |
 2026|  5.00k|    DEBUGLOG(4, "reset table : %u", crp!=ZSTDcrp_leaveDirty);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2027|  5.00k|    if (crp!=ZSTDcrp_leaveDirty) {
  ------------------
  |  Branch (2027:9): [True: 5.00k, False: 0]
  ------------------
 2028|       |        /* reset tables only */
 2029|  5.00k|        ZSTD_cwksp_clean_tables(ws);
 2030|  5.00k|    }
 2031|       |
 2032|  5.00k|    if (ZSTD_rowMatchFinderUsed(cParams->strategy, useRowMatchFinder)) {
  ------------------
  |  Branch (2032:9): [True: 0, False: 5.00k]
  ------------------
 2033|       |        /* Row match finder needs an additional table of hashes ("tags") */
 2034|      0|        size_t const tagTableSize = hSize;
 2035|       |        /* We want to generate a new salt in case we reset a Cctx, but we always want to use
 2036|       |         * 0 when we reset a Cdict */
 2037|      0|        if(forWho == ZSTD_resetTarget_CCtx) {
  ------------------
  |  Branch (2037:12): [True: 0, False: 0]
  ------------------
 2038|      0|            ms->tagTable = (BYTE*) ZSTD_cwksp_reserve_aligned_init_once(ws, tagTableSize);
 2039|      0|            ZSTD_advanceHashSalt(ms);
 2040|      0|        } else {
 2041|       |            /* When we are not salting we want to always memset the memory */
 2042|      0|            ms->tagTable = (BYTE*) ZSTD_cwksp_reserve_aligned64(ws, tagTableSize);
 2043|      0|            ZSTD_memset(ms->tagTable, 0, tagTableSize);
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 2044|      0|            ms->hashSalt = 0;
 2045|      0|        }
 2046|      0|        {   /* Switch to 32-entry rows if searchLog is 5 (or more) */
 2047|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2048|      0|            assert(cParams->hashLog >= rowLog);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2049|      0|            ms->rowHashLog = cParams->hashLog - rowLog;
 2050|      0|        }
 2051|      0|    }
 2052|       |
 2053|       |    /* opt parser space */
 2054|  5.00k|    if ((forWho == ZSTD_resetTarget_CCtx) && (cParams->strategy >= ZSTD_btopt)) {
  ------------------
  |  Branch (2054:9): [True: 5.00k, False: 0]
  |  Branch (2054:46): [True: 2.48k, False: 2.52k]
  ------------------
 2055|  2.48k|        DEBUGLOG(4, "reserving optimal parser space");
  ------------------
  |  |  104|  2.48k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
 2056|  2.48k|        ms->opt.litFreq = (unsigned*)ZSTD_cwksp_reserve_aligned64(ws, (1<<Litbits) * sizeof(unsigned));
  ------------------
  |  |  100|  2.48k|#define Litbits  8
  ------------------
 2057|  2.48k|        ms->opt.litLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned64(ws, (MaxLL+1) * sizeof(unsigned));
  ------------------
  |  |  104|  2.48k|#define MaxLL   35
  ------------------
 2058|  2.48k|        ms->opt.matchLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned64(ws, (MaxML+1) * sizeof(unsigned));
  ------------------
  |  |  103|  2.48k|#define MaxML   52
  ------------------
 2059|  2.48k|        ms->opt.offCodeFreq = (unsigned*)ZSTD_cwksp_reserve_aligned64(ws, (MaxOff+1) * sizeof(unsigned));
  ------------------
  |  |  106|  2.48k|#define MaxOff  31
  ------------------
 2060|  2.48k|        ms->opt.matchTable = (ZSTD_match_t*)ZSTD_cwksp_reserve_aligned64(ws, ZSTD_OPT_SIZE * sizeof(ZSTD_match_t));
  ------------------
  |  |  226|  2.48k|#define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3)
  |  |  ------------------
  |  |  |  |   62|  2.48k|#define ZSTD_OPT_NUM    (1<<12)
  |  |  ------------------
  ------------------
 2061|  2.48k|        ms->opt.priceTable = (ZSTD_optimal_t*)ZSTD_cwksp_reserve_aligned64(ws, ZSTD_OPT_SIZE * sizeof(ZSTD_optimal_t));
  ------------------
  |  |  226|  2.48k|#define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3)
  |  |  ------------------
  |  |  |  |   62|  2.48k|#define ZSTD_OPT_NUM    (1<<12)
  |  |  ------------------
  ------------------
 2062|  2.48k|    }
 2063|       |
 2064|  5.00k|    ms->cParams = *cParams;
 2065|       |
 2066|  5.00k|    RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation,
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 2067|  5.00k|                    "failed a workspace allocation in ZSTD_reset_matchState");
 2068|  5.00k|    return 0;
 2069|  5.00k|}
zstd_compress.c:ZSTD_invalidateMatchState:
 1934|  5.00k|{
 1935|  5.00k|    ZSTD_window_clear(&ms->window);
 1936|       |
 1937|  5.00k|    ms->nextToUpdate = ms->window.dictLimit;
 1938|  5.00k|    ms->loadedDictEnd = 0;
 1939|  5.00k|    ms->opt.litLengthSum = 0;  /* force reset of btopt stats */
 1940|       |    ms->dictMatchState = NULL;
 1941|  5.00k|}
zstd_compress.c:ZSTD_allocateChainTable:
  257|  10.1k|                                   const U32 forDDSDict) {
  258|  10.1k|    assert(useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|  10.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  259|       |    /* We always should allocate a chaintable if we are allocating a matchstate for a DDS dictionary matchstate.
  260|       |     * We do not allocate a chaintable if we are using ZSTD_fast, or are using the row-based matchfinder.
  261|       |     */
  262|  10.1k|    return forDDSDict || ((strategy != ZSTD_fast) && !ZSTD_rowMatchFinderUsed(strategy, useRowMatchFinder));
  ------------------
  |  Branch (262:12): [True: 0, False: 10.1k]
  |  Branch (262:27): [True: 9.12k, False: 1.02k]
  |  Branch (262:54): [True: 9.12k, False: 0]
  ------------------
  263|  10.1k|}
zstd_compress.c:ZSTD_rowMatchFinderUsed:
  232|  29.0k|static int ZSTD_rowMatchFinderUsed(const ZSTD_strategy strategy, const ZSTD_ParamSwitch_e mode) {
  233|  29.0k|    assert(mode != ZSTD_ps_auto);
  ------------------
  |  |   70|  29.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  234|  29.0k|    return ZSTD_rowMatchFinderSupported(strategy) && (mode == ZSTD_ps_enable);
  ------------------
  |  Branch (234:12): [True: 10.6k, False: 18.4k]
  |  Branch (234:54): [True: 1.77k, False: 8.91k]
  ------------------
  235|  29.0k|}
zstd_compress.c:ZSTD_buildSequencesStatistics:
 2769|  3.37k|{
 2770|  3.37k|    BYTE* const ostart = dst;
 2771|  3.37k|    const BYTE* const oend = dstEnd;
 2772|  3.37k|    BYTE* op = ostart;
 2773|  3.37k|    FSE_CTable* CTable_LitLength = nextEntropy->litlengthCTable;
 2774|  3.37k|    FSE_CTable* CTable_OffsetBits = nextEntropy->offcodeCTable;
 2775|  3.37k|    FSE_CTable* CTable_MatchLength = nextEntropy->matchlengthCTable;
 2776|  3.37k|    const BYTE* const ofCodeTable = seqStorePtr->ofCode;
 2777|  3.37k|    const BYTE* const llCodeTable = seqStorePtr->llCode;
 2778|  3.37k|    const BYTE* const mlCodeTable = seqStorePtr->mlCode;
 2779|  3.37k|    ZSTD_symbolEncodingTypeStats_t stats;
 2780|       |
 2781|  3.37k|    stats.lastCountSize = 0;
 2782|       |    /* convert length/distances into codes */
 2783|  3.37k|    stats.longOffsets = ZSTD_seqToCodes(seqStorePtr);
 2784|  3.37k|    assert(op <= oend);
  ------------------
  |  |   70|  3.37k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2785|  3.37k|    assert(nbSeq != 0); /* ZSTD_selectEncodingType() divides by nbSeq */
  ------------------
  |  |   70|  3.37k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2786|       |    /* build CTable for Literal Lengths */
 2787|  3.37k|    {   unsigned max = MaxLL;
  ------------------
  |  |  104|  3.37k|#define MaxLL   35
  ------------------
 2788|  3.37k|        size_t const mostFrequent = HIST_countFast_wksp(countWorkspace, &max, llCodeTable, nbSeq, entropyWorkspace, entropyWkspSize);   /* can't fail */
 2789|  3.37k|        DEBUGLOG(5, "Building LL table");
  ------------------
  |  |  104|  3.37k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.37k]
  |  |  ------------------
  ------------------
 2790|  3.37k|        nextEntropy->litlength_repeatMode = prevEntropy->litlength_repeatMode;
 2791|  3.37k|        stats.LLtype = ZSTD_selectEncodingType(&nextEntropy->litlength_repeatMode,
 2792|  3.37k|                                        countWorkspace, max, mostFrequent, nbSeq,
 2793|  3.37k|                                        LLFSELog, prevEntropy->litlengthCTable,
  ------------------
  |  |  109|  3.37k|#define LLFSELog    9
  ------------------
 2794|  3.37k|                                        LL_defaultNorm, LL_defaultNormLog,
 2795|  3.37k|                                        ZSTD_defaultAllowed, strategy);
 2796|  3.37k|        assert(set_basic < set_compressed && set_rle < set_compressed);
  ------------------
  |  |   70|  3.37k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2797|  3.37k|        assert(!(stats.LLtype < set_compressed && nextEntropy->litlength_repeatMode != FSE_repeat_none)); /* We don't copy tables */
  ------------------
  |  |   70|  3.37k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2798|  3.37k|        {   size_t const countSize = ZSTD_buildCTable(
 2799|  3.37k|                op, (size_t)(oend - op),
 2800|  3.37k|                CTable_LitLength, LLFSELog, (SymbolEncodingType_e)stats.LLtype,
  ------------------
  |  |  109|  3.37k|#define LLFSELog    9
  ------------------
 2801|  3.37k|                countWorkspace, max, llCodeTable, nbSeq,
 2802|  3.37k|                LL_defaultNorm, LL_defaultNormLog, MaxLL,
  ------------------
  |  |  104|  3.37k|#define MaxLL   35
  ------------------
 2803|  3.37k|                prevEntropy->litlengthCTable,
 2804|  3.37k|                sizeof(prevEntropy->litlengthCTable),
 2805|  3.37k|                entropyWorkspace, entropyWkspSize);
 2806|  3.37k|            if (ZSTD_isError(countSize)) {
  ------------------
  |  |   44|  3.37k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2806:17): [True: 0, False: 3.37k]
  ------------------
 2807|      0|                DEBUGLOG(3, "ZSTD_buildCTable for LitLens 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|  3.37k|            if (stats.LLtype == set_compressed)
  ------------------
  |  Branch (2811:17): [True: 40, False: 3.33k]
  ------------------
 2812|     40|                stats.lastCountSize = countSize;
 2813|  3.37k|            op += countSize;
 2814|  3.37k|            assert(op <= oend);
  ------------------
  |  |   70|  3.37k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2815|  3.37k|    }   }
 2816|       |    /* build CTable for Offsets */
 2817|  3.37k|    {   unsigned max = MaxOff;
  ------------------
  |  |  106|  3.37k|#define MaxOff  31
  ------------------
 2818|  3.37k|        size_t const mostFrequent = HIST_countFast_wksp(
 2819|  3.37k|            countWorkspace, &max, ofCodeTable, nbSeq, entropyWorkspace, entropyWkspSize);  /* can't fail */
 2820|       |        /* We can only use the basic table if max <= DefaultMaxOff, otherwise the offsets are too large */
 2821|  3.37k|        ZSTD_DefaultPolicy_e const defaultPolicy = (max <= DefaultMaxOff) ? ZSTD_defaultAllowed : ZSTD_defaultDisallowed;
  ------------------
  |  |  105|  3.37k|#define DefaultMaxOff 28
  ------------------
  |  Branch (2821:52): [True: 3.37k, False: 0]
  ------------------
 2822|  3.37k|        DEBUGLOG(5, "Building OF table");
  ------------------
  |  |  104|  3.37k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.37k]
  |  |  ------------------
  ------------------
 2823|  3.37k|        nextEntropy->offcode_repeatMode = prevEntropy->offcode_repeatMode;
 2824|  3.37k|        stats.Offtype = ZSTD_selectEncodingType(&nextEntropy->offcode_repeatMode,
 2825|  3.37k|                                        countWorkspace, max, mostFrequent, nbSeq,
 2826|  3.37k|                                        OffFSELog, prevEntropy->offcodeCTable,
  ------------------
  |  |  110|  3.37k|#define OffFSELog   8
  ------------------
 2827|  3.37k|                                        OF_defaultNorm, OF_defaultNormLog,
 2828|  3.37k|                                        defaultPolicy, strategy);
 2829|  3.37k|        assert(!(stats.Offtype < set_compressed && nextEntropy->offcode_repeatMode != FSE_repeat_none)); /* We don't copy tables */
  ------------------
  |  |   70|  3.37k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2830|  3.37k|        {   size_t const countSize = ZSTD_buildCTable(
 2831|  3.37k|                op, (size_t)(oend - op),
 2832|  3.37k|                CTable_OffsetBits, OffFSELog, (SymbolEncodingType_e)stats.Offtype,
  ------------------
  |  |  110|  3.37k|#define OffFSELog   8
  ------------------
 2833|  3.37k|                countWorkspace, max, ofCodeTable, nbSeq,
 2834|  3.37k|                OF_defaultNorm, OF_defaultNormLog, DefaultMaxOff,
  ------------------
  |  |  105|  3.37k|#define DefaultMaxOff 28
  ------------------
 2835|  3.37k|                prevEntropy->offcodeCTable,
 2836|  3.37k|                sizeof(prevEntropy->offcodeCTable),
 2837|  3.37k|                entropyWorkspace, entropyWkspSize);
 2838|  3.37k|            if (ZSTD_isError(countSize)) {
  ------------------
  |  |   44|  3.37k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2838:17): [True: 0, False: 3.37k]
  ------------------
 2839|      0|                DEBUGLOG(3, "ZSTD_buildCTable for Offsets failed");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2840|      0|                stats.size = countSize;
 2841|      0|                return stats;
 2842|      0|            }
 2843|  3.37k|            if (stats.Offtype == set_compressed)
  ------------------
  |  Branch (2843:17): [True: 597, False: 2.78k]
  ------------------
 2844|    597|                stats.lastCountSize = countSize;
 2845|  3.37k|            op += countSize;
 2846|  3.37k|            assert(op <= oend);
  ------------------
  |  |   70|  3.37k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2847|  3.37k|    }   }
 2848|       |    /* build CTable for MatchLengths */
 2849|  3.37k|    {   unsigned max = MaxML;
  ------------------
  |  |  103|  3.37k|#define MaxML   52
  ------------------
 2850|  3.37k|        size_t const mostFrequent = HIST_countFast_wksp(
 2851|  3.37k|            countWorkspace, &max, mlCodeTable, nbSeq, entropyWorkspace, entropyWkspSize);   /* can't fail */
 2852|  3.37k|        DEBUGLOG(5, "Building ML table (remaining space : %i)", (int)(oend-op));
  ------------------
  |  |  104|  3.37k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.37k]
  |  |  ------------------
  ------------------
 2853|  3.37k|        nextEntropy->matchlength_repeatMode = prevEntropy->matchlength_repeatMode;
 2854|  3.37k|        stats.MLtype = ZSTD_selectEncodingType(&nextEntropy->matchlength_repeatMode,
 2855|  3.37k|                                        countWorkspace, max, mostFrequent, nbSeq,
 2856|  3.37k|                                        MLFSELog, prevEntropy->matchlengthCTable,
  ------------------
  |  |  108|  3.37k|#define MLFSELog    9
  ------------------
 2857|  3.37k|                                        ML_defaultNorm, ML_defaultNormLog,
 2858|  3.37k|                                        ZSTD_defaultAllowed, strategy);
 2859|  3.37k|        assert(!(stats.MLtype < set_compressed && nextEntropy->matchlength_repeatMode != FSE_repeat_none)); /* We don't copy tables */
  ------------------
  |  |   70|  3.37k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2860|  3.37k|        {   size_t const countSize = ZSTD_buildCTable(
 2861|  3.37k|                op, (size_t)(oend - op),
 2862|  3.37k|                CTable_MatchLength, MLFSELog, (SymbolEncodingType_e)stats.MLtype,
  ------------------
  |  |  108|  3.37k|#define MLFSELog    9
  ------------------
 2863|  3.37k|                countWorkspace, max, mlCodeTable, nbSeq,
 2864|  3.37k|                ML_defaultNorm, ML_defaultNormLog, MaxML,
  ------------------
  |  |  103|  3.37k|#define MaxML   52
  ------------------
 2865|  3.37k|                prevEntropy->matchlengthCTable,
 2866|  3.37k|                sizeof(prevEntropy->matchlengthCTable),
 2867|  3.37k|                entropyWorkspace, entropyWkspSize);
 2868|  3.37k|            if (ZSTD_isError(countSize)) {
  ------------------
  |  |   44|  3.37k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2868:17): [True: 11, False: 3.36k]
  ------------------
 2869|     11|                DEBUGLOG(3, "ZSTD_buildCTable for MatchLengths failed");
  ------------------
  |  |  104|     11|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 11]
  |  |  ------------------
  ------------------
 2870|     11|                stats.size = countSize;
 2871|     11|                return stats;
 2872|     11|            }
 2873|  3.36k|            if (stats.MLtype == set_compressed)
  ------------------
  |  Branch (2873:17): [True: 193, False: 3.17k]
  ------------------
 2874|    193|                stats.lastCountSize = countSize;
 2875|  3.36k|            op += countSize;
 2876|  3.36k|            assert(op <= oend);
  ------------------
  |  |   70|  3.36k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2877|  3.36k|    }   }
 2878|      0|    stats.size = (size_t)(op-ostart);
 2879|  3.36k|    return stats;
 2880|  3.37k|}
zstd_compress.c:ZSTD_compressContinue_internal:
 4796|  5.00k|{
 4797|  5.00k|    ZSTD_MatchState_t* const ms = &cctx->blockState.matchState;
 4798|  5.00k|    size_t fhSize = 0;
 4799|       |
 4800|  5.00k|    DEBUGLOG(5, "ZSTD_compressContinue_internal, stage: %u, srcSize: %u",
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 4801|  5.00k|                cctx->stage, (unsigned)srcSize);
 4802|  5.00k|    RETURN_ERROR_IF(cctx->stage==ZSTDcs_created, stage_wrong,
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 4803|  5.00k|                    "missing init (ZSTD_compressBegin)");
 4804|       |
 4805|  5.00k|    if (frame && (cctx->stage==ZSTDcs_init)) {
  ------------------
  |  Branch (4805:9): [True: 5.00k, False: 0]
  |  Branch (4805:18): [True: 5.00k, False: 0]
  ------------------
 4806|  5.00k|        fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams,
 4807|  5.00k|                                       cctx->pledgedSrcSizePlusOne-1, cctx->dictID);
 4808|  5.00k|        FORWARD_IF_ERROR(fhSize, "ZSTD_writeFrameHeader failed");
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 29, False: 4.97k]
  |  |  ------------------
  |  |  149|     29|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     29|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     29|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     29|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     29|    do {                                           \
  |  |  |  |   99|     29|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     29|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     29|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     29|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     29|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     29|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     29|            return err_code;                                                       \
  |  |  155|     29|        }                                                                          \
  |  |  156|  5.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 4809|  4.97k|        assert(fhSize <= dstCapacity);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4810|  4.97k|        dstCapacity -= fhSize;
 4811|  4.97k|        dst = (char*)dst + fhSize;
 4812|  4.97k|        cctx->stage = ZSTDcs_ongoing;
 4813|  4.97k|    }
 4814|       |
 4815|  4.97k|    if (!srcSize) return fhSize;  /* do not generate an empty block if no input */
  ------------------
  |  Branch (4815:9): [True: 0, False: 4.97k]
  ------------------
 4816|       |
 4817|  4.97k|    if (!ZSTD_window_update(&ms->window, src, srcSize, ms->forceNonContiguous)) {
  ------------------
  |  Branch (4817:9): [True: 4.97k, False: 0]
  ------------------
 4818|  4.97k|        ms->forceNonContiguous = 0;
 4819|  4.97k|        ms->nextToUpdate = ms->window.dictLimit;
 4820|  4.97k|    }
 4821|  4.97k|    if (cctx->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (4821:9): [True: 0, False: 4.97k]
  ------------------
 4822|      0|        ZSTD_window_update(&cctx->ldmState.window, src, srcSize, /* forceNonContiguous */ 0);
 4823|      0|    }
 4824|       |
 4825|  4.97k|    if (!frame) {
  ------------------
  |  Branch (4825:9): [True: 0, False: 4.97k]
  ------------------
 4826|       |        /* overflow check and correction for block mode */
 4827|      0|        ZSTD_overflowCorrectIfNeeded(
 4828|      0|            ms, &cctx->workspace, &cctx->appliedParams,
 4829|      0|            src, (BYTE const*)src + srcSize);
 4830|      0|    }
 4831|       |
 4832|  4.97k|    DEBUGLOG(5, "ZSTD_compressContinue_internal (blockSize=%u)", (unsigned)cctx->blockSizeMax);
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 4833|  4.97k|    {   size_t const cSize = frame ?
  ------------------
  |  Branch (4833:30): [True: 4.97k, False: 0]
  ------------------
 4834|  4.97k|                             ZSTD_compress_frameChunk (cctx, dst, dstCapacity, src, srcSize, lastFrameChunk) :
 4835|  4.97k|                             ZSTD_compressBlock_internal (cctx, dst, dstCapacity, src, srcSize, 0 /* frame */);
 4836|  4.97k|        FORWARD_IF_ERROR(cSize, "%s", frame ? "ZSTD_compress_frameChunk failed" : "ZSTD_compressBlock_internal failed");
  ------------------
  |  |  146|  4.97k|    do {                                                                           \
  |  |  147|  4.97k|        size_t const err_code = (err);                                             \
  |  |  148|  4.97k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 1.81k, False: 3.15k]
  |  |  ------------------
  |  |  149|  1.81k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  1.81k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  1.81k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  1.81k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  1.81k|    do {                                           \
  |  |  |  |   99|  1.81k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (100:38): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.81k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  1.81k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  1.81k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.81k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  1.81k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.81k|            return err_code;                                                       \
  |  |  155|  1.81k|        }                                                                          \
  |  |  156|  4.97k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 4837|  3.15k|        cctx->consumedSrcSize += srcSize;
 4838|  3.15k|        cctx->producedCSize += (cSize + fhSize);
 4839|  3.15k|        assert(!(cctx->appliedParams.fParams.contentSizeFlag && cctx->pledgedSrcSizePlusOne == 0));
  ------------------
  |  |   70|  3.15k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4840|  3.15k|        if (cctx->pledgedSrcSizePlusOne != 0) {  /* control src size */
  ------------------
  |  Branch (4840:13): [True: 3.15k, False: 0]
  ------------------
 4841|  3.15k|            ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN == (unsigned long long)-1);
  ------------------
  |  |   43|  3.15k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  3.15k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 4842|  3.15k|            RETURN_ERROR_IF(
  ------------------
  |  |  114|  3.15k|    do {                                                                       \
  |  |  115|  3.15k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.15k]
  |  |  ------------------
  |  |  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.15k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 4843|  3.15k|                cctx->consumedSrcSize+1 > cctx->pledgedSrcSizePlusOne,
 4844|  3.15k|                srcSize_wrong,
 4845|  3.15k|                "error : pledgedSrcSize = %u, while realSrcSize >= %u",
 4846|  3.15k|                (unsigned)cctx->pledgedSrcSizePlusOne-1,
 4847|  3.15k|                (unsigned)cctx->consumedSrcSize);
 4848|  3.15k|        }
 4849|  3.15k|        return cSize + fhSize;
 4850|  3.15k|    }
 4851|  3.15k|}
zstd_compress.c:ZSTD_overflowCorrectIfNeeded:
 4531|  4.97k|{
 4532|  4.97k|    U32 const cycleLog = ZSTD_cycleLog(params->cParams.chainLog, params->cParams.strategy);
 4533|  4.97k|    U32 const maxDist = (U32)1 << params->cParams.windowLog;
 4534|  4.97k|    if (ZSTD_window_needOverflowCorrection(ms->window, cycleLog, maxDist, ms->loadedDictEnd, ip, iend)) {
  ------------------
  |  Branch (4534:9): [True: 145, False: 4.82k]
  ------------------
 4535|    145|        U32 const correction = ZSTD_window_correctOverflow(&ms->window, cycleLog, maxDist, ip);
 4536|    145|        ZSTD_STATIC_ASSERT(ZSTD_CHAINLOG_MAX <= 30);
  ------------------
  |  |   43|    145|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    145|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 4537|    145|        ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX_32 <= 30);
  ------------------
  |  |   43|    145|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    145|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 4538|    145|        ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX <= 31);
  ------------------
  |  |   43|    145|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    145|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 4539|    145|        ZSTD_cwksp_mark_tables_dirty(ws);
 4540|    145|        ZSTD_reduceIndex(ms, params, correction);
 4541|    145|        ZSTD_cwksp_mark_tables_clean(ws);
 4542|    145|        if (ms->nextToUpdate < correction) ms->nextToUpdate = 0;
  ------------------
  |  Branch (4542:13): [True: 0, False: 145]
  ------------------
 4543|    145|        else ms->nextToUpdate -= correction;
 4544|       |        /* invalidate dictionaries on overflow correction */
 4545|    145|        ms->loadedDictEnd = 0;
 4546|       |        ms->dictMatchState = NULL;
 4547|    145|    }
 4548|  4.97k|}
zstd_compress.c:ZSTD_reduceIndex:
 2667|    145|{
 2668|    145|    {   U32 const hSize = (U32)1 << params->cParams.hashLog;
 2669|    145|        ZSTD_reduceTable(ms->hashTable, hSize, reducerValue);
 2670|    145|    }
 2671|       |
 2672|    145|    if (ZSTD_allocateChainTable(params->cParams.strategy, params->useRowMatchFinder, (U32)ms->dedicatedDictSearch)) {
  ------------------
  |  Branch (2672:9): [True: 131, False: 14]
  ------------------
 2673|    131|        U32 const chainSize = (U32)1 << params->cParams.chainLog;
 2674|    131|        if (params->cParams.strategy == ZSTD_btlazy2)
  ------------------
  |  Branch (2674:13): [True: 4, False: 127]
  ------------------
 2675|      4|            ZSTD_reduceTable_btlazy2(ms->chainTable, chainSize, reducerValue);
 2676|    127|        else
 2677|    127|            ZSTD_reduceTable(ms->chainTable, chainSize, reducerValue);
 2678|    131|    }
 2679|       |
 2680|    145|    if (ms->hashLog3) {
  ------------------
  |  Branch (2680:9): [True: 79, False: 66]
  ------------------
 2681|     79|        U32 const h3Size = (U32)1 << ms->hashLog3;
 2682|     79|        ZSTD_reduceTable(ms->hashTable3, h3Size, reducerValue);
 2683|     79|    }
 2684|    145|}
zstd_compress.c:ZSTD_reduceTable:
 2655|    351|{
 2656|    351|    ZSTD_reduceTable_internal(table, size, reducerValue, 0);
 2657|    351|}
zstd_compress.c:ZSTD_reduceTable_internal:
 2614|    355|{
 2615|    355|    int const nbRows = (int)size / ZSTD_ROWSIZE;
  ------------------
  |  | 2605|    355|#define ZSTD_ROWSIZE 16
  ------------------
 2616|    355|    int cellNb = 0;
 2617|    355|    int rowNb;
 2618|       |    /* Protect special index values < ZSTD_WINDOW_START_INDEX. */
 2619|    355|    U32 const reducerThreshold = reducerValue + ZSTD_WINDOW_START_INDEX;
  ------------------
  |  |  266|    355|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 2620|    355|    assert((size & (ZSTD_ROWSIZE-1)) == 0);  /* multiple of ZSTD_ROWSIZE */
  ------------------
  |  |   70|    355|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2621|    355|    assert(size < (1U<<31));   /* can be cast to int */
  ------------------
  |  |   70|    355|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2622|       |
 2623|       |#if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE)
 2624|       |    /* To validate that the table reuse logic is sound, and that we don't
 2625|       |     * access table space that we haven't cleaned, we re-"poison" the table
 2626|       |     * space every time we mark it dirty.
 2627|       |     *
 2628|       |     * This function however is intended to operate on those dirty tables and
 2629|       |     * re-clean them. So when this function is used correctly, we can unpoison
 2630|       |     * the memory it operated on. This introduces a blind spot though, since
 2631|       |     * if we now try to operate on __actually__ poisoned memory, we will not
 2632|       |     * detect that. */
 2633|       |    __msan_unpoison(table, size * sizeof(U32));
 2634|       |#endif
 2635|       |
 2636|  9.32k|    for (rowNb=0 ; rowNb < nbRows ; rowNb++) {
  ------------------
  |  Branch (2636:20): [True: 8.97k, False: 355]
  ------------------
 2637|  8.97k|        int column;
 2638|   152k|        for (column=0; column<ZSTD_ROWSIZE; column++) {
  ------------------
  |  | 2605|   152k|#define ZSTD_ROWSIZE 16
  ------------------
  |  Branch (2638:24): [True: 143k, False: 8.97k]
  ------------------
 2639|   143k|            U32 newVal;
 2640|   143k|            if (preserveMark && table[cellNb] == ZSTD_DUBT_UNSORTED_MARK) {
  ------------------
  |  |   34|    512|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
  |  Branch (2640:17): [True: 512, False: 143k]
  |  Branch (2640:33): [True: 60, False: 452]
  ------------------
 2641|       |                /* This write is pointless, but is required(?) for the compiler
 2642|       |                 * to auto-vectorize the loop. */
 2643|     60|                newVal = ZSTD_DUBT_UNSORTED_MARK;
  ------------------
  |  |   34|     60|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
 2644|   143k|            } else if (table[cellNb] < reducerThreshold) {
  ------------------
  |  Branch (2644:24): [True: 82.0k, False: 61.4k]
  ------------------
 2645|  82.0k|                newVal = 0;
 2646|  82.0k|            } else {
 2647|  61.4k|                newVal = table[cellNb] - reducerValue;
 2648|  61.4k|            }
 2649|   143k|            table[cellNb] = newVal;
 2650|   143k|            cellNb++;
 2651|   143k|    }   }
 2652|    355|}
zstd_compress.c:ZSTD_reduceTable_btlazy2:
 2660|      4|{
 2661|      4|    ZSTD_reduceTable_internal(table, size, reducerValue, 1);
 2662|      4|}
zstd_compress.c:ZSTD_compress_frameChunk:
 4595|  4.97k|{
 4596|  4.97k|    size_t blockSizeMax = cctx->blockSizeMax;
 4597|  4.97k|    size_t remaining = srcSize;
 4598|  4.97k|    const BYTE* ip = (const BYTE*)src;
 4599|  4.97k|    BYTE* const ostart = (BYTE*)dst;
 4600|  4.97k|    BYTE* op = ostart;
 4601|  4.97k|    U32 const maxDist = (U32)1 << cctx->appliedParams.cParams.windowLog;
 4602|  4.97k|    S64 savings = (S64)cctx->consumedSrcSize - (S64)cctx->producedCSize;
 4603|       |
 4604|  4.97k|    assert(cctx->appliedParams.cParams.windowLog <= ZSTD_WINDOWLOG_MAX);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4605|       |
 4606|  4.97k|    DEBUGLOG(5, "ZSTD_compress_frameChunk (srcSize=%u, blockSizeMax=%u)", (unsigned)srcSize, (unsigned)blockSizeMax);
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 4607|  4.97k|    if (cctx->appliedParams.fParams.checksumFlag && srcSize)
  ------------------
  |  Branch (4607:9): [True: 0, False: 4.97k]
  |  Branch (4607:53): [True: 0, False: 0]
  ------------------
 4608|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4609|       |
 4610|  8.12k|    while (remaining) {
  ------------------
  |  Branch (4610:12): [True: 4.97k, False: 3.15k]
  ------------------
 4611|  4.97k|        ZSTD_MatchState_t* const ms = &cctx->blockState.matchState;
 4612|  4.97k|        size_t const blockSize = ZSTD_optimalBlockSize(cctx,
 4613|  4.97k|                                ip, remaining,
 4614|  4.97k|                                blockSizeMax,
 4615|  4.97k|                                cctx->appliedParams.preBlockSplitter_level,
 4616|  4.97k|                                cctx->appliedParams.cParams.strategy,
 4617|  4.97k|                                savings);
 4618|  4.97k|        U32 const lastBlock = lastFrameChunk & (blockSize == remaining);
 4619|  4.97k|        assert(blockSize <= remaining);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4620|       |
 4621|       |        /* TODO: See 3090. We reduced MIN_CBLOCK_SIZE from 3 to 2 so to compensate we are adding
 4622|       |         * additional 1. We need to revisit and change this logic to be more consistent */
 4623|  4.97k|        RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize + MIN_CBLOCK_SIZE + 1,
  ------------------
  |  |  114|  4.97k|    do {                                                                       \
  |  |  115|  4.97k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.97k]
  |  |  ------------------
  |  |  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.97k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 4624|  4.97k|                        dstSize_tooSmall,
 4625|  4.97k|                        "not enough space to store compressed block");
 4626|       |
 4627|  4.97k|        ZSTD_overflowCorrectIfNeeded(
 4628|  4.97k|            ms, &cctx->workspace, &cctx->appliedParams, ip, ip + blockSize);
 4629|  4.97k|        ZSTD_checkDictValidity(&ms->window, ip + blockSize, maxDist, &ms->loadedDictEnd, &ms->dictMatchState);
 4630|  4.97k|        ZSTD_window_enforceMaxDist(&ms->window, ip, maxDist, &ms->loadedDictEnd, &ms->dictMatchState);
 4631|       |
 4632|       |        /* Ensure hash/chain table insertion resumes no sooner than lowlimit */
 4633|  4.97k|        if (ms->nextToUpdate < ms->window.lowLimit) ms->nextToUpdate = ms->window.lowLimit;
  ------------------
  |  Branch (4633:13): [True: 0, False: 4.97k]
  ------------------
 4634|       |
 4635|  4.97k|        {   size_t cSize;
 4636|  4.97k|            if (ZSTD_useTargetCBlockSize(&cctx->appliedParams)) {
  ------------------
  |  Branch (4636:17): [True: 0, False: 4.97k]
  ------------------
 4637|      0|                cSize = ZSTD_compressBlock_targetCBlockSize(cctx, op, dstCapacity, ip, blockSize, lastBlock);
 4638|      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]
  |  |  ------------------
  ------------------
 4639|      0|                assert(cSize > 0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4640|      0|                assert(cSize <= blockSize + ZSTD_blockHeaderSize);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4641|  4.97k|            } else if (ZSTD_blockSplitterEnabled(&cctx->appliedParams)) {
  ------------------
  |  Branch (4641:24): [True: 0, False: 4.97k]
  ------------------
 4642|      0|                cSize = ZSTD_compressBlock_splitBlock(cctx, op, dstCapacity, ip, blockSize, lastBlock);
 4643|      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]
  |  |  ------------------
  ------------------
 4644|      0|                assert(cSize > 0 || cctx->seqCollector.collectSequences == 1);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4645|  4.97k|            } else {
 4646|  4.97k|                cSize = ZSTD_compressBlock_internal(cctx,
 4647|  4.97k|                                        op+ZSTD_blockHeaderSize, dstCapacity-ZSTD_blockHeaderSize,
 4648|  4.97k|                                        ip, blockSize, 1 /* frame */);
 4649|  4.97k|                FORWARD_IF_ERROR(cSize, "ZSTD_compressBlock_internal failed");
  ------------------
  |  |  146|  4.97k|    do {                                                                           \
  |  |  147|  4.97k|        size_t const err_code = (err);                                             \
  |  |  148|  4.97k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 1.81k, False: 3.15k]
  |  |  ------------------
  |  |  149|  1.81k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  1.81k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  1.81k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  1.81k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  1.81k|    do {                                           \
  |  |  |  |   99|  1.81k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.81k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  1.81k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  1.81k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.81k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  1.81k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.81k|            return err_code;                                                       \
  |  |  155|  1.81k|        }                                                                          \
  |  |  156|  4.97k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 4650|       |
 4651|  3.15k|                if (cSize == 0) {  /* block is not compressible */
  ------------------
  |  Branch (4651:21): [True: 0, False: 3.15k]
  ------------------
 4652|      0|                    cSize = ZSTD_noCompressBlock(op, dstCapacity, ip, blockSize, lastBlock);
 4653|      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]
  |  |  ------------------
  ------------------
 4654|  3.15k|                } else {
 4655|  3.15k|                    U32 const cBlockHeader = cSize == 1 ?
  ------------------
  |  Branch (4655:46): [True: 0, False: 3.15k]
  ------------------
 4656|      0|                        lastBlock + (((U32)bt_rle)<<1) + (U32)(blockSize << 3) :
 4657|  3.15k|                        lastBlock + (((U32)bt_compressed)<<1) + (U32)(cSize << 3);
 4658|  3.15k|                    MEM_writeLE24(op, cBlockHeader);
 4659|  3.15k|                    cSize += ZSTD_blockHeaderSize;
 4660|  3.15k|                }
 4661|  3.15k|            }  /* if (ZSTD_useTargetCBlockSize(&cctx->appliedParams))*/
 4662|       |
 4663|       |            /* @savings is employed to ensure that splitting doesn't worsen expansion of incompressible data.
 4664|       |             * Without splitting, the maximum expansion is 3 bytes per full block.
 4665|       |             * An adversarial input could attempt to fudge the split detector,
 4666|       |             * and make it split incompressible data, resulting in more block headers.
 4667|       |             * Note that, since ZSTD_COMPRESSBOUND() assumes a worst case scenario of 1KB per block,
 4668|       |             * and the splitter never creates blocks that small (current lower limit is 8 KB),
 4669|       |             * there is already no risk to expand beyond ZSTD_COMPRESSBOUND() limit.
 4670|       |             * But if the goal is to not expand by more than 3-bytes per 128 KB full block,
 4671|       |             * then yes, it becomes possible to make the block splitter oversplit incompressible data.
 4672|       |             * Using @savings, we enforce an even more conservative condition,
 4673|       |             * requiring the presence of enough savings (at least 3 bytes) to authorize splitting,
 4674|       |             * otherwise only full blocks are used.
 4675|       |             * But being conservative is fine,
 4676|       |             * since splitting barely compressible blocks is not fruitful anyway */
 4677|  3.15k|            savings += (S64)blockSize - (S64)cSize;
 4678|       |
 4679|  3.15k|            ip += blockSize;
 4680|  3.15k|            assert(remaining >= blockSize);
  ------------------
  |  |   70|  3.15k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4681|  3.15k|            remaining -= blockSize;
 4682|  3.15k|            op += cSize;
 4683|  3.15k|            assert(dstCapacity >= cSize);
  ------------------
  |  |   70|  3.15k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4684|  3.15k|            dstCapacity -= cSize;
 4685|  3.15k|            cctx->isFirstBlock = 0;
 4686|  3.15k|            DEBUGLOG(5, "ZSTD_compress_frameChunk: adding a block of size %u",
  ------------------
  |  |  104|  3.15k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 4687|  3.15k|                        (unsigned)cSize);
 4688|  3.15k|    }   }
 4689|       |
 4690|  3.15k|    if (lastFrameChunk && (op>ostart)) cctx->stage = ZSTDcs_ending;
  ------------------
  |  Branch (4690:9): [True: 3.15k, False: 0]
  |  Branch (4690:27): [True: 3.15k, False: 0]
  ------------------
 4691|  3.15k|    return (size_t)(op-ostart);
 4692|  4.97k|}
zstd_compress.c:ZSTD_optimalBlockSize:
 4553|  4.97k|{
 4554|       |    /* split level based on compression strategy, from `fast` to `btultra2` */
 4555|  4.97k|    static const int splitLevels[] = { 0, 0, 1, 2, 2, 3, 3, 4, 4, 4 };
 4556|       |    /* note: conservatively only split full blocks (128 KB) currently.
 4557|       |     * While it's possible to go lower, let's keep it simple for a first implementation.
 4558|       |     * Besides, benefits of splitting are reduced when blocks are already small.
 4559|       |     */
 4560|  4.97k|    if (srcSize < 128 KB || blockSizeMax < 128 KB)
  ------------------
  |  |   67|  9.94k|#define KB *(1 <<10)
  ------------------
                  if (srcSize < 128 KB || blockSizeMax < 128 KB)
  ------------------
  |  |   67|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (4560:9): [True: 4.97k, False: 0]
  |  Branch (4560:29): [True: 0, False: 0]
  ------------------
 4561|  4.97k|        return MIN(srcSize, blockSizeMax);
  ------------------
  |  |   54|  4.97k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 4.97k]
  |  |  ------------------
  ------------------
 4562|       |    /* do not split incompressible data though:
 4563|       |     * require verified savings to allow pre-splitting.
 4564|       |     * Note: as a consequence, the first full block is not split.
 4565|       |     */
 4566|      0|    if (savings < 3) {
  ------------------
  |  Branch (4566:9): [True: 0, False: 0]
  ------------------
 4567|      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]
  |  |  ------------------
  ------------------
 4568|      0|        return 128 KB;
  ------------------
  |  |   67|      0|#define KB *(1 <<10)
  ------------------
 4569|      0|    }
 4570|       |    /* apply @splitLevel, or use default value (which depends on @strat).
 4571|       |     * note that splitting heuristic is still conditioned by @savings >= 3,
 4572|       |     * so the first block will not reach this code path */
 4573|      0|    if (splitLevel == 1) return 128 KB;
  ------------------
  |  |   67|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (4573:9): [True: 0, False: 0]
  ------------------
 4574|      0|    if (splitLevel == 0) {
  ------------------
  |  Branch (4574:9): [True: 0, False: 0]
  ------------------
 4575|      0|        assert(ZSTD_fast <= strat && strat <= ZSTD_btultra2);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4576|      0|        splitLevel = splitLevels[strat];
 4577|      0|    } else {
 4578|      0|        assert(2 <= splitLevel && splitLevel <= 6);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4579|      0|        splitLevel -= 2;
 4580|      0|    }
 4581|      0|    return ZSTD_splitBlock(src, blockSizeMax, splitLevel, cctx->tmpWorkspace, cctx->tmpWkspSize);
 4582|      0|}
zstd_compress.c:ZSTD_useTargetCBlockSize:
 2726|  4.97k|{
 2727|  4.97k|    DEBUGLOG(5, "ZSTD_useTargetCBlockSize (targetCBlockSize=%zu)", cctxParams->targetCBlockSize);
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 2728|  4.97k|    return (cctxParams->targetCBlockSize != 0);
 2729|  4.97k|}
zstd_compress.c:ZSTD_buildSeqStore:
 3265|  4.97k|{
 3266|  4.97k|    ZSTD_MatchState_t* const ms = &zc->blockState.matchState;
 3267|  4.97k|    DEBUGLOG(5, "ZSTD_buildSeqStore (srcSize=%zu)", srcSize);
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 3268|  4.97k|    assert(srcSize <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3269|       |    /* Assert that we have correctly flushed the ctx params into the ms's copy */
 3270|  4.97k|    ZSTD_assertEqualCParams(zc->appliedParams.cParams, ms->cParams);
 3271|       |    /* TODO: See 3090. We reduced MIN_CBLOCK_SIZE from 3 to 2 so to compensate we are adding
 3272|       |     * additional 1. We need to revisit and change this logic to be more consistent */
 3273|  4.97k|    if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1+1) {
  ------------------
  |  |   91|  4.97k|#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */)   /* for a non-null block */
  ------------------
  |  Branch (3273:9): [True: 0, False: 4.97k]
  ------------------
 3274|      0|        if (zc->appliedParams.cParams.strategy >= ZSTD_btopt) {
  ------------------
  |  Branch (3274:13): [True: 0, False: 0]
  ------------------
 3275|      0|            ZSTD_ldm_skipRawSeqStoreBytes(&zc->externSeqStore, srcSize);
 3276|      0|        } else {
 3277|      0|            ZSTD_ldm_skipSequences(&zc->externSeqStore, srcSize, zc->appliedParams.cParams.minMatch);
 3278|      0|        }
 3279|      0|        return ZSTDbss_noCompress; /* don't even attempt compression below a certain srcSize */
 3280|      0|    }
 3281|  4.97k|    ZSTD_resetSeqStore(&(zc->seqStore));
 3282|       |    /* required for optimal parser to read stats from dictionary */
 3283|  4.97k|    ms->opt.symbolCosts = &zc->blockState.prevCBlock->entropy;
 3284|       |    /* tell the optimal parser how we expect to compress literals */
 3285|  4.97k|    ms->opt.literalCompressionMode = zc->appliedParams.literalCompressionMode;
 3286|       |    /* a gap between an attached dict and the current window is not safe,
 3287|       |     * they must remain adjacent,
 3288|       |     * and when that stops being the case, the dict must be unset */
 3289|  4.97k|    assert(ms->dictMatchState == NULL || ms->loadedDictEnd == ms->window.dictLimit);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3290|       |
 3291|       |    /* limited update after a very long match */
 3292|  4.97k|    {   const BYTE* const base = ms->window.base;
 3293|  4.97k|        const BYTE* const istart = (const BYTE*)src;
 3294|  4.97k|        const U32 curr = (U32)(istart-base);
 3295|  4.97k|        if (sizeof(ptrdiff_t)==8) assert(istart - base < (ptrdiff_t)(U32)(-1));   /* ensure no overflow */
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  |  Branch (3295:13): [True: 4.97k, Folded]
  ------------------
 3296|  4.97k|        if (curr > ms->nextToUpdate + 384)
  ------------------
  |  Branch (3296:13): [True: 0, False: 4.97k]
  ------------------
 3297|      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]
  |  |  ------------------
  ------------------
 3298|  4.97k|    }
 3299|       |
 3300|       |    /* select and store sequences */
 3301|  4.97k|    {   ZSTD_dictMode_e const dictMode = ZSTD_matchState_dictMode(ms);
 3302|  4.97k|        size_t lastLLSize;
 3303|  4.97k|        {   int i;
 3304|  19.8k|            for (i = 0; i < ZSTD_REP_NUM; ++i)
  ------------------
  |  |   64|  19.8k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (3304:25): [True: 14.9k, False: 4.97k]
  ------------------
 3305|  14.9k|                zc->blockState.nextCBlock->rep[i] = zc->blockState.prevCBlock->rep[i];
 3306|  4.97k|        }
 3307|  4.97k|        if (zc->externSeqStore.pos < zc->externSeqStore.size) {
  ------------------
  |  Branch (3307:13): [True: 0, False: 4.97k]
  ------------------
 3308|      0|            assert(zc->appliedParams.ldmParams.enableLdm == ZSTD_ps_disable);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3309|       |
 3310|       |            /* External matchfinder + LDM is technically possible, just not implemented yet.
 3311|       |             * We need to revisit soon and implement it. */
 3312|      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]
  |  |  ------------------
  ------------------
 3313|      0|                ZSTD_hasExtSeqProd(&zc->appliedParams),
 3314|      0|                parameter_combination_unsupported,
 3315|      0|                "Long-distance matching with external sequence producer enabled is not currently supported."
 3316|      0|            );
 3317|       |
 3318|       |            /* Updates ldmSeqStore.pos */
 3319|      0|            lastLLSize =
 3320|      0|                ZSTD_ldm_blockCompress(&zc->externSeqStore,
 3321|      0|                                       ms, &zc->seqStore,
 3322|      0|                                       zc->blockState.nextCBlock->rep,
 3323|      0|                                       zc->appliedParams.useRowMatchFinder,
 3324|      0|                                       src, srcSize);
 3325|      0|            assert(zc->externSeqStore.pos <= zc->externSeqStore.size);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3326|  4.97k|        } else if (zc->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable) {
  ------------------
  |  Branch (3326:20): [True: 0, False: 4.97k]
  ------------------
 3327|      0|            RawSeqStore_t ldmSeqStore = kNullRawSeqStore;
 3328|       |
 3329|       |            /* External matchfinder + LDM is technically possible, just not implemented yet.
 3330|       |             * We need to revisit soon and implement it. */
 3331|      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]
  |  |  ------------------
  ------------------
 3332|      0|                ZSTD_hasExtSeqProd(&zc->appliedParams),
 3333|      0|                parameter_combination_unsupported,
 3334|      0|                "Long-distance matching with external sequence producer enabled is not currently supported."
 3335|      0|            );
 3336|       |
 3337|      0|            ldmSeqStore.seq = zc->ldmSequences;
 3338|      0|            ldmSeqStore.capacity = zc->maxNbLdmSequences;
 3339|       |            /* Updates ldmSeqStore.size */
 3340|      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]
  |  |  ------------------
  ------------------
 3341|      0|                                               &zc->appliedParams.ldmParams,
 3342|      0|                                               src, srcSize), "");
 3343|       |            /* Updates ldmSeqStore.pos */
 3344|      0|            lastLLSize =
 3345|      0|                ZSTD_ldm_blockCompress(&ldmSeqStore,
 3346|      0|                                       ms, &zc->seqStore,
 3347|      0|                                       zc->blockState.nextCBlock->rep,
 3348|      0|                                       zc->appliedParams.useRowMatchFinder,
 3349|      0|                                       src, srcSize);
 3350|      0|            assert(ldmSeqStore.pos == ldmSeqStore.size);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3351|  4.97k|        } else if (ZSTD_hasExtSeqProd(&zc->appliedParams)) {
  ------------------
  |  Branch (3351:20): [True: 0, False: 4.97k]
  ------------------
 3352|      0|            assert(
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3353|      0|                zc->extSeqBufCapacity >= ZSTD_sequenceBound(srcSize)
 3354|      0|            );
 3355|      0|            assert(zc->appliedParams.extSeqProdFunc != NULL);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3356|       |
 3357|      0|            {   U32 const windowSize = (U32)1 << zc->appliedParams.cParams.windowLog;
 3358|       |
 3359|      0|                size_t const nbExternalSeqs = (zc->appliedParams.extSeqProdFunc)(
 3360|      0|                    zc->appliedParams.extSeqProdState,
 3361|      0|                    zc->extSeqBuf,
 3362|      0|                    zc->extSeqBufCapacity,
 3363|      0|                    src, srcSize,
 3364|      0|                    NULL, 0,  /* dict and dictSize, currently not supported */
 3365|      0|                    zc->appliedParams.compressionLevel,
 3366|      0|                    windowSize
 3367|      0|                );
 3368|       |
 3369|      0|                size_t const nbPostProcessedSeqs = ZSTD_postProcessSequenceProducerResult(
 3370|      0|                    zc->extSeqBuf,
 3371|      0|                    nbExternalSeqs,
 3372|      0|                    zc->extSeqBufCapacity,
 3373|      0|                    srcSize
 3374|      0|                );
 3375|       |
 3376|       |                /* Return early if there is no error, since we don't need to worry about last literals */
 3377|      0|                if (!ZSTD_isError(nbPostProcessedSeqs)) {
  ------------------
  |  |   44|      0|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3377:21): [True: 0, False: 0]
  ------------------
 3378|      0|                    ZSTD_SequencePosition seqPos = {0,0,0};
 3379|      0|                    size_t const seqLenSum = ZSTD_fastSequenceLengthSum(zc->extSeqBuf, nbPostProcessedSeqs);
 3380|      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]
  |  |  ------------------
  ------------------
 3381|      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]
  |  |  ------------------
  ------------------
 3382|      0|                        ZSTD_transferSequences_wBlockDelim(
 3383|      0|                            zc, &seqPos,
 3384|      0|                            zc->extSeqBuf, nbPostProcessedSeqs,
 3385|      0|                            src, srcSize,
 3386|      0|                            zc->appliedParams.searchForExternalRepcodes
 3387|      0|                        ),
 3388|      0|                        "Failed to copy external sequences to seqStore!"
 3389|      0|                    );
 3390|      0|                    ms->ldmSeqStore = NULL;
 3391|      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]
  |  |  ------------------
  ------------------
 3392|      0|                    return ZSTDbss_compress;
 3393|      0|                }
 3394|       |
 3395|       |                /* Propagate the error if fallback is disabled */
 3396|      0|                if (!zc->appliedParams.enableMatchFinderFallback) {
  ------------------
  |  Branch (3396:21): [True: 0, False: 0]
  ------------------
 3397|      0|                    return nbPostProcessedSeqs;
 3398|      0|                }
 3399|       |
 3400|       |                /* Fallback to software matchfinder */
 3401|      0|                {   ZSTD_BlockCompressor_f const blockCompressor =
 3402|      0|                        ZSTD_selectBlockCompressor(
 3403|      0|                            zc->appliedParams.cParams.strategy,
 3404|      0|                            zc->appliedParams.useRowMatchFinder,
 3405|      0|                            dictMode);
 3406|      0|                    ms->ldmSeqStore = NULL;
 3407|      0|                    DEBUGLOG(
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3408|      0|                        5,
 3409|      0|                        "External sequence producer returned error code %lu. Falling back to internal parser.",
 3410|      0|                        (unsigned long)nbExternalSeqs
 3411|      0|                    );
 3412|      0|                    lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, src, srcSize);
 3413|      0|            }   }
 3414|  4.97k|        } else {   /* not long range mode and no external matchfinder */
 3415|  4.97k|            ZSTD_BlockCompressor_f const blockCompressor = ZSTD_selectBlockCompressor(
 3416|  4.97k|                    zc->appliedParams.cParams.strategy,
 3417|  4.97k|                    zc->appliedParams.useRowMatchFinder,
 3418|  4.97k|                    dictMode);
 3419|  4.97k|            ms->ldmSeqStore = NULL;
 3420|  4.97k|            lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, src, srcSize);
 3421|  4.97k|        }
 3422|  4.97k|        {   const BYTE* const lastLiterals = (const BYTE*)src + srcSize - lastLLSize;
 3423|  4.97k|            ZSTD_storeLastLiterals(&zc->seqStore, lastLiterals, lastLLSize);
 3424|  4.97k|    }   }
 3425|      0|    ZSTD_validateSeqStore(&zc->seqStore, &zc->appliedParams.cParams);
 3426|  4.97k|    return ZSTDbss_compress;
 3427|  4.97k|}
zstd_compress.c:ZSTD_assertEqualCParams:
 1906|  4.97k|{
 1907|  4.97k|    (void)cParams1;
 1908|  4.97k|    (void)cParams2;
 1909|  4.97k|    assert(cParams1.windowLog    == cParams2.windowLog);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1910|  4.97k|    assert(cParams1.chainLog     == cParams2.chainLog);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1911|  4.97k|    assert(cParams1.hashLog      == cParams2.hashLog);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1912|  4.97k|    assert(cParams1.searchLog    == cParams2.searchLog);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1913|  4.97k|    assert(cParams1.minMatch     == cParams2.minMatch);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1914|  4.97k|    assert(cParams1.targetLength == cParams2.targetLength);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1915|  4.97k|    assert(cParams1.strategy     == cParams2.strategy);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1916|  4.97k|}
zstd_compress.c:ZSTD_storeLastLiterals:
 3156|  4.97k|{
 3157|  4.97k|    ZSTD_memcpy(seqStorePtr->lit, anchor, lastLLSize);
  ------------------
  |  |   44|  4.97k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 3158|  4.97k|    seqStorePtr->lit += lastLLSize;
 3159|  4.97k|}
zstd_compress.c:ZSTD_validateSeqStore:
 3238|  4.97k|{
 3239|       |#if DEBUGLEVEL >= 1
 3240|       |    const SeqDef* seq = seqStore->sequencesStart;
 3241|       |    const SeqDef* const seqEnd = seqStore->sequences;
 3242|       |    size_t const matchLenLowerBound = cParams->minMatch == 3 ? 3 : 4;
 3243|       |    for (; seq < seqEnd; ++seq) {
 3244|       |        const ZSTD_SequenceLength seqLength = ZSTD_getSequenceLength(seqStore, seq);
 3245|       |        assert(seqLength.matchLength >= matchLenLowerBound);
 3246|       |        (void)seqLength;
 3247|       |        (void)matchLenLowerBound;
 3248|       |    }
 3249|       |#else
 3250|  4.97k|    (void)seqStore;
 3251|  4.97k|    (void)cParams;
 3252|  4.97k|#endif
 3253|  4.97k|}
zstd_compress.c:ZSTD_blockState_confirmRepcodesAndEntropyTables:
 3608|  3.15k|{
 3609|  3.15k|    ZSTD_compressedBlockState_t* const tmp = bs->prevCBlock;
 3610|  3.15k|    bs->prevCBlock = bs->nextCBlock;
 3611|  3.15k|    bs->nextCBlock = tmp;
 3612|  3.15k|}
zstd_compress.c:ZSTD_blockSplitterEnabled:
 2737|  4.97k|{
 2738|  4.97k|    DEBUGLOG(5, "ZSTD_blockSplitterEnabled (postBlockSplitter=%d)", cctxParams->postBlockSplitter);
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 2739|  4.97k|    assert(cctxParams->postBlockSplitter != ZSTD_ps_auto);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2740|  4.97k|    return (cctxParams->postBlockSplitter == ZSTD_ps_enable);
 2741|  4.97k|}
zstd_compress.c:ZSTD_entropyCompressSeqStore:
 3054|  4.97k|{
 3055|  4.97k|    return ZSTD_entropyCompressSeqStore_wExtLitBuffer(
 3056|  4.97k|                dst, dstCapacity,
 3057|  4.97k|                seqStorePtr->litStart, (size_t)(seqStorePtr->lit - seqStorePtr->litStart),
 3058|  4.97k|                srcSize,
 3059|  4.97k|                seqStorePtr,
 3060|  4.97k|                prevEntropy, nextEntropy,
 3061|  4.97k|                cctxParams,
 3062|  4.97k|                entropyWorkspace, entropyWkspSize,
 3063|  4.97k|                bmi2);
 3064|  4.97k|}
zstd_compress.c:ZSTD_entropyCompressSeqStore_wExtLitBuffer:
 3016|  4.97k|{
 3017|  4.97k|    size_t const cSize = ZSTD_entropyCompressSeqStore_internal(
 3018|  4.97k|                            dst, dstCapacity,
 3019|  4.97k|                            literals, litSize,
 3020|  4.97k|                            seqStorePtr, prevEntropy, nextEntropy, cctxParams,
 3021|  4.97k|                            entropyWorkspace, entropyWkspSize, bmi2);
 3022|  4.97k|    if (cSize == 0) return 0;
  ------------------
  |  Branch (3022:9): [True: 0, False: 4.97k]
  ------------------
 3023|       |    /* When srcSize <= dstCapacity, there is enough space to write a raw uncompressed block.
 3024|       |     * Since we ran out of space, block must be not compressible, so fall back to raw uncompressed block.
 3025|       |     */
 3026|  4.97k|    if ((cSize == ERROR(dstSize_tooSmall)) & (blockSize <= dstCapacity)) {
  ------------------
  |  |   49|  4.97k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  4.97k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  4.97k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3026:9): [True: 0, False: 4.97k]
  ------------------
 3027|      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]
  |  |  ------------------
  ------------------
 3028|      0|        return 0;  /* block not compressed */
 3029|      0|    }
 3030|  4.97k|    FORWARD_IF_ERROR(cSize, "ZSTD_entropyCompressSeqStore_internal failed");
  ------------------
  |  |  146|  4.97k|    do {                                                                           \
  |  |  147|  4.97k|        size_t const err_code = (err);                                             \
  |  |  148|  4.97k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 1.81k, False: 3.15k]
  |  |  ------------------
  |  |  149|  1.81k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  1.81k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  1.81k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  1.81k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  1.81k|    do {                                           \
  |  |  |  |   99|  1.81k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.81k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  1.81k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  1.81k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.81k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  1.81k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.81k|            return err_code;                                                       \
  |  |  155|  1.81k|        }                                                                          \
  |  |  156|  4.97k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 3031|       |
 3032|       |    /* Check compressibility */
 3033|  3.15k|    {   size_t const maxCSize = blockSize - ZSTD_minGain(blockSize, cctxParams->cParams.strategy);
 3034|  3.15k|        if (cSize >= maxCSize) return 0;  /* block not compressed */
  ------------------
  |  Branch (3034:13): [True: 0, False: 3.15k]
  ------------------
 3035|  3.15k|    }
 3036|  3.15k|    DEBUGLOG(5, "ZSTD_entropyCompressSeqStore() cSize: %zu", cSize);
  ------------------
  |  |  104|  3.15k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 3037|       |    /* libzstd decoder before  > v1.5.4 is not compatible with compressed blocks of size ZSTD_BLOCKSIZE_MAX exactly.
 3038|       |     * This restriction is indirectly already fulfilled by respecting ZSTD_minGain() condition above.
 3039|       |     */
 3040|  3.15k|    assert(cSize < ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  3.15k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 3041|  3.15k|    return cSize;
 3042|  3.15k|}
zstd_compress.c:ZSTD_entropyCompressSeqStore_internal:
 2897|  4.97k|{
 2898|  4.97k|    ZSTD_strategy const strategy = cctxParams->cParams.strategy;
 2899|  4.97k|    unsigned* count = (unsigned*)entropyWorkspace;
 2900|  4.97k|    FSE_CTable* CTable_LitLength = nextEntropy->fse.litlengthCTable;
 2901|  4.97k|    FSE_CTable* CTable_OffsetBits = nextEntropy->fse.offcodeCTable;
 2902|  4.97k|    FSE_CTable* CTable_MatchLength = nextEntropy->fse.matchlengthCTable;
 2903|  4.97k|    const SeqDef* const sequences = seqStorePtr->sequencesStart;
 2904|  4.97k|    const size_t nbSeq = (size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
 2905|  4.97k|    const BYTE* const ofCodeTable = seqStorePtr->ofCode;
 2906|  4.97k|    const BYTE* const llCodeTable = seqStorePtr->llCode;
 2907|  4.97k|    const BYTE* const mlCodeTable = seqStorePtr->mlCode;
 2908|  4.97k|    BYTE* const ostart = (BYTE*)dst;
 2909|  4.97k|    BYTE* const oend = ostart + dstCapacity;
 2910|  4.97k|    BYTE* op = ostart;
 2911|  4.97k|    size_t lastCountSize;
 2912|  4.97k|    int longOffsets = 0;
 2913|       |
 2914|  4.97k|    entropyWorkspace = count + (MaxSeq + 1);
  ------------------
  |  |  107|  4.97k|#define MaxSeq MAX(MaxLL, MaxML)   /* Assumption : MaxOff < MaxLL,MaxML */
  |  |  ------------------
  |  |  |  |   55|  4.97k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [Folded, False: 4.97k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2915|  4.97k|    entropyWkspSize -= (MaxSeq + 1) * sizeof(*count);
  ------------------
  |  |  107|  4.97k|#define MaxSeq MAX(MaxLL, MaxML)   /* Assumption : MaxOff < MaxLL,MaxML */
  |  |  ------------------
  |  |  |  |   55|  4.97k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [Folded, False: 4.97k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2916|       |
 2917|  4.97k|    DEBUGLOG(5, "ZSTD_entropyCompressSeqStore_internal (nbSeq=%zu, dstCapacity=%zu)", nbSeq, dstCapacity);
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 2918|  4.97k|    ZSTD_STATIC_ASSERT(HUF_WORKSPACE_SIZE >= (1<<MAX(MLFSELog,LLFSELog)));
  ------------------
  |  |   43|  4.97k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  4.97k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 2919|  4.97k|    assert(entropyWkspSize >= HUF_WORKSPACE_SIZE);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2920|       |
 2921|       |    /* Compress literals */
 2922|  4.97k|    {   size_t const numSequences = (size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
 2923|       |        /* Base suspicion of uncompressibility on ratio of literals to sequences */
 2924|  4.97k|        int const suspectUncompressible = (numSequences == 0) || (litSize / numSequences >= SUSPECT_UNCOMPRESSIBLE_LITERAL_RATIO);
  ------------------
  |  | 2886|  4.23k|#define SUSPECT_UNCOMPRESSIBLE_LITERAL_RATIO 20
  ------------------
  |  Branch (2924:43): [True: 739, False: 4.23k]
  |  Branch (2924:66): [True: 2.12k, False: 2.11k]
  ------------------
 2925|       |
 2926|  4.97k|        size_t const cSize = ZSTD_compressLiterals(
 2927|  4.97k|                                    op, dstCapacity,
 2928|  4.97k|                                    literals, litSize,
 2929|  4.97k|                                    entropyWorkspace, entropyWkspSize,
 2930|  4.97k|                                    &prevEntropy->huf, &nextEntropy->huf,
 2931|  4.97k|                                    cctxParams->cParams.strategy,
 2932|  4.97k|                                    ZSTD_literalsCompressionIsDisabled(cctxParams),
 2933|  4.97k|                                    suspectUncompressible, bmi2);
 2934|  4.97k|        FORWARD_IF_ERROR(cSize, "ZSTD_compressLiterals failed");
  ------------------
  |  |  146|  4.97k|    do {                                                                           \
  |  |  147|  4.97k|        size_t const err_code = (err);                                             \
  |  |  148|  4.97k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 1.06k, False: 3.90k]
  |  |  ------------------
  |  |  149|  1.06k|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|  1.06k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|  1.06k|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|  1.06k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|  1.06k|    do {                                           \
  |  |  |  |   99|  1.06k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.06k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  1.06k|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|  1.06k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  1.06k|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|  1.06k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  1.06k|            return err_code;                                                       \
  |  |  155|  1.06k|        }                                                                          \
  |  |  156|  4.97k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 2935|  3.90k|        assert(cSize <= dstCapacity);
  ------------------
  |  |   70|  3.90k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2936|  3.90k|        op += cSize;
 2937|  3.90k|    }
 2938|       |
 2939|       |    /* Sequences Header */
 2940|  3.90k|    RETURN_ERROR_IF((oend-op) < 3 /*max nbSeq Size*/ + 1 /*seqHead*/,
  ------------------
  |  |  114|  3.90k|    do {                                                                       \
  |  |  115|  3.90k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 160, False: 3.74k]
  |  |  ------------------
  |  |  116|    160|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    160|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 160]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    160|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    160|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    160|    do {                                           \
  |  |  |  |   99|    160|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 160]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    160|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 160]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    160|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    160|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 160]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    160|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    160|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 160]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    160|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    160|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    160|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    160|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    160|        }                                                                      \
  |  |  123|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.74k]
  |  |  ------------------
  ------------------
 2941|  3.90k|                    dstSize_tooSmall, "Can't fit seq hdr in output buf!");
 2942|  3.74k|    if (nbSeq < 128) {
  ------------------
  |  Branch (2942:9): [True: 3.74k, False: 0]
  ------------------
 2943|  3.74k|        *op++ = (BYTE)nbSeq;
 2944|  3.74k|    } else if (nbSeq < LONGNBSEQ) {
  ------------------
  |  |   96|      0|#define LONGNBSEQ 0x7F00
  ------------------
  |  Branch (2944:16): [True: 0, False: 0]
  ------------------
 2945|      0|        op[0] = (BYTE)((nbSeq>>8) + 0x80);
 2946|      0|        op[1] = (BYTE)nbSeq;
 2947|      0|        op+=2;
 2948|      0|    } else {
 2949|      0|        op[0]=0xFF;
 2950|      0|        MEM_writeLE16(op+1, (U16)(nbSeq - LONGNBSEQ));
  ------------------
  |  |   96|      0|#define LONGNBSEQ 0x7F00
  ------------------
 2951|      0|        op+=3;
 2952|      0|    }
 2953|  3.74k|    assert(op <= oend);
  ------------------
  |  |   70|  3.74k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2954|  3.74k|    if (nbSeq==0) {
  ------------------
  |  Branch (2954:9): [True: 370, False: 3.37k]
  ------------------
 2955|       |        /* Copy the old tables over as if we repeated them */
 2956|    370|        ZSTD_memcpy(&nextEntropy->fse, &prevEntropy->fse, sizeof(prevEntropy->fse));
  ------------------
  |  |   44|    370|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 2957|    370|        return (size_t)(op - ostart);
 2958|    370|    }
 2959|  3.37k|    {   BYTE* const seqHead = op++;
 2960|       |        /* build stats for sequences */
 2961|  3.37k|        const ZSTD_symbolEncodingTypeStats_t stats =
 2962|  3.37k|                ZSTD_buildSequencesStatistics(seqStorePtr, nbSeq,
 2963|  3.37k|                                             &prevEntropy->fse, &nextEntropy->fse,
 2964|  3.37k|                                              op, oend,
 2965|  3.37k|                                              strategy, count,
 2966|  3.37k|                                              entropyWorkspace, entropyWkspSize);
 2967|  3.37k|        FORWARD_IF_ERROR(stats.size, "ZSTD_buildSequencesStatistics failed!");
  ------------------
  |  |  146|  3.37k|    do {                                                                           \
  |  |  147|  3.37k|        size_t const err_code = (err);                                             \
  |  |  148|  3.37k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 11, False: 3.36k]
  |  |  ------------------
  |  |  149|     11|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     11|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     11|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     11|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     11|    do {                                           \
  |  |  |  |   99|     11|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     11|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     11|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     11|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     11|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     11|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     11|            return err_code;                                                       \
  |  |  155|     11|        }                                                                          \
  |  |  156|  3.37k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 3.36k]
  |  |  ------------------
  ------------------
 2968|  3.36k|        *seqHead = (BYTE)((stats.LLtype<<6) + (stats.Offtype<<4) + (stats.MLtype<<2));
 2969|  3.36k|        lastCountSize = stats.lastCountSize;
 2970|  3.36k|        op += stats.size;
 2971|  3.36k|        longOffsets = stats.longOffsets;
 2972|  3.36k|    }
 2973|       |
 2974|      0|    {   size_t const bitstreamSize = ZSTD_encodeSequences(
 2975|  3.36k|                                        op, (size_t)(oend - op),
 2976|  3.36k|                                        CTable_MatchLength, mlCodeTable,
 2977|  3.36k|                                        CTable_OffsetBits, ofCodeTable,
 2978|  3.36k|                                        CTable_LitLength, llCodeTable,
 2979|  3.36k|                                        sequences, nbSeq,
 2980|  3.36k|                                        longOffsets, bmi2);
 2981|  3.36k|        FORWARD_IF_ERROR(bitstreamSize, "ZSTD_encodeSequences failed");
  ------------------
  |  |  146|  3.36k|    do {                                                                           \
  |  |  147|  3.36k|        size_t const err_code = (err);                                             \
  |  |  148|  3.36k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 581, False: 2.78k]
  |  |  ------------------
  |  |  149|    581|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|    581|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 581]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|    581|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|    581|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|    581|    do {                                           \
  |  |  |  |   99|    581|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 581]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    581|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 581]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|    581|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|    581|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 581]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|    581|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|    581|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 581]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|    581|            return err_code;                                                       \
  |  |  155|    581|        }                                                                          \
  |  |  156|  3.36k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 2.78k]
  |  |  ------------------
  ------------------
 2982|  2.78k|        op += bitstreamSize;
 2983|  2.78k|        assert(op <= oend);
  ------------------
  |  |   70|  2.78k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2984|       |        /* zstd versions <= 1.3.4 mistakenly report corruption when
 2985|       |         * FSE_readNCount() receives a buffer < 4 bytes.
 2986|       |         * Fixed by https://github.com/facebook/zstd/pull/1146.
 2987|       |         * This can happen when the last set_compressed table present is 2
 2988|       |         * bytes and the bitstream is only one byte.
 2989|       |         * In this exceedingly rare case, we will simply emit an uncompressed
 2990|       |         * block, since it isn't worth optimizing.
 2991|       |         */
 2992|  2.78k|        if (lastCountSize && (lastCountSize + bitstreamSize) < 4) {
  ------------------
  |  Branch (2992:13): [True: 633, False: 2.15k]
  |  Branch (2992:30): [True: 0, False: 633]
  ------------------
 2993|       |            /* lastCountSize >= 2 && bitstreamSize > 0 ==> lastCountSize == 3 */
 2994|      0|            assert(lastCountSize + bitstreamSize == 3);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2995|      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]
  |  |  ------------------
  ------------------
 2996|      0|                        "emitting an uncompressed block.");
 2997|      0|            return 0;
 2998|      0|        }
 2999|  2.78k|    }
 3000|       |
 3001|  2.78k|    DEBUGLOG(5, "compressed block size : %u", (unsigned)(op - ostart));
  ------------------
  |  |  104|  2.78k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.78k]
  |  |  ------------------
  ------------------
 3002|  2.78k|    return (size_t)(op - ostart);
 3003|  2.78k|}
zstd_compress.c:ZSTD_compressBlock_internal:
 4386|  4.97k|{
 4387|       |    /* This is an estimated upper bound for the length of an rle block.
 4388|       |     * This isn't the actual upper bound.
 4389|       |     * Finding the real threshold needs further investigation.
 4390|       |     */
 4391|  4.97k|    const U32 rleMaxLength = 25;
 4392|  4.97k|    size_t cSize;
 4393|  4.97k|    const BYTE* ip = (const BYTE*)src;
 4394|  4.97k|    BYTE* op = (BYTE*)dst;
 4395|  4.97k|    DEBUGLOG(5, "ZSTD_compressBlock_internal (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u)",
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 4396|  4.97k|                (unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit,
 4397|  4.97k|                (unsigned)zc->blockState.matchState.nextToUpdate);
 4398|       |
 4399|  4.97k|    {   const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize);
 4400|  4.97k|        FORWARD_IF_ERROR(bss, "ZSTD_buildSeqStore failed");
  ------------------
  |  |  146|  4.97k|    do {                                                                           \
  |  |  147|  4.97k|        size_t const err_code = (err);                                             \
  |  |  148|  4.97k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 4.97k]
  |  |  ------------------
  |  |  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.97k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 4401|  4.97k|        if (bss == ZSTDbss_noCompress) {
  ------------------
  |  Branch (4401:13): [True: 0, False: 4.97k]
  ------------------
 4402|      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]
  |  |  ------------------
  ------------------
 4403|      0|            cSize = 0;
 4404|      0|            goto out;
 4405|      0|        }
 4406|  4.97k|    }
 4407|       |
 4408|  4.97k|    if (zc->seqCollector.collectSequences) {
  ------------------
  |  Branch (4408:9): [True: 0, False: 4.97k]
  ------------------
 4409|      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]
  |  |  ------------------
  ------------------
 4410|      0|        ZSTD_blockState_confirmRepcodesAndEntropyTables(&zc->blockState);
 4411|      0|        return 0;
 4412|      0|    }
 4413|       |
 4414|       |    /* encode sequences and literals */
 4415|  4.97k|    cSize = ZSTD_entropyCompressSeqStore(&zc->seqStore,
 4416|  4.97k|            &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy,
 4417|  4.97k|            &zc->appliedParams,
 4418|  4.97k|            dst, dstCapacity,
 4419|  4.97k|            srcSize,
 4420|  4.97k|            zc->tmpWorkspace, zc->tmpWkspSize /* statically allocated in resetCCtx */,
 4421|  4.97k|            zc->bmi2);
 4422|       |
 4423|  4.97k|    if (frame &&
  ------------------
  |  Branch (4423:9): [True: 4.97k, False: 0]
  ------------------
 4424|       |        /* We don't want to emit our first block as a RLE even if it qualifies because
 4425|       |         * doing so will cause the decoder (cli only) to throw a "should consume all input error."
 4426|       |         * This is only an issue for zstd <= v1.4.3
 4427|       |         */
 4428|  4.97k|        !zc->isFirstBlock &&
  ------------------
  |  Branch (4428:9): [True: 0, False: 4.97k]
  ------------------
 4429|      0|        cSize < rleMaxLength &&
  ------------------
  |  Branch (4429:9): [True: 0, False: 0]
  ------------------
 4430|      0|        ZSTD_isRLE(ip, srcSize))
  ------------------
  |  Branch (4430:9): [True: 0, False: 0]
  ------------------
 4431|      0|    {
 4432|      0|        cSize = 1;
 4433|      0|        op[0] = ip[0];
 4434|      0|    }
 4435|       |
 4436|  4.97k|out:
 4437|  4.97k|    if (!ZSTD_isError(cSize) && cSize > 1) {
  ------------------
  |  |   44|  4.97k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (4437:9): [True: 3.15k, False: 1.81k]
  |  Branch (4437:33): [True: 3.15k, False: 0]
  ------------------
 4438|  3.15k|        ZSTD_blockState_confirmRepcodesAndEntropyTables(&zc->blockState);
 4439|  3.15k|    }
 4440|       |    /* We check that dictionaries have offset codes available for the first
 4441|       |     * block. After the first block, the offcode table might not have large
 4442|       |     * enough codes to represent the offsets in the data.
 4443|       |     */
 4444|  4.97k|    if (zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode == FSE_repeat_valid)
  ------------------
  |  Branch (4444:9): [True: 0, False: 4.97k]
  ------------------
 4445|      0|        zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode = FSE_repeat_check;
 4446|       |
 4447|  4.97k|    return cSize;
 4448|  4.97k|}
zstd_compress.c:ZSTD_compressBegin_internal:
 5245|  5.00k|{
 5246|  5.00k|    size_t const dictContentSize = cdict ? cdict->dictContentSize : dictSize;
  ------------------
  |  Branch (5246:36): [True: 0, False: 5.00k]
  ------------------
 5247|  5.00k|#if ZSTD_TRACE
 5248|  5.00k|    cctx->traceCtx = (ZSTD_trace_compress_begin != NULL) ? ZSTD_trace_compress_begin(cctx) : 0;
  ------------------
  |  Branch (5248:22): [True: 0, False: 5.00k]
  ------------------
 5249|  5.00k|#endif
 5250|  5.00k|    DEBUGLOG(4, "ZSTD_compressBegin_internal: wlog=%u", params->cParams.windowLog);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 5251|       |    /* params are supposed to be fully validated at this point */
 5252|  5.00k|    assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams)));
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5253|  5.00k|    assert(!((dict) && (cdict)));  /* either dict or cdict, not both */
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5254|  5.00k|    if ( (cdict)
  ------------------
  |  Branch (5254:10): [True: 0, False: 5.00k]
  ------------------
 5255|      0|      && (cdict->dictContentSize > 0)
  ------------------
  |  Branch (5255:10): [True: 0, False: 0]
  ------------------
 5256|      0|      && ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF
  ------------------
  |  | 5232|      0|#define ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF (128 KB)
  |  |  ------------------
  |  |  |  |   67|      0|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
  |  Branch (5256:12): [True: 0, False: 0]
  ------------------
 5257|      0|        || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER
  ------------------
  |  | 5233|      0|#define ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER (6ULL)
  ------------------
  |  Branch (5257:12): [True: 0, False: 0]
  ------------------
 5258|      0|        || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN
  ------------------
  |  |  203|      0|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (5258:12): [True: 0, False: 0]
  ------------------
 5259|      0|        || cdict->compressionLevel == 0)
  ------------------
  |  Branch (5259:12): [True: 0, False: 0]
  ------------------
 5260|      0|      && (params->attachDictPref != ZSTD_dictForceLoad) ) {
  ------------------
  |  Branch (5260:10): [True: 0, False: 0]
  ------------------
 5261|      0|        return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff);
 5262|      0|    }
 5263|       |
 5264|  5.00k|    FORWARD_IF_ERROR( ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize,
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 5265|  5.00k|                                     dictContentSize,
 5266|  5.00k|                                     ZSTDcrp_makeClean, zbuff) , "");
 5267|  5.00k|    {   size_t const dictID = cdict ?
  ------------------
  |  Branch (5267:31): [True: 0, False: 5.00k]
  ------------------
 5268|      0|                ZSTD_compress_insertDictionary(
 5269|      0|                        cctx->blockState.prevCBlock, &cctx->blockState.matchState,
 5270|      0|                        &cctx->ldmState, &cctx->workspace, &cctx->appliedParams, cdict->dictContent,
 5271|      0|                        cdict->dictContentSize, cdict->dictContentType, dtlm,
 5272|      0|                        ZSTD_tfp_forCCtx, cctx->tmpWorkspace)
 5273|  5.00k|              : ZSTD_compress_insertDictionary(
 5274|  5.00k|                        cctx->blockState.prevCBlock, &cctx->blockState.matchState,
 5275|  5.00k|                        &cctx->ldmState, &cctx->workspace, &cctx->appliedParams, dict, dictSize,
 5276|  5.00k|                        dictContentType, dtlm, ZSTD_tfp_forCCtx, cctx->tmpWorkspace);
 5277|  5.00k|        FORWARD_IF_ERROR(dictID, "ZSTD_compress_insertDictionary failed");
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 5278|  5.00k|        assert(dictID <= UINT_MAX);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5279|  5.00k|        cctx->dictID = (U32)dictID;
 5280|  5.00k|        cctx->dictContentSize = dictContentSize;
 5281|  5.00k|    }
 5282|      0|    return 0;
 5283|  5.00k|}
zstd_compress.c:ZSTD_compress_insertDictionary:
 5204|  5.00k|{
 5205|  5.00k|    DEBUGLOG(4, "ZSTD_compress_insertDictionary (dictSize=%u)", (U32)dictSize);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 5206|  5.00k|    if ((dict==NULL) || (dictSize<8)) {
  ------------------
  |  Branch (5206:9): [True: 5.00k, False: 0]
  |  Branch (5206:25): [True: 0, False: 0]
  ------------------
 5207|  5.00k|        RETURN_ERROR_IF(dictContentType == ZSTD_dct_fullDict, dictionary_wrong, "");
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 5208|  5.00k|        return 0;
 5209|  5.00k|    }
 5210|       |
 5211|      0|    ZSTD_reset_compressedBlockState(bs);
 5212|       |
 5213|       |    /* dict restricted modes */
 5214|      0|    if (dictContentType == ZSTD_dct_rawContent)
  ------------------
  |  Branch (5214:9): [True: 0, False: 0]
  ------------------
 5215|      0|        return ZSTD_loadDictionaryContent(ms, ls, ws, params, dict, dictSize, dtlm, tfp);
 5216|       |
 5217|      0|    if (MEM_readLE32(dict) != ZSTD_MAGIC_DICTIONARY) {
  ------------------
  |  |  143|      0|#define ZSTD_MAGIC_DICTIONARY       0xEC30A437    /* valid since v0.7.0 */
  ------------------
  |  Branch (5217:9): [True: 0, False: 0]
  ------------------
 5218|      0|        if (dictContentType == ZSTD_dct_auto) {
  ------------------
  |  Branch (5218:13): [True: 0, False: 0]
  ------------------
 5219|      0|            DEBUGLOG(4, "raw content dictionary detected");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5220|      0|            return ZSTD_loadDictionaryContent(
 5221|      0|                ms, ls, ws, params, dict, dictSize, dtlm, tfp);
 5222|      0|        }
 5223|      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]
  |  |  ------------------
  ------------------
 5224|      0|        assert(0);   /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 5225|      0|    }
 5226|       |
 5227|       |    /* dict as full zstd dictionary */
 5228|      0|    return ZSTD_loadZstdDictionary(
 5229|      0|        bs, ms, ws, params, dict, dictSize, dtlm, tfp, workspace);
 5230|      0|}
zstd_compress.c:ZSTD_writeEpilogue:
 5345|  3.15k|{
 5346|  3.15k|    BYTE* const ostart = (BYTE*)dst;
 5347|  3.15k|    BYTE* op = ostart;
 5348|       |
 5349|  3.15k|    DEBUGLOG(4, "ZSTD_writeEpilogue");
  ------------------
  |  |  104|  3.15k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 5350|  3.15k|    RETURN_ERROR_IF(cctx->stage == ZSTDcs_created, stage_wrong, "init missing");
  ------------------
  |  |  114|  3.15k|    do {                                                                       \
  |  |  115|  3.15k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.15k]
  |  |  ------------------
  |  |  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.15k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.15k]
  |  |  ------------------
  ------------------
 5351|       |
 5352|       |    /* special case : empty frame */
 5353|  3.15k|    if (cctx->stage == ZSTDcs_init) {
  ------------------
  |  Branch (5353:9): [True: 0, False: 3.15k]
  ------------------
 5354|      0|        size_t fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams, 0, 0);
 5355|      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]
  |  |  ------------------
  ------------------
 5356|      0|        dstCapacity -= fhSize;
 5357|      0|        op += fhSize;
 5358|      0|        cctx->stage = ZSTDcs_ongoing;
 5359|      0|    }
 5360|       |
 5361|  3.15k|    if (cctx->stage != ZSTDcs_ending) {
  ------------------
  |  Branch (5361:9): [True: 0, False: 3.15k]
  ------------------
 5362|       |        /* write one last empty block, make it the "last" block */
 5363|      0|        U32 const cBlockHeader24 = 1 /* last block */ + (((U32)bt_raw)<<1) + 0;
 5364|      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])
  |  |  ------------------
  ------------------
 5365|      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]
  |  |  ------------------
  ------------------
 5366|      0|        MEM_writeLE24(op, cBlockHeader24);
 5367|      0|        op += ZSTD_blockHeaderSize;
 5368|      0|        dstCapacity -= ZSTD_blockHeaderSize;
 5369|      0|    }
 5370|       |
 5371|  3.15k|    if (cctx->appliedParams.fParams.checksumFlag) {
  ------------------
  |  Branch (5371:9): [True: 0, False: 3.15k]
  ------------------
 5372|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5373|      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]
  |  |  ------------------
  ------------------
 5374|      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]
  |  |  ------------------
  ------------------
 5375|      0|        MEM_writeLE32(op, checksum);
 5376|      0|        op += 4;
 5377|      0|    }
 5378|       |
 5379|  3.15k|    cctx->stage = ZSTDcs_created;  /* return to "created but no init" status */
 5380|  3.15k|    return (size_t)(op-ostart);
 5381|  3.15k|}
zstd_compress.c:ZSTD_sizeof_matchState:
 1658|  5.00k|{
 1659|       |    /* chain table size should be 0 for fast or row-hash strategies */
 1660|  5.00k|    size_t const chainSize = ZSTD_allocateChainTable(cParams->strategy, useRowMatchFinder, enableDedicatedDictSearch && !forCCtx)
  ------------------
  |  Branch (1660:30): [True: 4.49k, False: 505]
  |  Branch (1660:92): [True: 0, False: 5.00k]
  |  Branch (1660:121): [True: 0, False: 0]
  ------------------
 1661|  5.00k|                                ? ((size_t)1 << cParams->chainLog)
 1662|  5.00k|                                : 0;
 1663|  5.00k|    size_t const hSize = ((size_t)1) << cParams->hashLog;
 1664|  5.00k|    U32    const hashLog3 = (forCCtx && cParams->minMatch==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0;
  ------------------
  |  |   54|  2.48k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 2.48k]
  |  |  ------------------
  ------------------
  |  Branch (1664:30): [True: 5.00k, False: 0]
  |  Branch (1664:41): [True: 2.48k, False: 2.52k]
  ------------------
 1665|  5.00k|    size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0;
  ------------------
  |  Branch (1665:27): [True: 2.48k, False: 2.52k]
  ------------------
 1666|       |    /* We don't use ZSTD_cwksp_alloc_size() here because the tables aren't
 1667|       |     * surrounded by redzones in ASAN. */
 1668|  5.00k|    size_t const tableSpace = chainSize * sizeof(U32)
 1669|  5.00k|                            + hSize * sizeof(U32)
 1670|  5.00k|                            + h3Size * sizeof(U32);
 1671|  5.00k|    size_t const optPotentialSpace =
 1672|  5.00k|        ZSTD_cwksp_aligned64_alloc_size((MaxML+1) * sizeof(U32))
  ------------------
  |  |  103|  5.00k|#define MaxML   52
  ------------------
 1673|  5.00k|      + ZSTD_cwksp_aligned64_alloc_size((MaxLL+1) * sizeof(U32))
  ------------------
  |  |  104|  5.00k|#define MaxLL   35
  ------------------
 1674|  5.00k|      + ZSTD_cwksp_aligned64_alloc_size((MaxOff+1) * sizeof(U32))
  ------------------
  |  |  106|  5.00k|#define MaxOff  31
  ------------------
 1675|  5.00k|      + ZSTD_cwksp_aligned64_alloc_size((1<<Litbits) * sizeof(U32))
  ------------------
  |  |  100|  5.00k|#define Litbits  8
  ------------------
 1676|  5.00k|      + ZSTD_cwksp_aligned64_alloc_size(ZSTD_OPT_SIZE * sizeof(ZSTD_match_t))
  ------------------
  |  |  226|  5.00k|#define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3)
  |  |  ------------------
  |  |  |  |   62|  5.00k|#define ZSTD_OPT_NUM    (1<<12)
  |  |  ------------------
  ------------------
 1677|  5.00k|      + ZSTD_cwksp_aligned64_alloc_size(ZSTD_OPT_SIZE * sizeof(ZSTD_optimal_t));
  ------------------
  |  |  226|  5.00k|#define ZSTD_OPT_SIZE (ZSTD_OPT_NUM+3)
  |  |  ------------------
  |  |  |  |   62|  5.00k|#define ZSTD_OPT_NUM    (1<<12)
  |  |  ------------------
  ------------------
 1678|  5.00k|    size_t const lazyAdditionalSpace = ZSTD_rowMatchFinderUsed(cParams->strategy, useRowMatchFinder)
  ------------------
  |  Branch (1678:40): [True: 0, False: 5.00k]
  ------------------
 1679|  5.00k|                                            ? ZSTD_cwksp_aligned64_alloc_size(hSize)
 1680|  5.00k|                                            : 0;
 1681|  5.00k|    size_t const optSpace = (forCCtx && (cParams->strategy >= ZSTD_btopt))
  ------------------
  |  Branch (1681:30): [True: 5.00k, False: 0]
  |  Branch (1681:41): [True: 2.48k, False: 2.52k]
  ------------------
 1682|  5.00k|                                ? optPotentialSpace
 1683|  5.00k|                                : 0;
 1684|  5.00k|    size_t const slackSpace = ZSTD_cwksp_slack_space_required();
 1685|       |
 1686|       |    /* tables are guaranteed to be sized in multiples of 64 bytes (or 16 uint32_t) */
 1687|  5.00k|    ZSTD_STATIC_ASSERT(ZSTD_HASHLOG_MIN >= 4 && ZSTD_WINDOWLOG_MIN >= 4 && ZSTD_CHAINLOG_MIN >= 4);
  ------------------
  |  |   43|  5.00k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  5.00k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1688|  5.00k|    assert(useRowMatchFinder != ZSTD_ps_auto);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1689|       |
 1690|  5.00k|    DEBUGLOG(4, "chainSize: %u - hSize: %u - h3Size: %u",
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 1691|  5.00k|                (U32)chainSize, (U32)hSize, (U32)h3Size);
 1692|  5.00k|    return tableSpace + optSpace + slackSpace + lazyAdditionalSpace;
 1693|  5.00k|}
zstd_compress.c:ZSTD_writeFrameHeader:
 4698|  5.00k|{
 4699|  5.00k|    BYTE* const op = (BYTE*)dst;
 4700|  5.00k|    U32   const dictIDSizeCodeLength = (dictID>0) + (dictID>=256) + (dictID>=65536);   /* 0-3 */
 4701|  5.00k|    U32   const dictIDSizeCode = params->fParams.noDictIDFlag ? 0 : dictIDSizeCodeLength;   /* 0-3 */
  ------------------
  |  Branch (4701:34): [True: 0, False: 5.00k]
  ------------------
 4702|  5.00k|    U32   const checksumFlag = params->fParams.checksumFlag>0;
 4703|  5.00k|    U32   const windowSize = (U32)1 << params->cParams.windowLog;
 4704|  5.00k|    U32   const singleSegment = params->fParams.contentSizeFlag && (windowSize >= pledgedSrcSize);
  ------------------
  |  Branch (4704:33): [True: 5.00k, False: 0]
  |  Branch (4704:68): [True: 5.00k, False: 0]
  ------------------
 4705|  5.00k|    BYTE  const windowLogByte = (BYTE)((params->cParams.windowLog - ZSTD_WINDOWLOG_ABSOLUTEMIN) << 3);
  ------------------
  |  |   78|  5.00k|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
 4706|  5.00k|    U32   const fcsCode = params->fParams.contentSizeFlag ?
  ------------------
  |  Branch (4706:27): [True: 5.00k, False: 0]
  ------------------
 4707|  5.00k|                     (pledgedSrcSize>=256) + (pledgedSrcSize>=65536+256) + (pledgedSrcSize>=0xFFFFFFFFU) : 0;  /* 0-3 */
 4708|  5.00k|    BYTE  const frameHeaderDescriptionByte = (BYTE)(dictIDSizeCode + (checksumFlag<<2) + (singleSegment<<5) + (fcsCode<<6) );
 4709|  5.00k|    size_t pos=0;
 4710|       |
 4711|  5.00k|    assert(!(params->fParams.contentSizeFlag && pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN));
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4712|  5.00k|    RETURN_ERROR_IF(dstCapacity < ZSTD_FRAMEHEADERSIZE_MAX, dstSize_tooSmall,
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 29, False: 4.97k]
  |  |  ------------------
  |  |  116|     29|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     29|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     29|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     29|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     29|    do {                                           \
  |  |  |  |   99|     29|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     29|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     29|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     29|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     29|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     29|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     29|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     29|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     29|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     29|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     29|        }                                                                      \
  |  |  123|  5.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 4713|  5.00k|                    "dst buf is too small to fit worst-case frame header size.");
 4714|  4.97k|    DEBUGLOG(4, "ZSTD_writeFrameHeader : dictIDFlag : %u ; dictID : %u ; dictIDSizeCode : %u",
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 4715|  4.97k|                !params->fParams.noDictIDFlag, (unsigned)dictID, (unsigned)dictIDSizeCode);
 4716|  4.97k|    if (params->format == ZSTD_f_zstd1) {
  ------------------
  |  Branch (4716:9): [True: 4.97k, False: 0]
  ------------------
 4717|  4.97k|        MEM_writeLE32(dst, ZSTD_MAGICNUMBER);
  ------------------
  |  |  142|  4.97k|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
 4718|  4.97k|        pos = 4;
 4719|  4.97k|    }
 4720|  4.97k|    op[pos++] = frameHeaderDescriptionByte;
 4721|  4.97k|    if (!singleSegment) op[pos++] = windowLogByte;
  ------------------
  |  Branch (4721:9): [True: 0, False: 4.97k]
  ------------------
 4722|  4.97k|    switch(dictIDSizeCode)
 4723|  4.97k|    {
 4724|      0|        default:
  ------------------
  |  Branch (4724:9): [True: 0, False: 4.97k]
  ------------------
 4725|      0|            assert(0); /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4726|      0|            ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
 4727|  4.97k|        case 0 : break;
  ------------------
  |  Branch (4727:9): [True: 4.97k, False: 0]
  ------------------
 4728|      0|        case 1 : op[pos] = (BYTE)(dictID); pos++; break;
  ------------------
  |  Branch (4728:9): [True: 0, False: 4.97k]
  ------------------
 4729|      0|        case 2 : MEM_writeLE16(op+pos, (U16)dictID); pos+=2; break;
  ------------------
  |  Branch (4729:9): [True: 0, False: 4.97k]
  ------------------
 4730|      0|        case 3 : MEM_writeLE32(op+pos, dictID); pos+=4; break;
  ------------------
  |  Branch (4730:9): [True: 0, False: 4.97k]
  ------------------
 4731|  4.97k|    }
 4732|  4.97k|    switch(fcsCode)
 4733|  4.97k|    {
 4734|      0|        default:
  ------------------
  |  Branch (4734:9): [True: 0, False: 4.97k]
  ------------------
 4735|      0|            assert(0); /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 4736|      0|            ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
 4737|  4.97k|        case 0 : if (singleSegment) op[pos++] = (BYTE)(pledgedSrcSize); break;
  ------------------
  |  Branch (4737:9): [True: 4.97k, False: 0]
  |  Branch (4737:22): [True: 4.97k, False: 0]
  ------------------
 4738|      0|        case 1 : MEM_writeLE16(op+pos, (U16)(pledgedSrcSize-256)); pos+=2; break;
  ------------------
  |  Branch (4738:9): [True: 0, False: 4.97k]
  ------------------
 4739|      0|        case 2 : MEM_writeLE32(op+pos, (U32)(pledgedSrcSize)); pos+=4; break;
  ------------------
  |  Branch (4739:9): [True: 0, False: 4.97k]
  ------------------
 4740|      0|        case 3 : MEM_writeLE64(op+pos, (U64)(pledgedSrcSize)); pos+=8; break;
  ------------------
  |  Branch (4740:9): [True: 0, False: 4.97k]
  ------------------
 4741|  4.97k|    }
 4742|  4.97k|    return pos;
 4743|  4.97k|}
zstd_compress.c:ZSTD_getCParams_internal:
 7760|  5.00k|{
 7761|  5.00k|    U64 const rSize = ZSTD_getCParamRowSize(srcSizeHint, dictSize, mode);
 7762|  5.00k|    U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB);
  ------------------
  |  |   67|  5.00k|#define KB *(1 <<10)
  ------------------
                  U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB);
  ------------------
  |  |   67|  5.00k|#define KB *(1 <<10)
  ------------------
                  U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB);
  ------------------
  |  |   67|  5.00k|#define KB *(1 <<10)
  ------------------
 7763|  5.00k|    int row;
 7764|  5.00k|    DEBUGLOG(5, "ZSTD_getCParams_internal (cLevel=%i)", compressionLevel);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 7765|       |
 7766|       |    /* row */
 7767|  5.00k|    if (compressionLevel == 0) row = ZSTD_CLEVEL_DEFAULT;   /* 0 == default */
  ------------------
  |  |  134|      0|#  define ZSTD_CLEVEL_DEFAULT 3
  ------------------
  |  Branch (7767:9): [True: 0, False: 5.00k]
  ------------------
 7768|  5.00k|    else if (compressionLevel < 0) row = 0;   /* entry 0 is baseline for fast mode */
  ------------------
  |  Branch (7768:14): [True: 0, False: 5.00k]
  ------------------
 7769|  5.00k|    else if (compressionLevel > ZSTD_MAX_CLEVEL) row = ZSTD_MAX_CLEVEL;
  ------------------
  |  |   19|  5.00k|#define ZSTD_MAX_CLEVEL     22
  ------------------
                  else if (compressionLevel > ZSTD_MAX_CLEVEL) row = ZSTD_MAX_CLEVEL;
  ------------------
  |  |   19|      0|#define ZSTD_MAX_CLEVEL     22
  ------------------
  |  Branch (7769:14): [True: 0, False: 5.00k]
  ------------------
 7770|  5.00k|    else row = compressionLevel;
 7771|       |
 7772|  5.00k|    {   ZSTD_compressionParameters cp = ZSTD_defaultCParameters[tableID][row];
 7773|  5.00k|        DEBUGLOG(5, "ZSTD_getCParams_internal selected tableID: %u row: %u strat: %u", tableID, row, (U32)cp.strategy);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 7774|       |        /* acceleration factor */
 7775|  5.00k|        if (compressionLevel < 0) {
  ------------------
  |  Branch (7775:13): [True: 0, False: 5.00k]
  ------------------
 7776|      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]
  |  |  ------------------
  ------------------
 7777|      0|            cp.targetLength = (unsigned)(-clampedCompressionLevel);
 7778|      0|        }
 7779|       |        /* refine parameters based on srcSize & dictSize */
 7780|  5.00k|        return ZSTD_adjustCParams_internal(cp, srcSizeHint, dictSize, mode, ZSTD_ps_auto);
 7781|  5.00k|    }
 7782|  5.00k|}
zstd_compress.c:ZSTD_getCParamRowSize:
 7735|  5.00k|{
 7736|  5.00k|    switch (mode) {
 7737|      0|    case ZSTD_cpm_unknown:
  ------------------
  |  Branch (7737:5): [True: 0, False: 5.00k]
  ------------------
 7738|  5.00k|    case ZSTD_cpm_noAttachDict:
  ------------------
  |  Branch (7738:5): [True: 5.00k, False: 0]
  ------------------
 7739|  5.00k|    case ZSTD_cpm_createCDict:
  ------------------
  |  Branch (7739:5): [True: 0, False: 5.00k]
  ------------------
 7740|  5.00k|        break;
 7741|      0|    case ZSTD_cpm_attachDict:
  ------------------
  |  Branch (7741:5): [True: 0, False: 5.00k]
  ------------------
 7742|      0|        dictSize = 0;
 7743|      0|        break;
 7744|      0|    default:
  ------------------
  |  Branch (7744:5): [True: 0, False: 5.00k]
  ------------------
 7745|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 7746|      0|        break;
 7747|  5.00k|    }
 7748|  5.00k|    {   int const unknown = srcSizeHint == ZSTD_CONTENTSIZE_UNKNOWN;
  ------------------
  |  |  203|  5.00k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
 7749|  5.00k|        size_t const addedSize = unknown && dictSize > 0 ? 500 : 0;
  ------------------
  |  Branch (7749:34): [True: 0, False: 5.00k]
  |  Branch (7749:45): [True: 0, False: 0]
  ------------------
 7750|  5.00k|        return unknown && dictSize == 0 ? ZSTD_CONTENTSIZE_UNKNOWN : srcSizeHint+dictSize+addedSize;
  ------------------
  |  |  203|      0|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (7750:16): [True: 0, False: 5.00k]
  |  Branch (7750:27): [True: 0, False: 0]
  ------------------
 7751|  5.00k|    }
 7752|  5.00k|}
zstd_compress.c:ZSTD_getParams_internal:
 7799|  5.00k|{
 7800|  5.00k|    ZSTD_parameters params;
 7801|  5.00k|    ZSTD_compressionParameters const cParams = ZSTD_getCParams_internal(compressionLevel, srcSizeHint, dictSize, mode);
 7802|  5.00k|    DEBUGLOG(5, "ZSTD_getParams (cLevel=%i)", compressionLevel);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 7803|  5.00k|    ZSTD_memset(&params, 0, sizeof(params));
  ------------------
  |  |   46|  5.00k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 7804|  5.00k|    params.cParams = cParams;
 7805|  5.00k|    params.fParams.contentSizeFlag = 1;
 7806|  5.00k|    return params;
 7807|  5.00k|}

zstd_compress.c:ZSTD_hasExtSeqProd:
 1613|  19.9k|MEM_STATIC int ZSTD_hasExtSeqProd(const ZSTD_CCtx_params* params) {
 1614|       |    return params->extSeqProdFunc != NULL;
 1615|  19.9k|}
zstd_compress.c:ZSTD_window_clear:
 1042|  5.00k|{
 1043|  5.00k|    size_t const endT = (size_t)(window->nextSrc - window->base);
 1044|  5.00k|    U32 const end = (U32)endT;
 1045|       |
 1046|  5.00k|    window->lowLimit = end;
 1047|  5.00k|    window->dictLimit = end;
 1048|  5.00k|}
zstd_compress.c:ZSTD_window_init:
 1334|     38|MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) {
 1335|     38|    ZSTD_memset(window, 0, sizeof(*window));
  ------------------
  |  |   46|     38|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 1336|     38|    window->base = (BYTE const*)" ";
 1337|     38|    window->dictBase = (BYTE const*)" ";
 1338|     38|    ZSTD_STATIC_ASSERT(ZSTD_DUBT_UNSORTED_MARK < ZSTD_WINDOW_START_INDEX); /* Start above ZSTD_DUBT_UNSORTED_MARK */
  ------------------
  |  |   43|     38|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|     38|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1339|     38|    window->dictLimit = ZSTD_WINDOW_START_INDEX;    /* start from >0, so that 1st position is valid */
  ------------------
  |  |  266|     38|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1340|     38|    window->lowLimit = ZSTD_WINDOW_START_INDEX;     /* it ensures first and later CCtx usages compress the same */
  ------------------
  |  |  266|     38|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1341|     38|    window->nextSrc = window->base + ZSTD_WINDOW_START_INDEX;   /* see issue #1241 */
  ------------------
  |  |  266|     38|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1342|     38|    window->nbOverflowCorrections = 0;
 1343|     38|}
zstd_compress.c:ZSTD_LLcode:
  585|  17.1k|{
  586|  17.1k|    static const BYTE LL_Code[64] = {  0,  1,  2,  3,  4,  5,  6,  7,
  587|  17.1k|                                       8,  9, 10, 11, 12, 13, 14, 15,
  588|  17.1k|                                      16, 16, 17, 17, 18, 18, 19, 19,
  589|  17.1k|                                      20, 20, 20, 20, 21, 21, 21, 21,
  590|  17.1k|                                      22, 22, 22, 22, 22, 22, 22, 22,
  591|  17.1k|                                      23, 23, 23, 23, 23, 23, 23, 23,
  592|  17.1k|                                      24, 24, 24, 24, 24, 24, 24, 24,
  593|  17.1k|                                      24, 24, 24, 24, 24, 24, 24, 24 };
  594|  17.1k|    static const U32 LL_deltaCode = 19;
  595|  17.1k|    return (litLength > 63) ? ZSTD_highbit32(litLength) + LL_deltaCode : LL_Code[litLength];
  ------------------
  |  Branch (595:12): [True: 488, False: 16.6k]
  ------------------
  596|  17.1k|}
zstd_compress.c:ZSTD_MLcode:
  602|  17.1k|{
  603|  17.1k|    static const BYTE ML_Code[128] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  604|  17.1k|                                      16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  605|  17.1k|                                      32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37,
  606|  17.1k|                                      38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39,
  607|  17.1k|                                      40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
  608|  17.1k|                                      41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
  609|  17.1k|                                      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
  610|  17.1k|                                      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 };
  611|  17.1k|    static const U32 ML_deltaCode = 36;
  612|  17.1k|    return (mlBase > 127) ? ZSTD_highbit32(mlBase) + ML_deltaCode : ML_Code[mlBase];
  ------------------
  |  Branch (612:12): [True: 0, False: 17.1k]
  ------------------
  613|  17.1k|}
zstd_compress.c:ZSTD_literalsCompressionIsDisabled:
  686|  4.97k|{
  687|  4.97k|    switch (cctxParams->literalCompressionMode) {
  688|      0|    case ZSTD_ps_enable:
  ------------------
  |  Branch (688:5): [True: 0, False: 4.97k]
  ------------------
  689|      0|        return 0;
  690|      0|    case ZSTD_ps_disable:
  ------------------
  |  Branch (690:5): [True: 0, False: 4.97k]
  ------------------
  691|      0|        return 1;
  692|      0|    default:
  ------------------
  |  Branch (692:5): [True: 0, False: 4.97k]
  ------------------
  693|      0|        assert(0 /* impossible: pre-validated */);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  694|      0|        ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  695|  4.97k|    case ZSTD_ps_auto:
  ------------------
  |  Branch (695:5): [True: 4.97k, False: 0]
  ------------------
  696|  4.97k|        return (cctxParams->cParams.strategy == ZSTD_fast) && (cctxParams->cParams.targetLength > 0);
  ------------------
  |  Branch (696:16): [True: 502, False: 4.47k]
  |  Branch (696:63): [True: 0, False: 502]
  ------------------
  697|  4.97k|    }
  698|  4.97k|}
zstd_compress.c:ZSTD_window_update:
 1357|  4.97k|{
 1358|  4.97k|    BYTE const* const ip = (BYTE const*)src;
 1359|  4.97k|    U32 contiguous = 1;
 1360|  4.97k|    DEBUGLOG(5, "ZSTD_window_update");
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 1361|  4.97k|    if (srcSize == 0)
  ------------------
  |  Branch (1361:9): [True: 0, False: 4.97k]
  ------------------
 1362|      0|        return contiguous;
 1363|  4.97k|    assert(window->base != NULL);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1364|  4.97k|    assert(window->dictBase != NULL);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1365|       |    /* Check if blocks follow each other */
 1366|  4.97k|    if (src != window->nextSrc || forceNonContiguous) {
  ------------------
  |  Branch (1366:9): [True: 4.97k, False: 0]
  |  Branch (1366:35): [True: 0, False: 0]
  ------------------
 1367|       |        /* not contiguous */
 1368|  4.97k|        size_t const distanceFromBase = (size_t)(window->nextSrc - window->base);
 1369|  4.97k|        DEBUGLOG(5, "Non contiguous blocks, new segment starts at %u", window->dictLimit);
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 1370|  4.97k|        window->lowLimit = window->dictLimit;
 1371|  4.97k|        assert(distanceFromBase == (size_t)(U32)distanceFromBase);  /* should never overflow */
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1372|  4.97k|        window->dictLimit = (U32)distanceFromBase;
 1373|  4.97k|        window->dictBase = window->base;
 1374|  4.97k|        window->base = ip - distanceFromBase;
 1375|       |        /* ms->nextToUpdate = window->dictLimit; */
 1376|  4.97k|        if (window->dictLimit - window->lowLimit < HASH_READ_SIZE) window->lowLimit = window->dictLimit;   /* too small extDict */
  ------------------
  |  |   33|  4.97k|#define HASH_READ_SIZE       8
  ------------------
  |  Branch (1376:13): [True: 4.97k, False: 0]
  ------------------
 1377|  4.97k|        contiguous = 0;
 1378|  4.97k|    }
 1379|  4.97k|    window->nextSrc = ip + srcSize;
 1380|       |    /* if input and dictionary overlap : reduce dictionary (area presumed modified by input) */
 1381|  4.97k|    if ( (ip+srcSize > window->dictBase + window->lowLimit)
  ------------------
  |  Branch (1381:10): [True: 0, False: 4.97k]
  ------------------
 1382|  4.97k|       & (ip < window->dictBase + window->dictLimit)) {
 1383|      0|        size_t const highInputIdx = (size_t)((ip + srcSize) - window->dictBase);
 1384|      0|        U32 const lowLimitMax = (highInputIdx > (size_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx;
  ------------------
  |  Branch (1384:33): [True: 0, False: 0]
  ------------------
 1385|      0|        assert(highInputIdx < UINT_MAX);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1386|      0|        window->lowLimit = lowLimitMax;
 1387|      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]
  |  |  ------------------
  ------------------
 1388|      0|    }
 1389|  4.97k|    return contiguous;
 1390|  4.97k|}
zstd_compress.c:ZSTD_window_needOverflowCorrection:
 1138|  4.97k|{
 1139|  4.97k|    U32 const curr = (U32)((BYTE const*)srcEnd - window.base);
 1140|  4.97k|    if (ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) {
  ------------------
  |  | 1086|  4.97k|#    define ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY 1
  |  |  ------------------
  |  |  |  Branch (1086:53): [True: 4.97k, Folded]
  |  |  ------------------
  ------------------
 1141|  4.97k|        if (ZSTD_window_canOverflowCorrect(window, cycleLog, maxDist, loadedDictEnd, src)) {
  ------------------
  |  Branch (1141:13): [True: 145, False: 4.82k]
  ------------------
 1142|    145|            return 1;
 1143|    145|        }
 1144|  4.97k|    }
 1145|  4.82k|    return curr > ZSTD_CURRENT_MAX;
  ------------------
  |  | 1031|  4.82k|#define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  ------------------
  |  |  |  |   68|  4.82k|#define MB *(1 <<20)
  |  |  ------------------
  |  |               #define ZSTD_CURRENT_MAX (MEM_64bits() ? 3500U MB : 2000U MB)
  |  |  ------------------
  |  |  |  |   68|      0|#define MB *(1 <<20)
  |  |  ------------------
  |  |  |  Branch (1031:27): [True: 4.82k, False: 0]
  |  |  ------------------
  ------------------
 1146|  4.97k|}
zstd_compress.c:ZSTD_window_canOverflowCorrect:
 1102|  4.97k|{
 1103|  4.97k|    U32 const cycleSize = 1u << cycleLog;
 1104|  4.97k|    U32 const curr = (U32)((BYTE const*)src - window.base);
 1105|  4.97k|    U32 const minIndexToOverflowCorrect = cycleSize
 1106|  4.97k|                                        + MAX(maxDist, cycleSize)
  ------------------
  |  |   55|  4.97k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 4.97k, False: 0]
  |  |  ------------------
  ------------------
 1107|  4.97k|                                        + ZSTD_WINDOW_START_INDEX;
  ------------------
  |  |  266|  4.97k|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1108|       |
 1109|       |    /* Adjust the min index to backoff the overflow correction frequency,
 1110|       |     * so we don't waste too much CPU in overflow correction. If this
 1111|       |     * computation overflows we don't really care, we just need to make
 1112|       |     * sure it is at least minIndexToOverflowCorrect.
 1113|       |     */
 1114|  4.97k|    U32 const adjustment = window.nbOverflowCorrections + 1;
 1115|  4.97k|    U32 const adjustedIndex = MAX(minIndexToOverflowCorrect * adjustment,
  ------------------
  |  |   55|  4.97k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 4.47k, False: 498]
  |  |  ------------------
  ------------------
 1116|  4.97k|                                  minIndexToOverflowCorrect);
 1117|  4.97k|    U32 const indexLargeEnough = curr > adjustedIndex;
 1118|       |
 1119|       |    /* Only overflow correct early if the dictionary is invalidated already,
 1120|       |     * so we don't hurt compression ratio.
 1121|       |     */
 1122|  4.97k|    U32 const dictionaryInvalidated = curr > maxDist + loadedDictEnd;
 1123|       |
 1124|  4.97k|    return indexLargeEnough && dictionaryInvalidated;
  ------------------
  |  Branch (1124:12): [True: 145, False: 4.82k]
  |  Branch (1124:32): [True: 145, False: 0]
  ------------------
 1125|  4.97k|}
zstd_compress.c:ZSTD_window_correctOverflow:
 1161|    145|{
 1162|       |    /* preemptive overflow correction:
 1163|       |     * 1. correction is large enough:
 1164|       |     *    lowLimit > (3<<29) ==> current > 3<<29 + 1<<windowLog
 1165|       |     *    1<<windowLog <= newCurrent < 1<<chainLog + 1<<windowLog
 1166|       |     *
 1167|       |     *    current - newCurrent
 1168|       |     *    > (3<<29 + 1<<windowLog) - (1<<windowLog + 1<<chainLog)
 1169|       |     *    > (3<<29) - (1<<chainLog)
 1170|       |     *    > (3<<29) - (1<<30)             (NOTE: chainLog <= 30)
 1171|       |     *    > 1<<29
 1172|       |     *
 1173|       |     * 2. (ip+ZSTD_CHUNKSIZE_MAX - cctx->base) doesn't overflow:
 1174|       |     *    After correction, current is less than (1<<chainLog + 1<<windowLog).
 1175|       |     *    In 64-bit mode we are safe, because we have 64-bit ptrdiff_t.
 1176|       |     *    In 32-bit mode we are safe, because (chainLog <= 29), so
 1177|       |     *    ip+ZSTD_CHUNKSIZE_MAX - cctx->base < 1<<32.
 1178|       |     * 3. (cctx->lowLimit + 1<<windowLog) < 1<<32:
 1179|       |     *    windowLog <= 31 ==> 3<<29 + 1<<windowLog < 7<<29 < 1<<32.
 1180|       |     */
 1181|    145|    U32 const cycleSize = 1u << cycleLog;
 1182|    145|    U32 const cycleMask = cycleSize - 1;
 1183|    145|    U32 const curr = (U32)((BYTE const*)src - window->base);
 1184|    145|    U32 const currentCycle = curr & cycleMask;
 1185|       |    /* Ensure newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX. */
 1186|    145|    U32 const currentCycleCorrection = currentCycle < ZSTD_WINDOW_START_INDEX
  ------------------
  |  |  266|    145|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
  |  Branch (1186:40): [True: 0, False: 145]
  ------------------
 1187|    145|                                     ? MAX(cycleSize, ZSTD_WINDOW_START_INDEX)
  ------------------
  |  |   55|      0|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1188|    145|                                     : 0;
 1189|    145|    U32 const newCurrent = currentCycle
 1190|    145|                         + currentCycleCorrection
 1191|    145|                         + MAX(maxDist, cycleSize);
  ------------------
  |  |   55|    145|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 145, False: 0]
  |  |  ------------------
  ------------------
 1192|    145|    U32 const correction = curr - newCurrent;
 1193|       |    /* maxDist must be a power of two so that:
 1194|       |     *   (newCurrent & cycleMask) == (curr & cycleMask)
 1195|       |     * This is required to not corrupt the chains / binary tree.
 1196|       |     */
 1197|    145|    assert((maxDist & (maxDist - 1)) == 0);
  ------------------
  |  |   70|    145|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1198|    145|    assert((curr & cycleMask) == (newCurrent & cycleMask));
  ------------------
  |  |   70|    145|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1199|    145|    assert(curr > newCurrent);
  ------------------
  |  |   70|    145|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1200|    145|    if (!ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY) {
  ------------------
  |  | 1086|    145|#    define ZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY 1
  ------------------
  |  Branch (1200:9): [Folded, False: 145]
  ------------------
 1201|       |        /* Loose bound, should be around 1<<29 (see above) */
 1202|      0|        assert(correction > 1<<28);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1203|      0|    }
 1204|       |
 1205|    145|    window->base += correction;
 1206|    145|    window->dictBase += correction;
 1207|    145|    if (window->lowLimit < correction + ZSTD_WINDOW_START_INDEX) {
  ------------------
  |  |  266|    145|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
  |  Branch (1207:9): [True: 0, False: 145]
  ------------------
 1208|      0|        window->lowLimit = ZSTD_WINDOW_START_INDEX;
  ------------------
  |  |  266|      0|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1209|    145|    } else {
 1210|    145|        window->lowLimit -= correction;
 1211|    145|    }
 1212|    145|    if (window->dictLimit < correction + ZSTD_WINDOW_START_INDEX) {
  ------------------
  |  |  266|    145|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
  |  Branch (1212:9): [True: 0, False: 145]
  ------------------
 1213|      0|        window->dictLimit = ZSTD_WINDOW_START_INDEX;
  ------------------
  |  |  266|      0|#define ZSTD_WINDOW_START_INDEX 2
  ------------------
 1214|    145|    } else {
 1215|    145|        window->dictLimit -= correction;
 1216|    145|    }
 1217|       |
 1218|       |    /* Ensure we can still reference the full window. */
 1219|    145|    assert(newCurrent >= maxDist);
  ------------------
  |  |   70|    145|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1220|    145|    assert(newCurrent - maxDist >= ZSTD_WINDOW_START_INDEX);
  ------------------
  |  |   70|    145|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1221|       |    /* Ensure that lowLimit and dictLimit didn't underflow. */
 1222|    145|    assert(window->lowLimit <= newCurrent);
  ------------------
  |  |   70|    145|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1223|    145|    assert(window->dictLimit <= newCurrent);
  ------------------
  |  |   70|    145|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1224|       |
 1225|    145|    ++window->nbOverflowCorrections;
 1226|       |
 1227|    145|    DEBUGLOG(4, "Correction of 0x%x bytes to lowLimit=0x%x", correction,
  ------------------
  |  |  104|    145|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 145]
  |  |  ------------------
  ------------------
 1228|    145|             window->lowLimit);
 1229|    145|    return correction;
 1230|    145|}
zstd_compress.c:ZSTD_checkDictValidity:
 1306|  4.97k|{
 1307|  4.97k|    assert(loadedDictEndPtr != NULL);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1308|  4.97k|    assert(dictMatchStatePtr != NULL);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1309|  4.97k|    {   U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base);
 1310|  4.97k|        U32 const loadedDictEnd = *loadedDictEndPtr;
 1311|  4.97k|        DEBUGLOG(5, "ZSTD_checkDictValidity: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u",
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 1312|  4.97k|                    (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd);
 1313|  4.97k|        assert(blockEndIdx >= loadedDictEnd);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1314|       |
 1315|  4.97k|        if (blockEndIdx > loadedDictEnd + maxDist || loadedDictEnd != window->dictLimit) {
  ------------------
  |  Branch (1315:13): [True: 4.57k, False: 396]
  |  Branch (1315:54): [True: 396, False: 0]
  ------------------
 1316|       |            /* On reaching window size, dictionaries are invalidated.
 1317|       |             * For simplification, if window size is reached anywhere within next block,
 1318|       |             * the dictionary is invalidated for the full block.
 1319|       |             *
 1320|       |             * We also have to invalidate the dictionary if ZSTD_window_update() has detected
 1321|       |             * non-contiguous segments, which means that loadedDictEnd != window->dictLimit.
 1322|       |             * loadedDictEnd may be 0, if forceWindow is true, but in that case we never use
 1323|       |             * dictMatchState, so setting it to NULL is not a problem.
 1324|       |             */
 1325|  4.97k|            DEBUGLOG(6, "invalidating dictionary for current block (distance > windowSize)");
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 1326|  4.97k|            *loadedDictEndPtr = 0;
 1327|  4.97k|            *dictMatchStatePtr = NULL;
 1328|  4.97k|        } else {
 1329|      0|            if (*loadedDictEndPtr != 0) {
  ------------------
  |  Branch (1329:17): [True: 0, False: 0]
  ------------------
 1330|      0|                DEBUGLOG(6, "dictionary considered valid for current block");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1331|      0|    }   }   }
 1332|  4.97k|}
zstd_compress.c:ZSTD_window_enforceMaxDist:
 1261|  4.97k|{
 1262|  4.97k|    U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base);
 1263|  4.97k|    U32 const loadedDictEnd = (loadedDictEndPtr != NULL) ? *loadedDictEndPtr : 0;
  ------------------
  |  Branch (1263:31): [True: 4.97k, False: 0]
  ------------------
 1264|  4.97k|    DEBUGLOG(5, "ZSTD_window_enforceMaxDist: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u",
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
 1265|  4.97k|                (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd);
 1266|       |
 1267|       |    /* - When there is no dictionary : loadedDictEnd == 0.
 1268|       |         In which case, the test (blockEndIdx > maxDist) is merely to avoid
 1269|       |         overflowing next operation `newLowLimit = blockEndIdx - maxDist`.
 1270|       |       - When there is a standard dictionary :
 1271|       |         Index referential is copied from the dictionary,
 1272|       |         which means it starts from 0.
 1273|       |         In which case, loadedDictEnd == dictSize,
 1274|       |         and it makes sense to compare `blockEndIdx > maxDist + dictSize`
 1275|       |         since `blockEndIdx` also starts from zero.
 1276|       |       - When there is an attached dictionary :
 1277|       |         loadedDictEnd is expressed within the referential of the context,
 1278|       |         so it can be directly compared against blockEndIdx.
 1279|       |    */
 1280|  4.97k|    if (blockEndIdx > maxDist + loadedDictEnd) {
  ------------------
  |  Branch (1280:9): [True: 4.55k, False: 419]
  ------------------
 1281|  4.55k|        U32 const newLowLimit = blockEndIdx - maxDist;
 1282|  4.55k|        if (window->lowLimit < newLowLimit) window->lowLimit = newLowLimit;
  ------------------
  |  Branch (1282:13): [True: 0, False: 4.55k]
  ------------------
 1283|  4.55k|        if (window->dictLimit < window->lowLimit) {
  ------------------
  |  Branch (1283:13): [True: 0, False: 4.55k]
  ------------------
 1284|      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]
  |  |  ------------------
  ------------------
 1285|      0|                        (unsigned)window->dictLimit, (unsigned)window->lowLimit);
 1286|      0|            window->dictLimit = window->lowLimit;
 1287|      0|        }
 1288|       |        /* On reaching window size, dictionaries are invalidated */
 1289|  4.55k|        if (loadedDictEndPtr) *loadedDictEndPtr = 0;
  ------------------
  |  Branch (1289:13): [True: 4.55k, False: 0]
  ------------------
 1290|  4.55k|        if (dictMatchStatePtr) *dictMatchStatePtr = NULL;
  ------------------
  |  Branch (1290:13): [True: 4.55k, False: 0]
  ------------------
 1291|  4.55k|    }
 1292|  4.97k|}
zstd_compress.c:ZSTD_matchState_dictMode:
 1072|  4.97k|{
 1073|  4.97k|    return ZSTD_window_hasExtDict(ms->window) ?
  ------------------
  |  Branch (1073:12): [True: 0, False: 4.97k]
  ------------------
 1074|      0|        ZSTD_extDict :
 1075|  4.97k|        ms->dictMatchState != NULL ?
  ------------------
  |  Branch (1075:9): [True: 0, False: 4.97k]
  ------------------
 1076|      0|            (ms->dictMatchState->dedicatedDictSearch ? ZSTD_dedicatedDictSearch : ZSTD_dictMatchState) :
  ------------------
  |  Branch (1076:14): [True: 0, False: 0]
  ------------------
 1077|  4.97k|            ZSTD_noDict;
 1078|  4.97k|}
zstd_compress.c:ZSTD_window_hasExtDict:
 1062|  4.97k|{
 1063|  4.97k|    return window.lowLimit < window.dictLimit;
 1064|  4.97k|}
zstd_compress.c:ZSTD_minGain:
  678|  3.15k|{
  679|  3.15k|    U32 const minlog = (strat>=ZSTD_btultra) ? (U32)(strat) - 1 : 6;
  ------------------
  |  Branch (679:24): [True: 2.21k, False: 945]
  ------------------
  680|  3.15k|    ZSTD_STATIC_ASSERT(ZSTD_btultra == 8);
  ------------------
  |  |   43|  3.15k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  3.15k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  681|  3.15k|    assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat));
  ------------------
  |  |   70|  3.15k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  682|  3.15k|    return (srcSize >> minlog) + 2;
  683|  3.15k|}
zstd_compress_literals.c:ZSTD_minGain:
  678|  3.97k|{
  679|  3.97k|    U32 const minlog = (strat>=ZSTD_btultra) ? (U32)(strat) - 1 : 6;
  ------------------
  |  Branch (679:24): [True: 2.20k, False: 1.76k]
  ------------------
  680|  3.97k|    ZSTD_STATIC_ASSERT(ZSTD_btultra == 8);
  ------------------
  |  |   43|  3.97k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  3.97k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  681|  3.97k|    assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, (int)strat));
  ------------------
  |  |   70|  3.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  682|  3.97k|    return (srcSize >> minlog) + 2;
  683|  3.97k|}
zstd_fast.c:ZSTD_hashPtr:
  931|  43.2k|{
  932|       |    /* Although some of these hashes do support hBits up to 64, some do not.
  933|       |     * To be on the safe side, always avoid hBits > 32. */
  934|  43.2k|    assert(hBits <= 32);
  ------------------
  |  |   70|  43.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  935|       |
  936|  43.2k|    switch(mls)
  937|  43.2k|    {
  938|      0|    default:
  ------------------
  |  Branch (938:5): [True: 0, False: 43.2k]
  ------------------
  939|      0|    case 4: return ZSTD_hash4Ptr(p, hBits);
  ------------------
  |  Branch (939:5): [True: 0, False: 43.2k]
  ------------------
  940|  43.2k|    case 5: return ZSTD_hash5Ptr(p, hBits);
  ------------------
  |  Branch (940:5): [True: 43.2k, False: 0]
  ------------------
  941|      0|    case 6: return ZSTD_hash6Ptr(p, hBits);
  ------------------
  |  Branch (941:5): [True: 0, False: 43.2k]
  ------------------
  942|      0|    case 7: return ZSTD_hash7Ptr(p, hBits);
  ------------------
  |  Branch (942:5): [True: 0, False: 43.2k]
  ------------------
  943|      0|    case 8: return ZSTD_hash8Ptr(p, hBits);
  ------------------
  |  Branch (943:5): [True: 0, False: 43.2k]
  ------------------
  944|  43.2k|    }
  945|  43.2k|}
zstd_fast.c:ZSTD_hash5Ptr:
  910|  43.2k|static size_t ZSTD_hash5Ptr(const void* p, U32 h) { return ZSTD_hash5(MEM_readLE64(p), h, 0); }
zstd_fast.c:ZSTD_hash5:
  909|  43.2k|static size_t ZSTD_hash5(U64 u, U32 h, U64 s) { assert(h <= 64); return (size_t)((((u  << (64-40)) * prime5bytes) ^ s) >> (64-h)) ; }
  ------------------
  |  |   70|  43.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
zstd_fast.c:ZSTD_getLowestPrefixIndex:
 1413|  1.00k|{
 1414|  1.00k|    U32    const maxDistance = 1U << windowLog;
 1415|  1.00k|    U32    const lowestValid = ms->window.dictLimit;
 1416|  1.00k|    U32    const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (1416:33): [True: 0, False: 1.00k]
  ------------------
 1417|  1.00k|    U32    const isDictionary = (ms->loadedDictEnd != 0);
 1418|       |    /* When computing the lowest prefix index we need to take the dictionary into account to handle
 1419|       |     * the edge case where the dictionary and the source are contiguous in memory.
 1420|       |     */
 1421|  1.00k|    U32    const matchLowest = isDictionary ? lowestValid : withinWindow;
  ------------------
  |  Branch (1421:32): [True: 0, False: 1.00k]
  ------------------
 1422|  1.00k|    return matchLowest;
 1423|  1.00k|}
zstd_fast.c:ZSTD_selectAddr:
  632|  34.0k|{
  633|  34.0k|#if defined(__GNUC__) && defined(__x86_64__)
  634|  34.0k|    __asm__ (
  635|  34.0k|        "cmp %1, %2\n"
  636|  34.0k|        "cmova %3, %0\n"
  637|  34.0k|        : "+r"(candidate)
  638|  34.0k|        : "r"(index), "r"(lowLimit), "r"(backup)
  639|  34.0k|        );
  640|  34.0k|    return candidate;
  641|       |#else
  642|       |    return index >= lowLimit ? candidate : backup;
  643|       |#endif
  644|  34.0k|}
zstd_fast.c:ZSTD_count:
  855|  2.34k|{
  856|  2.34k|    const BYTE* const pStart = pIn;
  857|  2.34k|    const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1);
  858|       |
  859|  2.34k|    if (pIn < pInLoopLimit) {
  ------------------
  |  Branch (859:9): [True: 2.31k, False: 36]
  ------------------
  860|  2.31k|        { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  861|  2.31k|          if (diff) return ZSTD_NbCommonBytes(diff); }
  ------------------
  |  Branch (861:15): [True: 1.57k, False: 737]
  ------------------
  862|    737|        pIn+=sizeof(size_t); pMatch+=sizeof(size_t);
  863|    918|        while (pIn < pInLoopLimit) {
  ------------------
  |  Branch (863:16): [True: 836, False: 82]
  ------------------
  864|    836|            size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  865|    836|            if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; }
  ------------------
  |  Branch (865:17): [True: 181, False: 655]
  ------------------
  866|    655|            pIn += ZSTD_NbCommonBytes(diff);
  867|    655|            return (size_t)(pIn - pStart);
  868|    836|    }   }
  869|    118|    if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  Branch (869:9): [True: 118, False: 0]
  |  Branch (869:25): [True: 51, False: 67]
  |  Branch (869:47): [True: 45, False: 6]
  ------------------
  870|    118|    if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (870:9): [True: 104, False: 14]
  |  Branch (870:31): [True: 98, False: 6]
  ------------------
  871|    118|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (871:9): [True: 34, False: 84]
  |  Branch (871:27): [True: 32, False: 2]
  ------------------
  872|    118|    return (size_t)(pIn - pStart);
  873|  2.34k|}
zstd_fast.c:ZSTD_storeSeq:
  780|  2.34k|{
  781|  2.34k|    BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  2.34k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  782|  2.34k|    BYTE const* const litEnd = literals + litLength;
  783|       |#if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6)
  784|       |    static const BYTE* g_start = NULL;
  785|       |    if (g_start==NULL) g_start = (const BYTE*)literals;  /* note : index only works for compression within a single segment */
  786|       |    {   U32 const pos = (U32)((const BYTE*)literals - g_start);
  787|       |        DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u",
  788|       |               pos, (U32)litLength, (U32)matchLength, (U32)offBase);
  789|       |    }
  790|       |#endif
  791|  2.34k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  2.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  792|       |    /* copy Literals */
  793|  2.34k|    assert(seqStorePtr->maxNbLit <= 128 KB);
  ------------------
  |  |   70|  2.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  794|  2.34k|    assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit);
  ------------------
  |  |   70|  2.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  795|  2.34k|    assert(literals + litLength <= litLimit);
  ------------------
  |  |   70|  2.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  796|  2.34k|    if (litEnd <= litLimit_w) {
  ------------------
  |  Branch (796:9): [True: 1.84k, False: 505]
  ------------------
  797|       |        /* Common case we can use wildcopy.
  798|       |         * First copy 16 bytes, because literals are likely short.
  799|       |         */
  800|  1.84k|        ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   43|  1.84k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  1.84k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  801|  1.84k|        ZSTD_copy16(seqStorePtr->lit, literals);
  802|  1.84k|        if (litLength > 16) {
  ------------------
  |  Branch (802:13): [True: 601, False: 1.24k]
  ------------------
  803|    601|            ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, (ptrdiff_t)litLength-16, ZSTD_no_overlap);
  804|    601|        }
  805|  1.84k|    } else {
  806|    505|        ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w);
  807|    505|    }
  808|  2.34k|    seqStorePtr->lit += litLength;
  809|       |
  810|  2.34k|    ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength);
  811|  2.34k|}
zstd_fast.c:ZSTD_safecopyLiterals:
  707|    505|{
  708|    505|    assert(iend > ilimit_w);
  ------------------
  |  |   70|    505|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  709|    505|    if (ip <= ilimit_w) {
  ------------------
  |  Branch (709:9): [True: 328, False: 177]
  ------------------
  710|    328|        ZSTD_wildcopy(op, ip, ilimit_w - ip, ZSTD_no_overlap);
  711|    328|        op += ilimit_w - ip;
  712|    328|        ip = ilimit_w;
  713|    328|    }
  714|  3.29k|    while (ip < iend) *op++ = *ip++;
  ------------------
  |  Branch (714:12): [True: 2.78k, False: 505]
  ------------------
  715|    505|}
zstd_fast.c:ZSTD_storeSeqOnly:
  739|  2.34k|{
  740|  2.34k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  2.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  741|       |
  742|       |    /* literal Length */
  743|  2.34k|    assert(litLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  2.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  744|  2.34k|    if (UNLIKELY(litLength>0xFFFF)) {
  ------------------
  |  |  188|  2.34k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 2.34k]
  |  |  ------------------
  ------------------
  745|      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) */
  ------------------
  746|      0|        seqStorePtr->longLengthType = ZSTD_llt_literalLength;
  747|      0|        seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  748|      0|    }
  749|  2.34k|    seqStorePtr->sequences[0].litLength = (U16)litLength;
  750|       |
  751|       |    /* match offset */
  752|  2.34k|    seqStorePtr->sequences[0].offBase = offBase;
  753|       |
  754|       |    /* match Length */
  755|  2.34k|    assert(matchLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  2.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  756|  2.34k|    assert(matchLength >= MINMATCH);
  ------------------
  |  |   70|  2.34k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  757|  2.34k|    {   size_t const mlBase = matchLength - MINMATCH;
  ------------------
  |  |   98|  2.34k|#define MINMATCH 3
  ------------------
  758|  2.34k|        if (UNLIKELY(mlBase>0xFFFF)) {
  ------------------
  |  |  188|  2.34k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 2.34k]
  |  |  ------------------
  ------------------
  759|      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) */
  ------------------
  760|      0|            seqStorePtr->longLengthType = ZSTD_llt_matchLength;
  761|      0|            seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  762|      0|        }
  763|  2.34k|        seqStorePtr->sequences[0].mlBase = (U16)mlBase;
  764|  2.34k|    }
  765|       |
  766|  2.34k|    seqStorePtr->sequences++;
  767|  2.34k|}
zstd_lazy.c:ZSTD_hashPtr:
  931|   369k|{
  932|       |    /* Although some of these hashes do support hBits up to 64, some do not.
  933|       |     * To be on the safe side, always avoid hBits > 32. */
  934|   369k|    assert(hBits <= 32);
  ------------------
  |  |   70|   369k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  935|       |
  936|   369k|    switch(mls)
  937|   369k|    {
  938|      0|    default:
  ------------------
  |  Branch (938:5): [True: 0, False: 369k]
  ------------------
  939|   369k|    case 4: return ZSTD_hash4Ptr(p, hBits);
  ------------------
  |  Branch (939:5): [True: 369k, False: 0]
  ------------------
  940|      0|    case 5: return ZSTD_hash5Ptr(p, hBits);
  ------------------
  |  Branch (940:5): [True: 0, False: 369k]
  ------------------
  941|      0|    case 6: return ZSTD_hash6Ptr(p, hBits);
  ------------------
  |  Branch (941:5): [True: 0, False: 369k]
  ------------------
  942|      0|    case 7: return ZSTD_hash7Ptr(p, hBits);
  ------------------
  |  Branch (942:5): [True: 0, False: 369k]
  ------------------
  943|      0|    case 8: return ZSTD_hash8Ptr(p, hBits);
  ------------------
  |  Branch (943:5): [True: 0, False: 369k]
  ------------------
  944|   369k|    }
  945|   369k|}
zstd_lazy.c:ZSTD_hash4Ptr:
  905|   369k|static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); }
zstd_lazy.c:ZSTD_hash4:
  904|   369k|static U32    ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; }
  ------------------
  |  |   70|   369k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
zstd_lazy.c:ZSTD_getLowestPrefixIndex:
 1413|  1.99k|{
 1414|  1.99k|    U32    const maxDistance = 1U << windowLog;
 1415|  1.99k|    U32    const lowestValid = ms->window.dictLimit;
 1416|  1.99k|    U32    const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (1416:33): [True: 0, False: 1.99k]
  ------------------
 1417|  1.99k|    U32    const isDictionary = (ms->loadedDictEnd != 0);
 1418|       |    /* When computing the lowest prefix index we need to take the dictionary into account to handle
 1419|       |     * the edge case where the dictionary and the source are contiguous in memory.
 1420|       |     */
 1421|  1.99k|    U32    const matchLowest = isDictionary ? lowestValid : withinWindow;
  ------------------
  |  Branch (1421:32): [True: 0, False: 1.99k]
  ------------------
 1422|  1.99k|    return matchLowest;
 1423|  1.99k|}
zstd_lazy.c:ZSTD_count:
  855|  14.1k|{
  856|  14.1k|    const BYTE* const pStart = pIn;
  857|  14.1k|    const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1);
  858|       |
  859|  14.1k|    if (pIn < pInLoopLimit) {
  ------------------
  |  Branch (859:9): [True: 14.0k, False: 159]
  ------------------
  860|  14.0k|        { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  861|  14.0k|          if (diff) return ZSTD_NbCommonBytes(diff); }
  ------------------
  |  Branch (861:15): [True: 12.1k, False: 1.87k]
  ------------------
  862|  1.87k|        pIn+=sizeof(size_t); pMatch+=sizeof(size_t);
  863|  3.12k|        while (pIn < pInLoopLimit) {
  ------------------
  |  Branch (863:16): [True: 2.37k, False: 755]
  ------------------
  864|  2.37k|            size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  865|  2.37k|            if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; }
  ------------------
  |  Branch (865:17): [True: 1.25k, False: 1.11k]
  ------------------
  866|  1.11k|            pIn += ZSTD_NbCommonBytes(diff);
  867|  1.11k|            return (size_t)(pIn - pStart);
  868|  2.37k|    }   }
  869|    914|    if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  Branch (869:9): [True: 914, False: 0]
  |  Branch (869:25): [True: 553, False: 361]
  |  Branch (869:47): [True: 417, False: 136]
  ------------------
  870|    914|    if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (870:9): [True: 623, False: 291]
  |  Branch (870:31): [True: 498, False: 125]
  ------------------
  871|    914|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (871:9): [True: 474, False: 440]
  |  Branch (871:27): [True: 368, False: 106]
  ------------------
  872|    914|    return (size_t)(pIn - pStart);
  873|  14.1k|}
zstd_lazy.c:ZSTD_getLowestMatchIndex:
 1396|  2.54k|{
 1397|  2.54k|    U32 const maxDistance = 1U << windowLog;
 1398|  2.54k|    U32 const lowestValid = ms->window.lowLimit;
 1399|  2.54k|    U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (1399:30): [True: 0, False: 2.54k]
  ------------------
 1400|  2.54k|    U32 const isDictionary = (ms->loadedDictEnd != 0);
 1401|       |    /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary
 1402|       |     * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't
 1403|       |     * valid for the entire block. So this check is sufficient to find the lowest valid match index.
 1404|       |     */
 1405|  2.54k|    U32 const matchLowest = isDictionary ? lowestValid : withinWindow;
  ------------------
  |  Branch (1405:29): [True: 0, False: 2.54k]
  ------------------
 1406|  2.54k|    return matchLowest;
 1407|  2.54k|}
zstd_lazy.c:ZSTD_storeSeq:
  780|  6.69k|{
  781|  6.69k|    BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  6.69k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  782|  6.69k|    BYTE const* const litEnd = literals + litLength;
  783|       |#if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6)
  784|       |    static const BYTE* g_start = NULL;
  785|       |    if (g_start==NULL) g_start = (const BYTE*)literals;  /* note : index only works for compression within a single segment */
  786|       |    {   U32 const pos = (U32)((const BYTE*)literals - g_start);
  787|       |        DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u",
  788|       |               pos, (U32)litLength, (U32)matchLength, (U32)offBase);
  789|       |    }
  790|       |#endif
  791|  6.69k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  6.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  792|       |    /* copy Literals */
  793|  6.69k|    assert(seqStorePtr->maxNbLit <= 128 KB);
  ------------------
  |  |   70|  6.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  794|  6.69k|    assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit);
  ------------------
  |  |   70|  6.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  795|  6.69k|    assert(literals + litLength <= litLimit);
  ------------------
  |  |   70|  6.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  796|  6.69k|    if (litEnd <= litLimit_w) {
  ------------------
  |  Branch (796:9): [True: 4.84k, False: 1.84k]
  ------------------
  797|       |        /* Common case we can use wildcopy.
  798|       |         * First copy 16 bytes, because literals are likely short.
  799|       |         */
  800|  4.84k|        ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   43|  4.84k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  4.84k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  801|  4.84k|        ZSTD_copy16(seqStorePtr->lit, literals);
  802|  4.84k|        if (litLength > 16) {
  ------------------
  |  Branch (802:13): [True: 1.66k, False: 3.18k]
  ------------------
  803|  1.66k|            ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, (ptrdiff_t)litLength-16, ZSTD_no_overlap);
  804|  1.66k|        }
  805|  4.84k|    } else {
  806|  1.84k|        ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w);
  807|  1.84k|    }
  808|  6.69k|    seqStorePtr->lit += litLength;
  809|       |
  810|  6.69k|    ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength);
  811|  6.69k|}
zstd_lazy.c:ZSTD_safecopyLiterals:
  707|  1.84k|{
  708|  1.84k|    assert(iend > ilimit_w);
  ------------------
  |  |   70|  1.84k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  709|  1.84k|    if (ip <= ilimit_w) {
  ------------------
  |  Branch (709:9): [True: 874, False: 974]
  ------------------
  710|    874|        ZSTD_wildcopy(op, ip, ilimit_w - ip, ZSTD_no_overlap);
  711|    874|        op += ilimit_w - ip;
  712|    874|        ip = ilimit_w;
  713|    874|    }
  714|  12.0k|    while (ip < iend) *op++ = *ip++;
  ------------------
  |  Branch (714:12): [True: 10.1k, False: 1.84k]
  ------------------
  715|  1.84k|}
zstd_lazy.c:ZSTD_storeSeqOnly:
  739|  6.69k|{
  740|  6.69k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  6.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  741|       |
  742|       |    /* literal Length */
  743|  6.69k|    assert(litLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  6.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  744|  6.69k|    if (UNLIKELY(litLength>0xFFFF)) {
  ------------------
  |  |  188|  6.69k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 6.69k]
  |  |  ------------------
  ------------------
  745|      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) */
  ------------------
  746|      0|        seqStorePtr->longLengthType = ZSTD_llt_literalLength;
  747|      0|        seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  748|      0|    }
  749|  6.69k|    seqStorePtr->sequences[0].litLength = (U16)litLength;
  750|       |
  751|       |    /* match offset */
  752|  6.69k|    seqStorePtr->sequences[0].offBase = offBase;
  753|       |
  754|       |    /* match Length */
  755|  6.69k|    assert(matchLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  6.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  756|  6.69k|    assert(matchLength >= MINMATCH);
  ------------------
  |  |   70|  6.69k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  757|  6.69k|    {   size_t const mlBase = matchLength - MINMATCH;
  ------------------
  |  |   98|  6.69k|#define MINMATCH 3
  ------------------
  758|  6.69k|        if (UNLIKELY(mlBase>0xFFFF)) {
  ------------------
  |  |  188|  6.69k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 6.69k]
  |  |  ------------------
  ------------------
  759|      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) */
  ------------------
  760|      0|            seqStorePtr->longLengthType = ZSTD_llt_matchLength;
  761|      0|            seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  762|      0|        }
  763|  6.69k|        seqStorePtr->sequences[0].mlBase = (U16)mlBase;
  764|  6.69k|    }
  765|       |
  766|  6.69k|    seqStorePtr->sequences++;
  767|  6.69k|}
zstd_opt.c:ZSTD_hashPtr:
  931|   336k|{
  932|       |    /* Although some of these hashes do support hBits up to 64, some do not.
  933|       |     * To be on the safe side, always avoid hBits > 32. */
  934|   336k|    assert(hBits <= 32);
  ------------------
  |  |   70|   336k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  935|       |
  936|   336k|    switch(mls)
  937|   336k|    {
  938|   336k|    default:
  ------------------
  |  Branch (938:5): [True: 336k, False: 0]
  ------------------
  939|   336k|    case 4: return ZSTD_hash4Ptr(p, hBits);
  ------------------
  |  Branch (939:5): [True: 0, False: 336k]
  ------------------
  940|      0|    case 5: return ZSTD_hash5Ptr(p, hBits);
  ------------------
  |  Branch (940:5): [True: 0, False: 336k]
  ------------------
  941|      0|    case 6: return ZSTD_hash6Ptr(p, hBits);
  ------------------
  |  Branch (941:5): [True: 0, False: 336k]
  ------------------
  942|      0|    case 7: return ZSTD_hash7Ptr(p, hBits);
  ------------------
  |  Branch (942:5): [True: 0, False: 336k]
  ------------------
  943|      0|    case 8: return ZSTD_hash8Ptr(p, hBits);
  ------------------
  |  Branch (943:5): [True: 0, False: 336k]
  ------------------
  944|   336k|    }
  945|   336k|}
zstd_opt.c:ZSTD_hash4Ptr:
  905|   336k|static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_readLE32(ptr), h, 0); }
zstd_opt.c:ZSTD_hash4:
  904|   336k|static U32    ZSTD_hash4(U32 u, U32 h, U32 s) { assert(h <= 32); return ((u * prime4bytes) ^ s) >> (32-h) ; }
  ------------------
  |  |   70|   336k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
zstd_opt.c:ZSTD_getLowestMatchIndex:
 1396|   336k|{
 1397|   336k|    U32 const maxDistance = 1U << windowLog;
 1398|   336k|    U32 const lowestValid = ms->window.lowLimit;
 1399|   336k|    U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (1399:30): [True: 0, False: 336k]
  ------------------
 1400|   336k|    U32 const isDictionary = (ms->loadedDictEnd != 0);
 1401|       |    /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary
 1402|       |     * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't
 1403|       |     * valid for the entire block. So this check is sufficient to find the lowest valid match index.
 1404|       |     */
 1405|   336k|    U32 const matchLowest = isDictionary ? lowestValid : withinWindow;
  ------------------
  |  Branch (1405:29): [True: 0, False: 336k]
  ------------------
 1406|   336k|    return matchLowest;
 1407|   336k|}
zstd_opt.c:ZSTD_count:
  855|   560k|{
  856|   560k|    const BYTE* const pStart = pIn;
  857|   560k|    const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1);
  858|       |
  859|   560k|    if (pIn < pInLoopLimit) {
  ------------------
  |  Branch (859:9): [True: 557k, False: 3.00k]
  ------------------
  860|   557k|        { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  861|   557k|          if (diff) return ZSTD_NbCommonBytes(diff); }
  ------------------
  |  Branch (861:15): [True: 458k, False: 98.8k]
  ------------------
  862|  98.8k|        pIn+=sizeof(size_t); pMatch+=sizeof(size_t);
  863|   136k|        while (pIn < pInLoopLimit) {
  ------------------
  |  Branch (863:16): [True: 131k, False: 5.27k]
  ------------------
  864|   131k|            size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn);
  865|   131k|            if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; }
  ------------------
  |  Branch (865:17): [True: 37.6k, False: 93.6k]
  ------------------
  866|  93.6k|            pIn += ZSTD_NbCommonBytes(diff);
  867|  93.6k|            return (size_t)(pIn - pStart);
  868|   131k|    }   }
  869|  8.27k|    if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; }
  ------------------
  |  Branch (869:9): [True: 8.27k, False: 0]
  |  Branch (869:25): [True: 6.28k, False: 1.98k]
  |  Branch (869:47): [True: 2.73k, False: 3.55k]
  ------------------
  870|  8.27k|    if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; }
  ------------------
  |  Branch (870:9): [True: 6.98k, False: 1.28k]
  |  Branch (870:31): [True: 2.86k, False: 4.12k]
  ------------------
  871|  8.27k|    if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
  ------------------
  |  Branch (871:9): [True: 7.47k, False: 801]
  |  Branch (871:27): [True: 3.50k, False: 3.96k]
  ------------------
  872|  8.27k|    return (size_t)(pIn - pStart);
  873|   560k|}
zstd_opt.c:ZSTD_hash3Ptr:
  900|   582k|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:
  899|   582k|static U32    ZSTD_hash3(U32 u, U32 h, U32 s) { assert(h <= 32); return (((u << (32-24)) * prime3bytes) ^ s)  >> (32-h) ; }
  ------------------
  |  |   70|   582k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
zstd_opt.c:ZSTD_LLcode:
  585|   786k|{
  586|   786k|    static const BYTE LL_Code[64] = {  0,  1,  2,  3,  4,  5,  6,  7,
  587|   786k|                                       8,  9, 10, 11, 12, 13, 14, 15,
  588|   786k|                                      16, 16, 17, 17, 18, 18, 19, 19,
  589|   786k|                                      20, 20, 20, 20, 21, 21, 21, 21,
  590|   786k|                                      22, 22, 22, 22, 22, 22, 22, 22,
  591|   786k|                                      23, 23, 23, 23, 23, 23, 23, 23,
  592|   786k|                                      24, 24, 24, 24, 24, 24, 24, 24,
  593|   786k|                                      24, 24, 24, 24, 24, 24, 24, 24 };
  594|   786k|    static const U32 LL_deltaCode = 19;
  595|   786k|    return (litLength > 63) ? ZSTD_highbit32(litLength) + LL_deltaCode : LL_Code[litLength];
  ------------------
  |  Branch (595:12): [True: 33.3k, False: 753k]
  ------------------
  596|   786k|}
zstd_opt.c:ZSTD_MLcode:
  602|   788k|{
  603|   788k|    static const BYTE ML_Code[128] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  604|   788k|                                      16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
  605|   788k|                                      32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37,
  606|   788k|                                      38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39,
  607|   788k|                                      40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
  608|   788k|                                      41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
  609|   788k|                                      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
  610|   788k|                                      42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 };
  611|   788k|    static const U32 ML_deltaCode = 36;
  612|   788k|    return (mlBase > 127) ? ZSTD_highbit32(mlBase) + ML_deltaCode : ML_Code[mlBase];
  ------------------
  |  Branch (612:12): [True: 0, False: 788k]
  ------------------
  613|   788k|}
zstd_opt.c:ZSTD_newRep:
  843|  73.0k|{
  844|  73.0k|    Repcodes_t newReps;
  845|  73.0k|    ZSTD_memcpy(&newReps, rep, sizeof(newReps));
  ------------------
  |  |   44|  73.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  846|  73.0k|    ZSTD_updateRep(newReps.rep, offBase, ll0);
  847|  73.0k|    return newReps;
  848|  73.0k|}
zstd_opt.c:ZSTD_updateRep:
  819|  73.0k|{
  820|  73.0k|    if (OFFBASE_IS_OFFSET(offBase)) {  /* full offset */
  ------------------
  |  |  723|  73.0k|#define OFFBASE_IS_OFFSET(o)  ((o) > ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  73.0k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  |  |  |  Branch (723:31): [True: 19.6k, False: 53.4k]
  |  |  ------------------
  ------------------
  821|  19.6k|        rep[2] = rep[1];
  822|  19.6k|        rep[1] = rep[0];
  823|  19.6k|        rep[0] = OFFBASE_TO_OFFSET(offBase);
  ------------------
  |  |  725|  19.6k|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  19.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  19.6k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  824|  53.4k|    } else {   /* repcode */
  825|  53.4k|        U32 const repCode = OFFBASE_TO_REPCODE(offBase) - 1 + ll0;
  ------------------
  |  |  726|  53.4k|#define OFFBASE_TO_REPCODE(o) (assert(OFFBASE_IS_REPCODE(o)), (o))  /* returns ID 1,2,3 */
  |  |  ------------------
  |  |  |  |   70|  53.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  ------------------
  826|  53.4k|        if (repCode > 0) {  /* note : if repCode==0, no change */
  ------------------
  |  Branch (826:13): [True: 10.6k, False: 42.7k]
  ------------------
  827|  10.6k|            U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode];
  ------------------
  |  |   64|  10.6k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (827:39): [True: 116, False: 10.5k]
  ------------------
  828|  10.6k|            rep[2] = (repCode >= 2) ? rep[1] : rep[2];
  ------------------
  |  Branch (828:22): [True: 4.08k, False: 6.58k]
  ------------------
  829|  10.6k|            rep[1] = rep[0];
  830|  10.6k|            rep[0] = currentOffset;
  831|  42.7k|        } else {   /* repCode == 0 */
  832|       |            /* nothing to do */
  833|  42.7k|        }
  834|  53.4k|    }
  835|  73.0k|}
zstd_opt.c:ZSTD_storeSeq:
  780|  12.1k|{
  781|  12.1k|    BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  12.1k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  782|  12.1k|    BYTE const* const litEnd = literals + litLength;
  783|       |#if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6)
  784|       |    static const BYTE* g_start = NULL;
  785|       |    if (g_start==NULL) g_start = (const BYTE*)literals;  /* note : index only works for compression within a single segment */
  786|       |    {   U32 const pos = (U32)((const BYTE*)literals - g_start);
  787|       |        DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offBase%7u",
  788|       |               pos, (U32)litLength, (U32)matchLength, (U32)offBase);
  789|       |    }
  790|       |#endif
  791|  12.1k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  792|       |    /* copy Literals */
  793|  12.1k|    assert(seqStorePtr->maxNbLit <= 128 KB);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  794|  12.1k|    assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  795|  12.1k|    assert(literals + litLength <= litLimit);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  796|  12.1k|    if (litEnd <= litLimit_w) {
  ------------------
  |  Branch (796:9): [True: 9.40k, False: 2.75k]
  ------------------
  797|       |        /* Common case we can use wildcopy.
  798|       |         * First copy 16 bytes, because literals are likely short.
  799|       |         */
  800|  9.40k|        ZSTD_STATIC_ASSERT(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   43|  9.40k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  9.40k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
  801|  9.40k|        ZSTD_copy16(seqStorePtr->lit, literals);
  802|  9.40k|        if (litLength > 16) {
  ------------------
  |  Branch (802:13): [True: 1.53k, False: 7.87k]
  ------------------
  803|  1.53k|            ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, (ptrdiff_t)litLength-16, ZSTD_no_overlap);
  804|  1.53k|        }
  805|  9.40k|    } else {
  806|  2.75k|        ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w);
  807|  2.75k|    }
  808|  12.1k|    seqStorePtr->lit += litLength;
  809|       |
  810|  12.1k|    ZSTD_storeSeqOnly(seqStorePtr, litLength, offBase, matchLength);
  811|  12.1k|}
zstd_opt.c:ZSTD_safecopyLiterals:
  707|  2.75k|{
  708|  2.75k|    assert(iend > ilimit_w);
  ------------------
  |  |   70|  2.75k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  709|  2.75k|    if (ip <= ilimit_w) {
  ------------------
  |  Branch (709:9): [True: 1.22k, False: 1.53k]
  ------------------
  710|  1.22k|        ZSTD_wildcopy(op, ip, ilimit_w - ip, ZSTD_no_overlap);
  711|  1.22k|        op += ilimit_w - ip;
  712|  1.22k|        ip = ilimit_w;
  713|  1.22k|    }
  714|  17.5k|    while (ip < iend) *op++ = *ip++;
  ------------------
  |  Branch (714:12): [True: 14.8k, False: 2.75k]
  ------------------
  715|  2.75k|}
zstd_opt.c:ZSTD_storeSeqOnly:
  739|  12.1k|{
  740|  12.1k|    assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  741|       |
  742|       |    /* literal Length */
  743|  12.1k|    assert(litLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  744|  12.1k|    if (UNLIKELY(litLength>0xFFFF)) {
  ------------------
  |  |  188|  12.1k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 12.1k]
  |  |  ------------------
  ------------------
  745|      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) */
  ------------------
  746|      0|        seqStorePtr->longLengthType = ZSTD_llt_literalLength;
  747|      0|        seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  748|      0|    }
  749|  12.1k|    seqStorePtr->sequences[0].litLength = (U16)litLength;
  750|       |
  751|       |    /* match offset */
  752|  12.1k|    seqStorePtr->sequences[0].offBase = offBase;
  753|       |
  754|       |    /* match Length */
  755|  12.1k|    assert(matchLength <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  756|  12.1k|    assert(matchLength >= MINMATCH);
  ------------------
  |  |   70|  12.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  757|  12.1k|    {   size_t const mlBase = matchLength - MINMATCH;
  ------------------
  |  |   98|  12.1k|#define MINMATCH 3
  ------------------
  758|  12.1k|        if (UNLIKELY(mlBase>0xFFFF)) {
  ------------------
  |  |  188|  12.1k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 12.1k]
  |  |  ------------------
  ------------------
  759|      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) */
  ------------------
  760|      0|            seqStorePtr->longLengthType = ZSTD_llt_matchLength;
  761|      0|            seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart);
  762|      0|        }
  763|  12.1k|        seqStorePtr->sequences[0].mlBase = (U16)mlBase;
  764|  12.1k|    }
  765|       |
  766|  12.1k|    seqStorePtr->sequences++;
  767|  12.1k|}

ZSTD_noCompressLiterals:
   40|  2.71k|{
   41|  2.71k|    BYTE* const ostart = (BYTE*)dst;
   42|  2.71k|    U32   const flSize = 1 + (srcSize>31) + (srcSize>4095);
   43|       |
   44|  2.71k|    DEBUGLOG(5, "ZSTD_noCompressLiterals: srcSize=%zu, dstCapacity=%zu", srcSize, dstCapacity);
  ------------------
  |  |  104|  2.71k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.71k]
  |  |  ------------------
  ------------------
   45|       |
   46|  2.71k|    RETURN_ERROR_IF(srcSize + flSize > dstCapacity, dstSize_tooSmall, "");
  ------------------
  |  |  114|  2.71k|    do {                                                                       \
  |  |  115|  2.71k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1.06k, False: 1.65k]
  |  |  ------------------
  |  |  116|  1.06k|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|  1.06k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|  1.06k|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|  1.06k|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|  1.06k|    do {                                           \
  |  |  |  |   99|  1.06k|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|  1.06k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|  1.06k|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|  1.06k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|  1.06k|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|  1.06k|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|  1.06k|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|  1.06k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|  1.06k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  1.06k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|  1.06k|        }                                                                      \
  |  |  123|  2.71k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.65k]
  |  |  ------------------
  ------------------
   47|       |
   48|  1.65k|    switch(flSize)
   49|  1.65k|    {
   50|    723|        case 1: /* 2 - 1 - 5 */
  ------------------
  |  Branch (50:9): [True: 723, False: 929]
  ------------------
   51|    723|            ostart[0] = (BYTE)((U32)set_basic + (srcSize<<3));
   52|    723|            break;
   53|    929|        case 2: /* 2 - 2 - 12 */
  ------------------
  |  Branch (53:9): [True: 929, False: 723]
  ------------------
   54|    929|            MEM_writeLE16(ostart, (U16)((U32)set_basic + (1<<2) + (srcSize<<4)));
   55|    929|            break;
   56|      0|        case 3: /* 2 - 2 - 20 */
  ------------------
  |  Branch (56:9): [True: 0, False: 1.65k]
  ------------------
   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.65k]
  ------------------
   60|      0|            assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   61|  1.65k|    }
   62|       |
   63|  1.65k|    ZSTD_memcpy(ostart + flSize, src, srcSize);
  ------------------
  |  |   44|  1.65k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
   64|  1.65k|    DEBUGLOG(5, "Raw (uncompressed) literals: %u -> %u", (U32)srcSize, (U32)(srcSize + flSize));
  ------------------
  |  |  104|  1.65k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.65k]
  |  |  ------------------
  ------------------
   65|  1.65k|    return srcSize + flSize;
   66|  1.65k|}
ZSTD_compressLiterals:
  139|  4.97k|{
  140|  4.97k|    size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB);
  ------------------
  |  |   67|  4.97k|#define KB *(1 <<10)
  ------------------
                  size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB);
  ------------------
  |  |   67|  4.97k|#define KB *(1 <<10)
  ------------------
  141|  4.97k|    BYTE*  const ostart = (BYTE*)dst;
  142|  4.97k|    U32 singleStream = srcSize < 256;
  143|  4.97k|    SymbolEncodingType_e hType = set_compressed;
  144|  4.97k|    size_t cLitSize;
  145|       |
  146|  4.97k|    DEBUGLOG(5,"ZSTD_compressLiterals (disableLiteralCompression=%i, srcSize=%u, dstCapacity=%zu)",
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
  147|  4.97k|                disableLiteralCompression, (U32)srcSize, dstCapacity);
  148|       |
  149|  4.97k|    DEBUGLOG(6, "Completed literals listing (%zu bytes)", showHexa(src, srcSize));
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
  150|       |
  151|       |    /* Prepare nextEntropy assuming reusing the existing table */
  152|  4.97k|    ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf));
  ------------------
  |  |   44|  4.97k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  153|       |
  154|  4.97k|    if (disableLiteralCompression)
  ------------------
  |  Branch (154:9): [True: 0, False: 4.97k]
  ------------------
  155|      0|        return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize);
  156|       |
  157|       |    /* if too small, don't even attempt compression (speed opt) */
  158|  4.97k|    if (srcSize < ZSTD_minLiteralsToCompress(strategy, prevHuf->repeatMode))
  ------------------
  |  Branch (158:9): [True: 998, False: 3.97k]
  ------------------
  159|    998|        return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize);
  160|       |
  161|  3.97k|    RETURN_ERROR_IF(dstCapacity < lhSize+1, dstSize_tooSmall, "not enough space for compression");
  ------------------
  |  |  114|  3.97k|    do {                                                                       \
  |  |  115|  3.97k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.97k]
  |  |  ------------------
  |  |  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.97k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.97k]
  |  |  ------------------
  ------------------
  162|  3.97k|    {   HUF_repeat repeat = prevHuf->repeatMode;
  163|  3.97k|        int const flags = 0
  164|  3.97k|            | (bmi2 ? HUF_flags_bmi2 : 0)
  ------------------
  |  Branch (164:16): [True: 3.97k, False: 0]
  ------------------
  165|  3.97k|            | (strategy < ZSTD_lazy && srcSize <= 1024 ? HUF_flags_preferRepeat : 0)
  ------------------
  |  Branch (165:16): [True: 323, False: 3.65k]
  |  Branch (165:40): [True: 323, False: 0]
  ------------------
  166|  3.97k|            | (strategy >= HUF_OPTIMAL_DEPTH_THRESHOLD ? HUF_flags_optimalDepth : 0)
  ------------------
  |  |  117|  3.97k|#define HUF_OPTIMAL_DEPTH_THRESHOLD ZSTD_btultra
  ------------------
  |  Branch (166:16): [True: 2.20k, False: 1.76k]
  ------------------
  167|  3.97k|            | (suspectUncompressible ? HUF_flags_suspectUncompressible : 0);
  ------------------
  |  Branch (167:16): [True: 2.71k, False: 1.26k]
  ------------------
  168|       |
  169|  3.97k|        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.97k|        huf_compress_f huf_compress;
  171|  3.97k|        if (repeat == HUF_repeat_valid && lhSize == 3) singleStream = 1;
  ------------------
  |  Branch (171:13): [True: 0, False: 3.97k]
  |  Branch (171:43): [True: 0, False: 0]
  ------------------
  172|  3.97k|        huf_compress = singleStream ? HUF_compress1X_repeat : HUF_compress4X_repeat;
  ------------------
  |  Branch (172:24): [True: 3.97k, False: 0]
  ------------------
  173|  3.97k|        cLitSize = huf_compress(ostart+lhSize, dstCapacity-lhSize,
  174|  3.97k|                                src, srcSize,
  175|  3.97k|                                HUF_SYMBOLVALUE_MAX, LitHufLog,
  ------------------
  |  |   39|  3.97k|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
                                              HUF_SYMBOLVALUE_MAX, LitHufLog,
  ------------------
  |  |  101|  3.97k|#define LitHufLog 11
  ------------------
  176|  3.97k|                                entropyWorkspace, entropyWorkspaceSize,
  177|  3.97k|                                (HUF_CElt*)nextHuf->CTable,
  178|  3.97k|                                &repeat, flags);
  179|  3.97k|        DEBUGLOG(5, "%zu literals compressed into %zu bytes (before header)", srcSize, cLitSize);
  ------------------
  |  |  104|  3.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.97k]
  |  |  ------------------
  ------------------
  180|  3.97k|        if (repeat != HUF_repeat_none) {
  ------------------
  |  Branch (180:13): [True: 0, False: 3.97k]
  ------------------
  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.97k|    }
  186|       |
  187|  3.97k|    {   size_t const minGain = ZSTD_minGain(srcSize, strategy);
  188|  3.97k|        if ((cLitSize==0) || (cLitSize >= srcSize - minGain) || ERR_isError(cLitSize)) {
  ------------------
  |  Branch (188:13): [True: 1.66k, False: 2.31k]
  |  Branch (188:30): [True: 58, False: 2.25k]
  |  Branch (188:65): [True: 0, False: 2.25k]
  ------------------
  189|  1.71k|            ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf));
  ------------------
  |  |   44|  1.71k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  190|  1.71k|            return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize);
  191|  1.71k|    }   }
  192|  2.25k|    if (cLitSize==1) {
  ------------------
  |  Branch (192:9): [True: 0, False: 2.25k]
  ------------------
  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|  2.25k|    if (hType == set_compressed) {
  ------------------
  |  Branch (203:9): [True: 2.25k, False: 0]
  ------------------
  204|       |        /* using a newly constructed table */
  205|  2.25k|        nextHuf->repeatMode = HUF_repeat_check;
  206|  2.25k|    }
  207|       |
  208|       |    /* Build header */
  209|  2.25k|    switch(lhSize)
  210|  2.25k|    {
  211|  2.25k|    case 3: /* 2 - 2 - 10 - 10 */
  ------------------
  |  Branch (211:5): [True: 2.25k, False: 0]
  ------------------
  212|  2.25k|        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: 2.25k]
  ------------------
  213|  2.25k|        {   U32 const lhc = hType + ((U32)(!singleStream) << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<14);
  214|  2.25k|            MEM_writeLE24(ostart, lhc);
  215|  2.25k|            break;
  216|      0|        }
  217|      0|    case 4: /* 2 - 2 - 14 - 14 */
  ------------------
  |  Branch (217:5): [True: 0, False: 2.25k]
  ------------------
  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: 2.25k]
  ------------------
  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: 2.25k]
  ------------------
  231|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  232|  2.25k|    }
  233|  2.25k|    DEBUGLOG(5, "Compressed literals: %u -> %u", (U32)srcSize, (U32)(lhSize+cLitSize));
  ------------------
  |  |  104|  2.25k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.25k]
  |  |  ------------------
  ------------------
  234|  2.25k|    return lhSize+cLitSize;
  235|  2.25k|}
zstd_compress_literals.c:ZSTD_minLiteralsToCompress:
  116|  4.97k|{
  117|  4.97k|    assert((int)strategy >= 0);
  ------------------
  |  |   70|  4.97k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  118|  4.97k|    assert((int)strategy <= 9);
  ------------------
  |  |   70|  4.97k|#    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.97k|    {   int const shift = MIN(9-(int)strategy, 3);
  ------------------
  |  |   54|  4.97k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 2.47k, False: 2.49k]
  |  |  ------------------
  ------------------
  123|  4.97k|        size_t const mintc = (huf_repeat == HUF_repeat_valid) ? 6 : (size_t)8 << shift;
  ------------------
  |  Branch (123:30): [True: 0, False: 4.97k]
  ------------------
  124|  4.97k|        DEBUGLOG(7, "minLiteralsToCompress = %zu", mintc);
  ------------------
  |  |  104|  4.97k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.97k]
  |  |  ------------------
  ------------------
  125|  4.97k|        return mintc;
  126|  4.97k|    }
  127|  4.97k|}

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

zstd_compress.c:ZSTD_cwksp_init:
  674|     38|MEM_STATIC void ZSTD_cwksp_init(ZSTD_cwksp* ws, void* start, size_t size, ZSTD_cwksp_static_alloc_e isStatic) {
  675|     38|    DEBUGLOG(4, "cwksp: init'ing workspace with %zd bytes", size);
  ------------------
  |  |  104|     38|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 38]
  |  |  ------------------
  ------------------
  676|     38|    assert(((size_t)start & (sizeof(void*)-1)) == 0); /* ensure correct alignment */
  ------------------
  |  |   70|     38|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  677|     38|    ws->workspace = start;
  678|     38|    ws->workspaceEnd = (BYTE*)start + size;
  679|     38|    ws->objectEnd = ws->workspace;
  680|     38|    ws->tableValidEnd = ws->objectEnd;
  681|     38|    ws->initOnceStart = ZSTD_cwksp_initialAllocStart(ws);
  682|     38|    ws->phase = ZSTD_cwksp_alloc_objects;
  683|     38|    ws->isStatic = isStatic;
  684|     38|    ZSTD_cwksp_clear(ws);
  685|     38|    ws->workspaceOversizedDuration = 0;
  686|     38|    ZSTD_cwksp_assert_internal_consistency(ws);
  687|     38|}
zstd_compress.c:ZSTD_cwksp_initialAllocStart:
  276|  5.11k|{
  277|  5.11k|    char* endPtr = (char*)ws->workspaceEnd;
  278|  5.11k|    assert(ZSTD_isPower2(ZSTD_CWKSP_ALIGNMENT_BYTES));
  ------------------
  |  |   70|  5.11k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  279|  5.11k|    endPtr = endPtr - ((size_t)endPtr % ZSTD_CWKSP_ALIGNMENT_BYTES);
  ------------------
  |  |   39|  5.11k|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  280|  5.11k|    return (void*)endPtr;
  281|  5.11k|}
zstd_compress.c:ZSTD_cwksp_clear:
  623|  5.03k|MEM_STATIC void ZSTD_cwksp_clear(ZSTD_cwksp* ws) {
  624|  5.03k|    DEBUGLOG(4, "cwksp: clearing!");
  ------------------
  |  |  104|  5.03k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.03k]
  |  |  ------------------
  ------------------
  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|  5.03k|    ws->tableEnd = ws->objectEnd;
  652|  5.03k|    ws->allocStart = ZSTD_cwksp_initialAllocStart(ws);
  653|  5.03k|    ws->allocFailed = 0;
  654|  5.03k|    if (ws->phase > ZSTD_cwksp_alloc_aligned_init_once) {
  ------------------
  |  Branch (654:9): [True: 4.96k, False: 76]
  ------------------
  655|  4.96k|        ws->phase = ZSTD_cwksp_alloc_aligned_init_once;
  656|  4.96k|    }
  657|  5.03k|    ZSTD_cwksp_assert_internal_consistency(ws);
  658|  5.03k|}
zstd_compress.c:ZSTD_cwksp_assert_internal_consistency:
  178|  80.4k|MEM_STATIC void ZSTD_cwksp_assert_internal_consistency(ZSTD_cwksp* ws) {
  179|  80.4k|    (void)ws;
  180|  80.4k|    assert(ws->workspace <= ws->objectEnd);
  ------------------
  |  |   70|  80.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  181|  80.4k|    assert(ws->objectEnd <= ws->tableEnd);
  ------------------
  |  |   70|  80.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  182|  80.4k|    assert(ws->objectEnd <= ws->tableValidEnd);
  ------------------
  |  |   70|  80.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  183|  80.4k|    assert(ws->tableEnd <= ws->allocStart);
  ------------------
  |  |   70|  80.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  184|  80.4k|    assert(ws->tableValidEnd <= ws->allocStart);
  ------------------
  |  |   70|  80.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  185|  80.4k|    assert(ws->allocStart <= ws->workspaceEnd);
  ------------------
  |  |   70|  80.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  186|  80.4k|    assert(ws->initOnceStart <= ZSTD_cwksp_initialAllocStart(ws));
  ------------------
  |  |   70|  80.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  187|  80.4k|    assert(ws->workspace <= ws->initOnceStart);
  ------------------
  |  |   70|  80.4k|#    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|  80.4k|}
zstd_compress.c:ZSTD_cwksp_reserve_object:
  492|    114|{
  493|    114|    size_t const roundedBytes = ZSTD_cwksp_align(bytes, sizeof(void*));
  494|    114|    void* alloc = ws->objectEnd;
  495|    114|    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|    114|    DEBUGLOG(4,
  ------------------
  |  |  104|    114|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 114]
  |  |  ------------------
  ------------------
  503|    114|        "cwksp: reserving %p object %zd bytes (rounded to %zd), %zd bytes remaining",
  504|    114|        alloc, bytes, roundedBytes, ZSTD_cwksp_available_space(ws) - roundedBytes);
  505|    114|    assert((size_t)alloc % ZSTD_ALIGNOF(void*) == 0);
  ------------------
  |  |   70|    114|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  506|    114|    assert(bytes % ZSTD_ALIGNOF(void*) == 0);
  ------------------
  |  |   70|    114|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  507|    114|    ZSTD_cwksp_assert_internal_consistency(ws);
  508|       |    /* we must be in the first phase, no advance is possible */
  509|    114|    if (ws->phase != ZSTD_cwksp_alloc_objects || end > ws->workspaceEnd) {
  ------------------
  |  Branch (509:9): [True: 0, False: 114]
  |  Branch (509:50): [True: 0, False: 114]
  ------------------
  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|    114|    ws->objectEnd = end;
  515|    114|    ws->tableEnd = end;
  516|    114|    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|    114|    return alloc;
  528|    114|}
zstd_compress.c:ZSTD_cwksp_check_available:
  742|  10.0k|MEM_STATIC int ZSTD_cwksp_check_available(ZSTD_cwksp* ws, size_t additionalNeededSpace) {
  743|  10.0k|    return ZSTD_cwksp_available_space(ws) >= additionalNeededSpace;
  744|  10.0k|}
zstd_compress.c:ZSTD_cwksp_available_space:
  738|  10.0k|MEM_STATIC size_t ZSTD_cwksp_available_space(ZSTD_cwksp* ws) {
  739|  10.0k|    return (size_t)((BYTE*)ws->allocStart - (BYTE*)ws->tableEnd);
  740|  10.0k|}
zstd_compress.c:ZSTD_cwksp_owns_buffer:
  353|     38|{
  354|     38|    return (ptr != NULL) && (ws->workspace <= ptr) && (ptr < ws->workspaceEnd);
  ------------------
  |  Branch (354:12): [True: 38, False: 0]
  |  Branch (354:29): [True: 0, False: 38]
  |  Branch (354:55): [True: 0, False: 0]
  ------------------
  355|     38|}
zstd_compress.c:ZSTD_cwksp_sizeof:
  660|  7.98k|MEM_STATIC size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp* ws) {
  661|  7.98k|    return (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->workspace);
  662|  7.98k|}
zstd_compress.c:ZSTD_cwksp_aligned64_alloc_size:
  242|  35.0k|MEM_STATIC size_t ZSTD_cwksp_aligned64_alloc_size(size_t size) {
  243|  35.0k|    return ZSTD_cwksp_aligned_alloc_size(size, ZSTD_CWKSP_ALIGNMENT_BYTES);
  ------------------
  |  |   39|  35.0k|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  244|  35.0k|}
zstd_compress.c:ZSTD_cwksp_aligned_alloc_size:
  234|  35.0k|MEM_STATIC size_t ZSTD_cwksp_aligned_alloc_size(size_t size, size_t alignment) {
  235|  35.0k|    return ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(size, alignment));
  236|  35.0k|}
zstd_compress.c:ZSTD_cwksp_bump_oversized_duration:
  757|  5.00k|        ZSTD_cwksp* ws, size_t additionalNeededSpace) {
  758|  5.00k|    if (ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)) {
  ------------------
  |  Branch (758:9): [True: 5.00k, False: 0]
  ------------------
  759|  5.00k|        ws->workspaceOversizedDuration++;
  760|  5.00k|    } else {
  761|      0|        ws->workspaceOversizedDuration = 0;
  762|      0|    }
  763|  5.00k|}
zstd_compress.c:ZSTD_cwksp_check_too_large:
  746|  10.0k|MEM_STATIC int ZSTD_cwksp_check_too_large(ZSTD_cwksp* ws, size_t additionalNeededSpace) {
  747|  10.0k|    return ZSTD_cwksp_check_available(
  748|  10.0k|        ws, additionalNeededSpace * ZSTD_WORKSPACETOOLARGE_FACTOR);
  ------------------
  |  |  258|  10.0k|#define ZSTD_WORKSPACETOOLARGE_FACTOR 3
  ------------------
  749|  10.0k|}
zstd_compress.c:ZSTD_cwksp_check_wasteful:
  751|  5.00k|MEM_STATIC int ZSTD_cwksp_check_wasteful(ZSTD_cwksp* ws, size_t additionalNeededSpace) {
  752|  5.00k|    return ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)
  ------------------
  |  Branch (752:12): [True: 0, False: 5.00k]
  ------------------
  753|      0|        && ws->workspaceOversizedDuration > ZSTD_WORKSPACETOOLARGE_MAXDURATION;
  ------------------
  |  |  265|      0|#define ZSTD_WORKSPACETOOLARGE_MAXDURATION 128
  ------------------
  |  Branch (753:12): [True: 0, False: 0]
  ------------------
  754|  5.00k|}
zstd_compress.c:ZSTD_cwksp_create:
  689|     38|MEM_STATIC size_t ZSTD_cwksp_create(ZSTD_cwksp* ws, size_t size, ZSTD_customMem customMem) {
  690|     38|    void* workspace = ZSTD_customMalloc(size, customMem);
  691|     38|    DEBUGLOG(4, "cwksp: creating new workspace with %zd bytes", size);
  ------------------
  |  |  104|     38|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 38]
  |  |  ------------------
  ------------------
  692|     38|    RETURN_ERROR_IF(workspace == NULL, memory_allocation, "NULL pointer!");
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
  693|     38|    ZSTD_cwksp_init(ws, workspace, size, ZSTD_cwksp_dynamic_alloc);
  694|     38|    return 0;
  695|     38|}
zstd_compress.c:ZSTD_cwksp_clear_tables:
  601|  5.00k|{
  602|  5.00k|    DEBUGLOG(4, "cwksp: clearing tables!");
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  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|  5.00k|    ws->tableEnd = ws->objectEnd;
  616|  5.00k|    ZSTD_cwksp_assert_internal_consistency(ws);
  617|  5.00k|}
zstd_compress.c:ZSTD_cwksp_reserve_table:
  447|  15.0k|{
  448|  15.0k|    const ZSTD_cwksp_alloc_phase_e phase = ZSTD_cwksp_alloc_aligned_init_once;
  449|  15.0k|    void* alloc;
  450|  15.0k|    void* end;
  451|  15.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|  15.0k|    if(ws->phase < phase) {
  ------------------
  |  Branch (455:8): [True: 38, False: 14.9k]
  ------------------
  456|     38|        if (ZSTD_isError(ZSTD_cwksp_internal_advance_phase(ws, phase))) {
  ------------------
  |  |   44|     38|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (456:13): [True: 0, False: 38]
  ------------------
  457|      0|            return NULL;
  458|      0|        }
  459|     38|    }
  460|  15.0k|    alloc = ws->tableEnd;
  461|  15.0k|    end = (BYTE *)alloc + bytes;
  462|  15.0k|    top = ws->allocStart;
  463|       |
  464|  15.0k|    DEBUGLOG(5, "cwksp: reserving %p table %zd bytes, %zd bytes remaining",
  ------------------
  |  |  104|  15.0k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 15.0k]
  |  |  ------------------
  ------------------
  465|  15.0k|        alloc, bytes, ZSTD_cwksp_available_space(ws) - bytes);
  466|  15.0k|    assert((bytes & (sizeof(U32)-1)) == 0);
  ------------------
  |  |   70|  15.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  467|  15.0k|    ZSTD_cwksp_assert_internal_consistency(ws);
  468|  15.0k|    assert(end <= top);
  ------------------
  |  |   70|  15.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  469|  15.0k|    if (end > top) {
  ------------------
  |  Branch (469:9): [True: 0, False: 15.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|  15.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|  15.0k|    assert((bytes & (ZSTD_CWKSP_ALIGNMENT_BYTES-1)) == 0);
  ------------------
  |  |   70|  15.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  483|  15.0k|    assert(((size_t)alloc & (ZSTD_CWKSP_ALIGNMENT_BYTES-1)) == 0);
  ------------------
  |  |   70|  15.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  484|  15.0k|    return alloc;
  485|  15.0k|}
zstd_compress.c:ZSTD_cwksp_internal_advance_phase:
  320|  49.9k|{
  321|  49.9k|    assert(phase >= ws->phase);
  ------------------
  |  |   70|  49.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  322|  49.9k|    if (phase > ws->phase) {
  ------------------
  |  Branch (322:9): [True: 10.0k, False: 39.8k]
  ------------------
  323|       |        /* Going from allocating objects to allocating initOnce / tables */
  324|  10.0k|        if (ws->phase < ZSTD_cwksp_alloc_aligned_init_once &&
  ------------------
  |  Branch (324:13): [True: 38, False: 10.0k]
  ------------------
  325|     38|            phase >= ZSTD_cwksp_alloc_aligned_init_once) {
  ------------------
  |  Branch (325:13): [True: 38, False: 0]
  ------------------
  326|     38|            ws->tableValidEnd = ws->objectEnd;
  327|     38|            ws->initOnceStart = ZSTD_cwksp_initialAllocStart(ws);
  328|       |
  329|     38|            {   /* Align the start of the tables to 64 bytes. Use [0, 63] bytes */
  330|     38|                void *const alloc = ws->objectEnd;
  331|     38|                size_t const bytesToAlign = ZSTD_cwksp_bytes_to_align_ptr(alloc, ZSTD_CWKSP_ALIGNMENT_BYTES);
  ------------------
  |  |   39|     38|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  332|     38|                void *const objectEnd = (BYTE *) alloc + bytesToAlign;
  333|     38|                DEBUGLOG(5, "reserving table alignment addtl space: %zu", bytesToAlign);
  ------------------
  |  |  104|     38|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 38]
  |  |  ------------------
  ------------------
  334|     38|                RETURN_ERROR_IF(objectEnd > ws->workspaceEnd, memory_allocation,
  ------------------
  |  |  114|     38|    do {                                                                       \
  |  |  115|     38|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 38]
  |  |  ------------------
  |  |  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|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
  335|     38|                                "table phase - alignment initial allocation failed!");
  336|     38|                ws->objectEnd = objectEnd;
  337|     38|                ws->tableEnd = objectEnd;  /* table area starts being empty */
  338|     38|                if (ws->tableValidEnd < ws->tableEnd) {
  ------------------
  |  Branch (338:21): [True: 38, False: 0]
  ------------------
  339|     38|                    ws->tableValidEnd = ws->tableEnd;
  340|     38|                }
  341|     38|            }
  342|     38|        }
  343|  10.0k|        ws->phase = phase;
  344|  10.0k|        ZSTD_cwksp_assert_internal_consistency(ws);
  345|  10.0k|    }
  346|  49.9k|    return 0;
  347|  49.9k|}
zstd_compress.c:ZSTD_cwksp_bytes_to_align_ptr:
  263|     38|MEM_STATIC size_t ZSTD_cwksp_bytes_to_align_ptr(void* ptr, const size_t alignBytes) {
  264|     38|    size_t const alignBytesMask = alignBytes - 1;
  265|     38|    size_t const bytes = (alignBytes - ((size_t)ptr & (alignBytesMask))) & alignBytesMask;
  266|     38|    assert(ZSTD_isPower2(alignBytes));
  ------------------
  |  |   70|     38|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  267|     38|    assert(bytes < alignBytes);
  ------------------
  |  |   70|     38|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  268|     38|    return bytes;
  269|     38|}
zstd_compress.c:ZSTD_cwksp_reserve_failed:
  718|  10.0k|MEM_STATIC int ZSTD_cwksp_reserve_failed(const ZSTD_cwksp* ws) {
  719|  10.0k|    return ws->allocFailed;
  720|  10.0k|}
zstd_compress.c:ZSTD_cwksp_clean_tables:
  586|  5.00k|MEM_STATIC void ZSTD_cwksp_clean_tables(ZSTD_cwksp* ws) {
  587|  5.00k|    DEBUGLOG(4, "cwksp: ZSTD_cwksp_clean_tables");
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  588|  5.00k|    assert(ws->tableValidEnd >= ws->objectEnd);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  589|  5.00k|    assert(ws->tableValidEnd <= ws->allocStart);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  590|  5.00k|    if (ws->tableValidEnd < ws->tableEnd) {
  ------------------
  |  Branch (590:9): [True: 38, False: 4.96k]
  ------------------
  591|     38|        ZSTD_memset(ws->tableValidEnd, 0, (size_t)((BYTE*)ws->tableEnd - (BYTE*)ws->tableValidEnd));
  ------------------
  |  |   46|     38|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  592|     38|    }
  593|  5.00k|    ZSTD_cwksp_mark_tables_clean(ws);
  594|  5.00k|}
zstd_compress.c:ZSTD_cwksp_reserve_internal:
  362|  49.8k|{
  363|  49.8k|    void* alloc;
  364|  49.8k|    if (ZSTD_isError(ZSTD_cwksp_internal_advance_phase(ws, phase)) || bytes == 0) {
  ------------------
  |  |   44|  49.8k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (364:9): [True: 0, False: 49.8k]
  |  Branch (364:71): [True: 10.0k, False: 39.8k]
  ------------------
  365|  10.0k|        return NULL;
  366|  10.0k|    }
  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|  39.8k|    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|  39.8k|    return alloc;
  389|  49.8k|}
zstd_compress.c:ZSTD_cwksp_reserve_internal_buffer_space:
  292|  39.8k|{
  293|  39.8k|    void* const alloc = (BYTE*)ws->allocStart - bytes;
  294|  39.8k|    void* const bottom = ws->tableEnd;
  295|  39.8k|    DEBUGLOG(5, "cwksp: reserving [0x%p]:%zd bytes; %zd bytes remaining",
  ------------------
  |  |  104|  39.8k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 39.8k]
  |  |  ------------------
  ------------------
  296|  39.8k|        alloc, bytes, ZSTD_cwksp_available_space(ws) - bytes);
  297|  39.8k|    ZSTD_cwksp_assert_internal_consistency(ws);
  298|  39.8k|    assert(alloc >= bottom);
  ------------------
  |  |   70|  39.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  299|  39.8k|    if (alloc < bottom) {
  ------------------
  |  Branch (299:9): [True: 0, False: 39.8k]
  ------------------
  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|  39.8k|    if (alloc < ws->tableValidEnd) {
  ------------------
  |  Branch (306:9): [True: 0, False: 39.8k]
  ------------------
  307|      0|        ws->tableValidEnd = alloc;
  308|      0|    }
  309|  39.8k|    ws->allocStart = alloc;
  310|  39.8k|    return alloc;
  311|  39.8k|}
zstd_compress.c:ZSTD_cwksp_reserve_aligned64:
  433|  19.8k|{
  434|  19.8k|    void* const ptr = ZSTD_cwksp_reserve_internal(ws,
  435|  19.8k|                        ZSTD_cwksp_align(bytes, ZSTD_CWKSP_ALIGNMENT_BYTES),
  ------------------
  |  |   39|  19.8k|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  436|  19.8k|                        ZSTD_cwksp_alloc_aligned);
  437|  19.8k|    assert(((size_t)ptr & (ZSTD_CWKSP_ALIGNMENT_BYTES-1)) == 0);
  ------------------
  |  |   70|  19.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  438|  19.8k|    return ptr;
  439|  19.8k|}
zstd_compress.c:ZSTD_cwksp_reserve_buffer:
  395|  30.0k|{
  396|  30.0k|    return (BYTE*)ZSTD_cwksp_reserve_internal(ws, bytes, ZSTD_cwksp_alloc_buffers);
  397|  30.0k|}
zstd_compress.c:ZSTD_cwksp_mark_tables_dirty:
  545|    183|{
  546|    183|    DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_dirty");
  ------------------
  |  |  104|    183|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 183]
  |  |  ------------------
  ------------------
  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|    183|    assert(ws->tableValidEnd >= ws->objectEnd);
  ------------------
  |  |   70|    183|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  568|    183|    assert(ws->tableValidEnd <= ws->allocStart);
  ------------------
  |  |   70|    183|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  569|    183|    ws->tableValidEnd = ws->objectEnd;
  570|    183|    ZSTD_cwksp_assert_internal_consistency(ws);
  571|    183|}
zstd_compress.c:ZSTD_cwksp_mark_tables_clean:
  573|  5.14k|MEM_STATIC void ZSTD_cwksp_mark_tables_clean(ZSTD_cwksp* ws) {
  574|  5.14k|    DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_clean");
  ------------------
  |  |  104|  5.14k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.14k]
  |  |  ------------------
  ------------------
  575|  5.14k|    assert(ws->tableValidEnd >= ws->objectEnd);
  ------------------
  |  |   70|  5.14k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  576|  5.14k|    assert(ws->tableValidEnd <= ws->allocStart);
  ------------------
  |  |   70|  5.14k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  577|  5.14k|    if (ws->tableValidEnd < ws->tableEnd) {
  ------------------
  |  Branch (577:9): [True: 183, False: 4.96k]
  ------------------
  578|    183|        ws->tableValidEnd = ws->tableEnd;
  579|    183|    }
  580|  5.14k|    ZSTD_cwksp_assert_internal_consistency(ws);
  581|  5.14k|}
zstd_compress.c:ZSTD_cwksp_alloc_size:
  224|  65.0k|MEM_STATIC size_t ZSTD_cwksp_alloc_size(size_t size) {
  225|  65.0k|    if (size == 0)
  ------------------
  |  Branch (225:9): [True: 10.0k, False: 55.0k]
  ------------------
  226|  10.0k|        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|  55.0k|    return size;
  231|  65.0k|#endif
  232|  65.0k|}
zstd_compress.c:ZSTD_cwksp_slack_space_required:
  250|  5.00k|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|  5.00k|    size_t const slackSpace = ZSTD_CWKSP_ALIGNMENT_BYTES * 2;
  ------------------
  |  |   39|  5.00k|#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
  ------------------
  255|  5.00k|    return slackSpace;
  256|  5.00k|}
zstd_compress.c:ZSTD_cwksp_align:
  206|  55.0k|MEM_STATIC size_t ZSTD_cwksp_align(size_t size, size_t align) {
  207|  55.0k|    size_t const mask = align - 1;
  208|  55.0k|    assert(ZSTD_isPower2(align));
  ------------------
  |  |   70|  55.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  209|  55.0k|    return (size + mask) & ~mask;
  210|  55.0k|}
zstd_compress.c:ZSTD_cwksp_free:
  697|     76|MEM_STATIC void ZSTD_cwksp_free(ZSTD_cwksp* ws, ZSTD_customMem customMem) {
  698|     76|    void *ptr = ws->workspace;
  699|     76|    DEBUGLOG(4, "cwksp: freeing workspace");
  ------------------
  |  |  104|     76|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 76]
  |  |  ------------------
  ------------------
  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|     76|    ZSTD_memset(ws, 0, sizeof(ZSTD_cwksp));
  ------------------
  |  |   46|     76|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  706|     76|    ZSTD_customFree(ptr, customMem);
  707|     76|}
zstd_ldm.c:ZSTD_cwksp_alloc_size:
  224|  10.0k|MEM_STATIC size_t ZSTD_cwksp_alloc_size(size_t size) {
  225|  10.0k|    if (size == 0)
  ------------------
  |  Branch (225:9): [True: 0, False: 10.0k]
  ------------------
  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|  10.0k|    return size;
  231|  10.0k|#endif
  232|  10.0k|}

ZSTD_compressBlock_fast:
  446|    502|{
  447|    502|    U32 const mml = ms->cParams.minMatch;
  448|       |    /* use cmov when "candidate in range" branch is likely unpredictable */
  449|    502|    int const useCmov = ms->cParams.windowLog < 19;
  450|    502|    assert(ms->dictMatchState == NULL);
  ------------------
  |  |   70|    502|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  451|    502|    if (useCmov) {
  ------------------
  |  Branch (451:9): [True: 502, False: 0]
  ------------------
  452|    502|        switch(mml)
  453|    502|        {
  454|      0|        default: /* includes case 3 */
  ------------------
  |  Branch (454:9): [True: 0, False: 502]
  ------------------
  455|      0|        case 4 :
  ------------------
  |  Branch (455:9): [True: 0, False: 502]
  ------------------
  456|      0|            return ZSTD_compressBlock_fast_noDict_4_1(ms, seqStore, rep, src, srcSize);
  457|    502|        case 5 :
  ------------------
  |  Branch (457:9): [True: 502, False: 0]
  ------------------
  458|    502|            return ZSTD_compressBlock_fast_noDict_5_1(ms, seqStore, rep, src, srcSize);
  459|      0|        case 6 :
  ------------------
  |  Branch (459:9): [True: 0, False: 502]
  ------------------
  460|      0|            return ZSTD_compressBlock_fast_noDict_6_1(ms, seqStore, rep, src, srcSize);
  461|      0|        case 7 :
  ------------------
  |  Branch (461:9): [True: 0, False: 502]
  ------------------
  462|      0|            return ZSTD_compressBlock_fast_noDict_7_1(ms, seqStore, rep, src, srcSize);
  463|    502|        }
  464|    502|    } else {
  465|       |        /* use a branch instead */
  466|      0|        switch(mml)
  467|      0|        {
  468|      0|        default: /* includes case 3 */
  ------------------
  |  Branch (468:9): [True: 0, False: 0]
  ------------------
  469|      0|        case 4 :
  ------------------
  |  Branch (469:9): [True: 0, False: 0]
  ------------------
  470|      0|            return ZSTD_compressBlock_fast_noDict_4_0(ms, seqStore, rep, src, srcSize);
  471|      0|        case 5 :
  ------------------
  |  Branch (471:9): [True: 0, False: 0]
  ------------------
  472|      0|            return ZSTD_compressBlock_fast_noDict_5_0(ms, seqStore, rep, src, srcSize);
  473|      0|        case 6 :
  ------------------
  |  Branch (473:9): [True: 0, False: 0]
  ------------------
  474|      0|            return ZSTD_compressBlock_fast_noDict_6_0(ms, seqStore, rep, src, srcSize);
  475|      0|        case 7 :
  ------------------
  |  Branch (475:9): [True: 0, False: 0]
  ------------------
  476|      0|            return ZSTD_compressBlock_fast_noDict_7_0(ms, seqStore, rep, src, srcSize);
  477|      0|        }
  478|      0|    }
  479|    502|}
zstd_fast.c:ZSTD_compressBlock_fast_noDict_generic:
  196|    502|{
  197|    502|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
  198|    502|    U32* const hashTable = ms->hashTable;
  199|    502|    U32 const hlog = cParams->hashLog;
  200|    502|    size_t const stepSize = cParams->targetLength + !(cParams->targetLength) + 1; /* min 2 */
  201|    502|    const BYTE* const base = ms->window.base;
  202|    502|    const BYTE* const istart = (const BYTE*)src;
  203|    502|    const U32   endIndex = (U32)((size_t)(istart - base) + srcSize);
  204|    502|    const U32   prefixStartIndex = ZSTD_getLowestPrefixIndex(ms, endIndex, cParams->windowLog);
  205|    502|    const BYTE* const prefixStart = base + prefixStartIndex;
  206|    502|    const BYTE* const iend = istart + srcSize;
  207|    502|    const BYTE* const ilimit = iend - HASH_READ_SIZE;
  ------------------
  |  |   33|    502|#define HASH_READ_SIZE       8
  ------------------
  208|       |
  209|    502|    const BYTE* anchor = istart;
  210|    502|    const BYTE* ip0 = istart;
  211|    502|    const BYTE* ip1;
  212|    502|    const BYTE* ip2;
  213|    502|    const BYTE* ip3;
  214|    502|    U32 current0;
  215|       |
  216|    502|    U32 rep_offset1 = rep[0];
  217|    502|    U32 rep_offset2 = rep[1];
  218|    502|    U32 offsetSaved1 = 0, offsetSaved2 = 0;
  219|       |
  220|    502|    size_t hash0; /* hash for ip0 */
  221|    502|    size_t hash1; /* hash for ip1 */
  222|    502|    U32 matchIdx; /* match idx for ip0 */
  223|       |
  224|    502|    U32 offcode;
  225|    502|    const BYTE* match0;
  226|    502|    size_t mLength;
  227|       |
  228|       |    /* ip0 and ip1 are always adjacent. The targetLength skipping and
  229|       |     * uncompressibility acceleration is applied to every other position,
  230|       |     * matching the behavior of #1562. step therefore represents the gap
  231|       |     * between pairs of positions, from ip0 to ip2 or ip1 to ip3. */
  232|    502|    size_t step;
  233|    502|    const BYTE* nextStep;
  234|    502|    const size_t kStepIncr = (1 << (kSearchStrength - 1));
  ------------------
  |  |   32|    502|#define kSearchStrength      8
  ------------------
  235|    502|    const ZSTD_match4Found matchFound = useCmov ? ZSTD_match4Found_cmov : ZSTD_match4Found_branch;
  ------------------
  |  Branch (235:41): [True: 502, False: 0]
  ------------------
  236|       |
  237|    502|    DEBUGLOG(5, "ZSTD_compressBlock_fast_generic");
  ------------------
  |  |  104|    502|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 502]
  |  |  ------------------
  ------------------
  238|    502|    ip0 += (ip0 == prefixStart);
  239|    502|    {   U32 const curr = (U32)(ip0 - base);
  240|    502|        U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, cParams->windowLog);
  241|    502|        U32 const maxRep = curr - windowLow;
  242|    502|        if (rep_offset2 > maxRep) offsetSaved2 = rep_offset2, rep_offset2 = 0;
  ------------------
  |  Branch (242:13): [True: 502, False: 0]
  ------------------
  243|    502|        if (rep_offset1 > maxRep) offsetSaved1 = rep_offset1, rep_offset1 = 0;
  ------------------
  |  Branch (243:13): [True: 0, False: 502]
  ------------------
  244|    502|    }
  245|       |
  246|       |    /* start each op */
  247|  2.84k|_start: /* Requires: ip0 */
  248|       |
  249|  2.84k|    step = stepSize;
  250|  2.84k|    nextStep = ip0 + kStepIncr;
  251|       |
  252|       |    /* calculate positions, ip0 - anchor == 0, so we skip step calc */
  253|  2.84k|    ip1 = ip0 + 1;
  254|  2.84k|    ip2 = ip0 + step;
  255|  2.84k|    ip3 = ip2 + 1;
  256|       |
  257|  2.84k|    if (ip3 >= ilimit) {
  ------------------
  |  Branch (257:9): [True: 216, False: 2.62k]
  ------------------
  258|    216|        goto _cleanup;
  259|    216|    }
  260|       |
  261|  2.62k|    hash0 = ZSTD_hashPtr(ip0, hlog, mls);
  262|  2.62k|    hash1 = ZSTD_hashPtr(ip1, hlog, mls);
  263|       |
  264|  2.62k|    matchIdx = hashTable[hash0];
  265|       |
  266|  19.1k|    do {
  267|       |        /* load repcode match for ip[2]*/
  268|  19.1k|        const U32 rval = MEM_read32(ip2 - rep_offset1);
  269|       |
  270|       |        /* write back hash table entry */
  271|  19.1k|        current0 = (U32)(ip0 - base);
  272|  19.1k|        hashTable[hash0] = current0;
  273|       |
  274|       |        /* check repcode at ip[2] */
  275|  19.1k|        if ((MEM_read32(ip2) == rval) & (rep_offset1 > 0)) {
  ------------------
  |  Branch (275:13): [True: 1.98k, False: 17.1k]
  ------------------
  276|  1.98k|            ip0 = ip2;
  277|  1.98k|            match0 = ip0 - rep_offset1;
  278|  1.98k|            mLength = ip0[-1] == match0[-1];
  279|  1.98k|            ip0 -= mLength;
  280|  1.98k|            match0 -= mLength;
  281|  1.98k|            offcode = REPCODE1_TO_OFFBASE;
  ------------------
  |  |  718|  1.98k|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  721|  1.98k|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|  1.98k|#    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|  1.98k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  282|  1.98k|            mLength += 4;
  283|       |
  284|       |            /* Write next hash table entry: it's already calculated.
  285|       |             * This write is known to be safe because ip1 is before the
  286|       |             * repcode (ip2). */
  287|  1.98k|            hashTable[hash1] = (U32)(ip1 - base);
  288|       |
  289|  1.98k|            goto _match;
  290|  1.98k|        }
  291|       |
  292|  17.1k|         if (matchFound(ip0, base + matchIdx, matchIdx, prefixStartIndex)) {
  ------------------
  |  Branch (292:14): [True: 230, False: 16.9k]
  ------------------
  293|       |            /* Write next hash table entry (it's already calculated).
  294|       |            * This write is known to be safe because the ip1 == ip0 + 1,
  295|       |            * so searching will resume after ip1 */
  296|    230|            hashTable[hash1] = (U32)(ip1 - base);
  297|       |
  298|    230|            goto _offset;
  299|    230|        }
  300|       |
  301|       |        /* lookup ip[1] */
  302|  16.9k|        matchIdx = hashTable[hash1];
  303|       |
  304|       |        /* hash ip[2] */
  305|  16.9k|        hash0 = hash1;
  306|  16.9k|        hash1 = ZSTD_hashPtr(ip2, hlog, mls);
  307|       |
  308|       |        /* advance to next positions */
  309|  16.9k|        ip0 = ip1;
  310|  16.9k|        ip1 = ip2;
  311|  16.9k|        ip2 = ip3;
  312|       |
  313|       |        /* write back hash table entry */
  314|  16.9k|        current0 = (U32)(ip0 - base);
  315|  16.9k|        hashTable[hash0] = current0;
  316|       |
  317|  16.9k|         if (matchFound(ip0, base + matchIdx, matchIdx, prefixStartIndex)) {
  ------------------
  |  Branch (317:14): [True: 125, False: 16.7k]
  ------------------
  318|       |            /* Write next hash table entry, since it's already calculated */
  319|    125|            if (step <= 4) {
  ------------------
  |  Branch (319:17): [True: 125, False: 0]
  ------------------
  320|       |                /* Avoid writing an index if it's >= position where search will resume.
  321|       |                * The minimum possible match has length 4, so search can resume at ip0 + 4.
  322|       |                */
  323|    125|                hashTable[hash1] = (U32)(ip1 - base);
  324|    125|            }
  325|    125|            goto _offset;
  326|    125|        }
  327|       |
  328|       |        /* lookup ip[1] */
  329|  16.7k|        matchIdx = hashTable[hash1];
  330|       |
  331|       |        /* hash ip[2] */
  332|  16.7k|        hash0 = hash1;
  333|  16.7k|        hash1 = ZSTD_hashPtr(ip2, hlog, mls);
  334|       |
  335|       |        /* advance to next positions */
  336|  16.7k|        ip0 = ip1;
  337|  16.7k|        ip1 = ip2;
  338|  16.7k|        ip2 = ip0 + step;
  339|  16.7k|        ip3 = ip1 + step;
  340|       |
  341|       |        /* calculate step */
  342|  16.7k|        if (ip2 >= nextStep) {
  ------------------
  |  Branch (342:13): [True: 0, False: 16.7k]
  ------------------
  343|      0|            step++;
  344|      0|            PREFETCH_L1(ip1 + 64);
  ------------------
  |  |  145|      0|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
  345|      0|            PREFETCH_L1(ip1 + 128);
  ------------------
  |  |  145|      0|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
  346|      0|            nextStep += kStepIncr;
  347|      0|        }
  348|  16.7k|    } while (ip3 < ilimit);
  ------------------
  |  Branch (348:14): [True: 16.4k, False: 286]
  ------------------
  349|       |
  350|    502|_cleanup:
  351|       |    /* Note that there are probably still a couple positions one could search.
  352|       |     * However, it seems to be a meaningful performance hit to try to search
  353|       |     * them. So let's not. */
  354|       |
  355|       |    /* When the repcodes are outside of the prefix, we set them to zero before the loop.
  356|       |     * When the offsets are still zero, we need to restore them after the block to have a correct
  357|       |     * repcode history. If only one offset was invalid, it is easy. The tricky case is when both
  358|       |     * offsets were invalid. We need to figure out which offset to refill with.
  359|       |     *     - If both offsets are zero they are in the same order.
  360|       |     *     - If both offsets are non-zero, we won't restore the offsets from `offsetSaved[12]`.
  361|       |     *     - If only one is zero, we need to decide which offset to restore.
  362|       |     *         - If rep_offset1 is non-zero, then rep_offset2 must be offsetSaved1.
  363|       |     *         - It is impossible for rep_offset2 to be non-zero.
  364|       |     *
  365|       |     * So if rep_offset1 started invalid (offsetSaved1 != 0) and became valid (rep_offset1 != 0), then
  366|       |     * set rep[0] = rep_offset1 and rep[1] = offsetSaved1.
  367|       |     */
  368|    502|    offsetSaved2 = ((offsetSaved1 != 0) && (rep_offset1 != 0)) ? offsetSaved1 : offsetSaved2;
  ------------------
  |  Branch (368:21): [True: 0, False: 502]
  |  Branch (368:44): [True: 0, False: 0]
  ------------------
  369|       |
  370|       |    /* save reps for next block */
  371|    502|    rep[0] = rep_offset1 ? rep_offset1 : offsetSaved1;
  ------------------
  |  Branch (371:14): [True: 502, False: 0]
  ------------------
  372|    502|    rep[1] = rep_offset2 ? rep_offset2 : offsetSaved2;
  ------------------
  |  Branch (372:14): [True: 173, False: 329]
  ------------------
  373|       |
  374|       |    /* Return the last literals size */
  375|    502|    return (size_t)(iend - anchor);
  376|       |
  377|    355|_offset: /* Requires: ip0, idx */
  378|       |
  379|       |    /* Compute the offset code. */
  380|    355|    match0 = base + matchIdx;
  381|    355|    rep_offset2 = rep_offset1;
  382|    355|    rep_offset1 = (U32)(ip0-match0);
  383|    355|    offcode = OFFSET_TO_OFFBASE(rep_offset1);
  ------------------
  |  |  722|    355|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|    355|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|    355|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  384|    355|    mLength = 4;
  385|       |
  386|       |    /* Count the backwards match length. */
  387|    372|    while (((ip0>anchor) & (match0>prefixStart)) && (ip0[-1] == match0[-1])) {
  ------------------
  |  Branch (387:12): [True: 323, False: 49]
  |  Branch (387:53): [True: 17, False: 306]
  ------------------
  388|     17|        ip0--;
  389|     17|        match0--;
  390|     17|        mLength++;
  391|     17|    }
  392|       |
  393|  2.34k|_match: /* Requires: ip0, match0, offcode */
  394|       |
  395|       |    /* Count the forward length. */
  396|  2.34k|    mLength += ZSTD_count(ip0 + mLength, match0 + mLength, iend);
  397|       |
  398|  2.34k|    ZSTD_storeSeq(seqStore, (size_t)(ip0 - anchor), anchor, iend, offcode, mLength);
  399|       |
  400|  2.34k|    ip0 += mLength;
  401|  2.34k|    anchor = ip0;
  402|       |
  403|       |    /* Fill table and check for immediate repcode. */
  404|  2.34k|    if (ip0 <= ilimit) {
  ------------------
  |  Branch (404:9): [True: 2.16k, False: 176]
  ------------------
  405|       |        /* Fill Table */
  406|  2.16k|        assert(base+current0+2 > istart);  /* check base overflow */
  ------------------
  |  |   70|  2.16k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  407|  2.16k|        hashTable[ZSTD_hashPtr(base+current0+2, hlog, mls)] = current0+2;  /* here because current+2 could be > iend-8 */
  408|  2.16k|        hashTable[ZSTD_hashPtr(ip0-2, hlog, mls)] = (U32)(ip0-2-base);
  409|       |
  410|  2.16k|        if (rep_offset2 > 0) { /* rep_offset2==0 means rep_offset2 is invalidated */
  ------------------
  |  Branch (410:13): [True: 409, False: 1.75k]
  ------------------
  411|    417|            while ( (ip0 <= ilimit) && (MEM_read32(ip0) == MEM_read32(ip0 - rep_offset2)) ) {
  ------------------
  |  Branch (411:21): [True: 416, False: 1]
  |  Branch (411:40): [True: 8, False: 408]
  ------------------
  412|       |                /* store sequence */
  413|      8|                size_t const rLength = ZSTD_count(ip0+4, ip0+4-rep_offset2, iend) + 4;
  414|      8|                { U32 const tmpOff = rep_offset2; rep_offset2 = rep_offset1; rep_offset1 = tmpOff; } /* swap rep_offset2 <=> rep_offset1 */
  415|      8|                hashTable[ZSTD_hashPtr(ip0, hlog, mls)] = (U32)(ip0-base);
  416|      8|                ip0 += rLength;
  417|      8|                ZSTD_storeSeq(seqStore, 0 /*litLen*/, anchor, iend, REPCODE1_TO_OFFBASE, rLength);
  ------------------
  |  |  718|      8|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  721|      8|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      8|#    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|      8|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  418|      8|                anchor = ip0;
  419|      8|                continue;   /* faster when present (confirmed on gcc-8) ... (?) */
  420|      8|    }   }   }
  421|       |
  422|  2.34k|    goto _start;
  423|    355|}
zstd_fast.c:ZSTD_match4Found_cmov:
  104|  34.0k|{
  105|       |    /* Array of ~random data, should have low probability of matching data.
  106|       |     * Load from here if the index is invalid.
  107|       |     * Used to avoid unpredictable branches. */
  108|  34.0k|    static const BYTE dummy[] = {0x12,0x34,0x56,0x78};
  109|       |
  110|       |    /* currentIdx >= lowLimit is a (somewhat) unpredictable branch.
  111|       |     * However expression below compiles into conditional move.
  112|       |     */
  113|  34.0k|    const BYTE* mvalAddr = ZSTD_selectAddr(matchIdx, idxLowLimit, matchAddress, dummy);
  114|       |    /* Note: this used to be written as : return test1 && test2;
  115|       |     * Unfortunately, once inlined, these tests become branches,
  116|       |     * in which case it becomes critical that they are executed in the right order (test1 then test2).
  117|       |     * So we have to write these tests in a specific manner to ensure their ordering.
  118|       |     */
  119|  34.0k|    if (MEM_read32(currentPtr) != MEM_read32(mvalAddr)) return 0;
  ------------------
  |  Branch (119:9): [True: 33.6k, False: 355]
  ------------------
  120|       |    /* force ordering of these tests, which matters once the function is inlined, as they become branches */
  121|    355|#if defined(__GNUC__)
  122|    355|    __asm__("");
  123|    355|#endif
  124|    355|    return matchIdx >= idxLowLimit;
  125|  34.0k|}
zstd_fast.c:ZSTD_compressBlock_fast_noDict_5_1:
  429|    502|    {                                                                                              \
  430|    502|        return ZSTD_compressBlock_fast_##dictMode##_generic(ms, seqStore, rep, src, srcSize, mml, cmov); \
  431|    502|    }

ZSTD_compressBlock_lazy:
 1831|    240|{
 1832|    240|    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_noDict);
 1833|    240|}
ZSTD_compressBlock_lazy2:
 1875|  1.51k|{
 1876|  1.51k|    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_noDict);
 1877|  1.51k|}
ZSTD_compressBlock_btlazy2:
 1919|    235|{
 1920|    235|    return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_noDict);
 1921|    235|}
zstd_lazy.c:ZSTD_insertAndFindFirstIndex_internal:
  636|   176k|{
  637|   176k|    U32* const hashTable  = ms->hashTable;
  638|   176k|    const U32 hashLog = cParams->hashLog;
  639|   176k|    U32* const chainTable = ms->chainTable;
  640|   176k|    const U32 chainMask = (1 << cParams->chainLog) - 1;
  641|   176k|    const BYTE* const base = ms->window.base;
  642|   176k|    const U32 target = (U32)(ip - base);
  643|   176k|    U32 idx = ms->nextToUpdate;
  644|       |
  645|   365k|    while(idx < target) { /* catch up */
  ------------------
  |  Branch (645:11): [True: 188k, False: 176k]
  ------------------
  646|   188k|        size_t const h = ZSTD_hashPtr(base+idx, hashLog, mls);
  647|   188k|        NEXT_IN_CHAIN(idx, chainMask) = hashTable[h];
  ------------------
  |  |  626|   188k|#define NEXT_IN_CHAIN(d, mask)   chainTable[(d) & (mask)]
  ------------------
  648|   188k|        hashTable[h] = idx;
  649|   188k|        idx++;
  650|       |        /* Stop inserting every position when in the lazy skipping mode. */
  651|   188k|        if (lazySkipping)
  ------------------
  |  Branch (651:13): [True: 0, False: 188k]
  ------------------
  652|      0|            break;
  653|   188k|    }
  654|       |
  655|   176k|    ms->nextToUpdate = target;
  656|   176k|    return hashTable[ZSTD_hashPtr(ip, hashLog, mls)];
  657|   176k|}
zstd_lazy.c:ZSTD_compressBlock_lazy_generic:
 1522|  1.99k|{
 1523|  1.99k|    const BYTE* const istart = (const BYTE*)src;
 1524|  1.99k|    const BYTE* ip = istart;
 1525|  1.99k|    const BYTE* anchor = istart;
 1526|  1.99k|    const BYTE* const iend = istart + srcSize;
 1527|  1.99k|    const BYTE* const ilimit = (searchMethod == search_rowHash) ? iend - 8 - ZSTD_ROW_HASH_CACHE_SIZE : iend - 8;
  ------------------
  |  |  270|      0|#define ZSTD_ROW_HASH_CACHE_SIZE 8       /* Size of prefetching hash cache for row-based matchfinder */
  ------------------
  |  Branch (1527:32): [True: 0, False: 1.99k]
  ------------------
 1528|  1.99k|    const BYTE* const base = ms->window.base;
 1529|  1.99k|    const U32 prefixLowestIndex = ms->window.dictLimit;
 1530|  1.99k|    const BYTE* const prefixLowest = base + prefixLowestIndex;
 1531|  1.99k|    const U32 mls = BOUNDED(4, ms->cParams.minMatch, 6);
  ------------------
  |  |   56|  1.99k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|  3.98k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 0, False: 1.99k]
  |  |  |  |  |  Branch (55:24): [True: 1.99k, False: 0]
  |  |  |  |  |  Branch (55:36): [True: 1.99k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1532|  1.99k|    const U32 rowLog = BOUNDED(4, ms->cParams.searchLog, 6);
  ------------------
  |  |   56|  1.99k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  ------------------
  |  |  |  |   55|  3.98k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [True: 240, False: 1.75k]
  |  |  |  |  |  Branch (55:24): [True: 475, False: 1.51k]
  |  |  |  |  |  Branch (55:36): [True: 235, False: 1.51k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1533|       |
 1534|  1.99k|    U32 offset_1 = rep[0], offset_2 = rep[1];
 1535|  1.99k|    U32 offsetSaved1 = 0, offsetSaved2 = 0;
 1536|       |
 1537|  1.99k|    const int isDMS = dictMode == ZSTD_dictMatchState;
 1538|  1.99k|    const int isDDS = dictMode == ZSTD_dedicatedDictSearch;
 1539|  1.99k|    const int isDxS = isDMS || isDDS;
  ------------------
  |  Branch (1539:23): [True: 0, False: 1.99k]
  |  Branch (1539:32): [True: 0, False: 1.99k]
  ------------------
 1540|  1.99k|    const ZSTD_MatchState_t* const dms = ms->dictMatchState;
 1541|  1.99k|    const U32 dictLowestIndex      = isDxS ? dms->window.dictLimit : 0;
  ------------------
  |  Branch (1541:38): [True: 0, False: 1.99k]
  ------------------
 1542|  1.99k|    const BYTE* const dictBase     = isDxS ? dms->window.base : NULL;
  ------------------
  |  Branch (1542:38): [True: 0, False: 1.99k]
  ------------------
 1543|  1.99k|    const BYTE* const dictLowest   = isDxS ? dictBase + dictLowestIndex : NULL;
  ------------------
  |  Branch (1543:38): [True: 0, False: 1.99k]
  ------------------
 1544|  1.99k|    const BYTE* const dictEnd      = isDxS ? dms->window.nextSrc : NULL;
  ------------------
  |  Branch (1544:38): [True: 0, False: 1.99k]
  ------------------
 1545|  1.99k|    const U32 dictIndexDelta       = isDxS ?
  ------------------
  |  Branch (1545:38): [True: 0, False: 1.99k]
  ------------------
 1546|      0|                                     prefixLowestIndex - (U32)(dictEnd - dictBase) :
 1547|  1.99k|                                     0;
 1548|  1.99k|    const U32 dictAndPrefixLength = (U32)((ip - prefixLowest) + (dictEnd - dictLowest));
 1549|       |
 1550|  1.99k|    DEBUGLOG(5, "ZSTD_compressBlock_lazy_generic (dictMode=%u) (searchFunc=%u)", (U32)dictMode, (U32)searchMethod);
  ------------------
  |  |  104|  1.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.99k]
  |  |  ------------------
  ------------------
 1551|  1.99k|    ip += (dictAndPrefixLength == 0);
 1552|  1.99k|    if (dictMode == ZSTD_noDict) {
  ------------------
  |  Branch (1552:9): [True: 1.99k, False: 0]
  ------------------
 1553|  1.99k|        U32 const curr = (U32)(ip - base);
 1554|  1.99k|        U32 const windowLow = ZSTD_getLowestPrefixIndex(ms, curr, ms->cParams.windowLog);
 1555|  1.99k|        U32 const maxRep = curr - windowLow;
 1556|  1.99k|        if (offset_2 > maxRep) offsetSaved2 = offset_2, offset_2 = 0;
  ------------------
  |  Branch (1556:13): [True: 1.99k, False: 0]
  ------------------
 1557|  1.99k|        if (offset_1 > maxRep) offsetSaved1 = offset_1, offset_1 = 0;
  ------------------
  |  Branch (1557:13): [True: 0, False: 1.99k]
  ------------------
 1558|  1.99k|    }
 1559|  1.99k|    if (isDxS) {
  ------------------
  |  Branch (1559:9): [True: 0, False: 1.99k]
  ------------------
 1560|       |        /* dictMatchState repCode checks don't currently handle repCode == 0
 1561|       |         * disabling. */
 1562|      0|        assert(offset_1 <= dictAndPrefixLength);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1563|      0|        assert(offset_2 <= dictAndPrefixLength);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1564|      0|    }
 1565|       |
 1566|       |    /* Reset the lazy skipping state */
 1567|  1.99k|    ms->lazySkipping = 0;
 1568|       |
 1569|  1.99k|    if (searchMethod == search_rowHash) {
  ------------------
  |  Branch (1569:9): [True: 0, False: 1.99k]
  ------------------
 1570|      0|        ZSTD_row_fillHashCache(ms, base, rowLog, mls, ms->nextToUpdate, ilimit);
 1571|      0|    }
 1572|       |
 1573|       |    /* Match Loop */
 1574|  1.99k|#if defined(__GNUC__) && defined(__x86_64__)
 1575|       |    /* I've measured random a 5% speed loss on levels 5 & 6 (greedy) when the
 1576|       |     * code alignment is perturbed. To fix the instability align the loop on 32-bytes.
 1577|       |     */
 1578|  1.99k|    __asm__(".p2align 5");
 1579|  1.99k|#endif
 1580|   169k|    while (ip < ilimit) {
  ------------------
  |  Branch (1580:12): [True: 167k, False: 1.99k]
  ------------------
 1581|   167k|        size_t matchLength=0;
 1582|   167k|        size_t offBase = REPCODE1_TO_OFFBASE;
  ------------------
  |  |  718|   167k|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  721|   167k|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|   167k|#    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|   167k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1583|   167k|        const BYTE* start=ip+1;
 1584|   167k|        DEBUGLOG(7, "search baseline (depth 0)");
  ------------------
  |  |  104|   167k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 167k]
  |  |  ------------------
  ------------------
 1585|       |
 1586|       |        /* check repCode */
 1587|   167k|        if (isDxS) {
  ------------------
  |  Branch (1587:13): [True: 0, False: 167k]
  ------------------
 1588|      0|            const U32 repIndex = (U32)(ip - base) + 1 - offset_1;
 1589|      0|            const BYTE* repMatch = ((dictMode == ZSTD_dictMatchState || dictMode == ZSTD_dedicatedDictSearch)
  ------------------
  |  Branch (1589:38): [True: 0, False: 0]
  |  Branch (1589:73): [True: 0, False: 0]
  ------------------
 1590|      0|                                && repIndex < prefixLowestIndex) ?
  ------------------
  |  Branch (1590:36): [True: 0, False: 0]
  ------------------
 1591|      0|                                   dictBase + (repIndex - dictIndexDelta) :
 1592|      0|                                   base + repIndex;
 1593|      0|            if ((ZSTD_index_overlap_check(prefixLowestIndex, repIndex))
  ------------------
  |  Branch (1593:17): [True: 0, False: 0]
  ------------------
 1594|      0|                && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) {
  ------------------
  |  Branch (1594:20): [True: 0, False: 0]
  ------------------
 1595|      0|                const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend;
  ------------------
  |  Branch (1595:43): [True: 0, False: 0]
  ------------------
 1596|      0|                matchLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4;
 1597|      0|                if (depth==0) goto _storeSequence;
  ------------------
  |  Branch (1597:21): [True: 0, False: 0]
  ------------------
 1598|      0|            }
 1599|      0|        }
 1600|   167k|        if ( dictMode == ZSTD_noDict
  ------------------
  |  Branch (1600:14): [True: 167k, False: 0]
  ------------------
 1601|   167k|          && ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)))) {
  ------------------
  |  Branch (1601:14): [True: 1.24k, False: 165k]
  ------------------
 1602|  1.24k|            matchLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4;
 1603|  1.24k|            if (depth==0) goto _storeSequence;
  ------------------
  |  Branch (1603:17): [True: 0, False: 1.24k]
  ------------------
 1604|  1.24k|        }
 1605|       |
 1606|       |        /* first search (depth 0) */
 1607|   167k|        {   size_t offbaseFound = 999999999;
 1608|   167k|            size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &offbaseFound, mls, rowLog, searchMethod, dictMode);
 1609|   167k|            if (ml2 > matchLength)
  ------------------
  |  Branch (1609:17): [True: 164k, False: 2.67k]
  ------------------
 1610|   164k|                matchLength = ml2, start = ip, offBase = offbaseFound;
 1611|   167k|        }
 1612|       |
 1613|   167k|        if (matchLength < 4) {
  ------------------
  |  Branch (1613:13): [True: 160k, False: 6.61k]
  ------------------
 1614|   160k|            size_t const step = ((size_t)(ip-anchor) >> kSearchStrength) + 1;   /* jump faster over incompressible sections */;
  ------------------
  |  |   32|   160k|#define kSearchStrength      8
  ------------------
 1615|   160k|            ip += step;
 1616|       |            /* Enter the lazy skipping mode once we are skipping more than 8 bytes at a time.
 1617|       |             * In this mode we stop inserting every position into our tables, and only insert
 1618|       |             * positions that we search, which is one in step positions.
 1619|       |             * The exact cutoff is flexible, I've just chosen a number that is reasonably high,
 1620|       |             * so we minimize the compression ratio loss in "normal" scenarios. This mode gets
 1621|       |             * triggered once we've gone 2KB without finding any matches.
 1622|       |             */
 1623|   160k|            ms->lazySkipping = step > kLazySkippingStep;
  ------------------
  |  |   20|   160k|#define kLazySkippingStep 8
  ------------------
 1624|   160k|            continue;
 1625|   160k|        }
 1626|       |
 1627|       |        /* let's try to find a better solution */
 1628|  6.61k|        if (depth>=1)
  ------------------
  |  Branch (1628:13): [True: 6.61k, False: 0]
  ------------------
 1629|  6.73k|        while (ip<ilimit) {
  ------------------
  |  Branch (1629:16): [True: 6.73k, False: 0]
  ------------------
 1630|  6.73k|            DEBUGLOG(7, "search depth 1");
  ------------------
  |  |  104|  6.73k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 6.73k]
  |  |  ------------------
  ------------------
 1631|  6.73k|            ip ++;
 1632|  6.73k|            if ( (dictMode == ZSTD_noDict)
  ------------------
  |  Branch (1632:18): [True: 6.73k, False: 0]
  ------------------
 1633|  6.73k|              && (offBase) && ((offset_1>0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) {
  ------------------
  |  Branch (1633:18): [True: 6.73k, False: 0]
  |  Branch (1633:31): [True: 1.27k, False: 5.45k]
  ------------------
 1634|  1.27k|                size_t const mlRep = ZSTD_count(ip+4, ip+4-offset_1, iend) + 4;
 1635|  1.27k|                int const gain2 = (int)(mlRep * 3);
 1636|  1.27k|                int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offBase) + 1);
 1637|  1.27k|                if ((mlRep >= 4) && (gain2 > gain1))
  ------------------
  |  Branch (1637:21): [True: 1.27k, False: 0]
  |  Branch (1637:37): [True: 2, False: 1.27k]
  ------------------
 1638|      2|                    matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip;
  ------------------
  |  |  718|      2|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  721|      2|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      2|#    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|      2|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1639|  1.27k|            }
 1640|  6.73k|            if (isDxS) {
  ------------------
  |  Branch (1640:17): [True: 0, False: 6.73k]
  ------------------
 1641|      0|                const U32 repIndex = (U32)(ip - base) - offset_1;
 1642|      0|                const BYTE* repMatch = repIndex < prefixLowestIndex ?
  ------------------
  |  Branch (1642:40): [True: 0, False: 0]
  ------------------
 1643|      0|                               dictBase + (repIndex - dictIndexDelta) :
 1644|      0|                               base + repIndex;
 1645|      0|                if ((ZSTD_index_overlap_check(prefixLowestIndex, repIndex))
  ------------------
  |  Branch (1645:21): [True: 0, False: 0]
  ------------------
 1646|      0|                    && (MEM_read32(repMatch) == MEM_read32(ip)) ) {
  ------------------
  |  Branch (1646:24): [True: 0, False: 0]
  ------------------
 1647|      0|                    const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend;
  ------------------
  |  Branch (1647:47): [True: 0, False: 0]
  ------------------
 1648|      0|                    size_t const mlRep = ZSTD_count_2segments(ip+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4;
 1649|      0|                    int const gain2 = (int)(mlRep * 3);
 1650|      0|                    int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offBase) + 1);
 1651|      0|                    if ((mlRep >= 4) && (gain2 > gain1))
  ------------------
  |  Branch (1651:25): [True: 0, False: 0]
  |  Branch (1651:41): [True: 0, False: 0]
  ------------------
 1652|      0|                        matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip;
  ------------------
  |  |  718|      0|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  721|      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) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1653|      0|                }
 1654|      0|            }
 1655|  6.73k|            {   size_t ofbCandidate=999999999;
 1656|  6.73k|                size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &ofbCandidate, mls, rowLog, searchMethod, dictMode);
 1657|  6.73k|                int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)ofbCandidate));   /* raw approx */
 1658|  6.73k|                int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 4);
 1659|  6.73k|                if ((ml2 >= 4) && (gain2 > gain1)) {
  ------------------
  |  Branch (1659:21): [True: 2.36k, False: 4.37k]
  |  Branch (1659:35): [True: 111, False: 2.25k]
  ------------------
 1660|    111|                    matchLength = ml2, offBase = ofbCandidate, start = ip;
 1661|    111|                    continue;   /* search a better one */
 1662|    111|            }   }
 1663|       |
 1664|       |            /* let's find an even better one */
 1665|  6.62k|            if ((depth==2) && (ip<ilimit)) {
  ------------------
  |  Branch (1665:17): [True: 5.92k, False: 701]
  |  Branch (1665:31): [True: 5.89k, False: 27]
  ------------------
 1666|  5.89k|                DEBUGLOG(7, "search depth 2");
  ------------------
  |  |  104|  5.89k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.89k]
  |  |  ------------------
  ------------------
 1667|  5.89k|                ip ++;
 1668|  5.89k|                if ( (dictMode == ZSTD_noDict)
  ------------------
  |  Branch (1668:22): [True: 5.89k, False: 0]
  ------------------
 1669|  5.89k|                  && (offBase) && ((offset_1>0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) {
  ------------------
  |  Branch (1669:22): [True: 5.89k, False: 0]
  |  Branch (1669:35): [True: 498, False: 5.39k]
  ------------------
 1670|    498|                    size_t const mlRep = ZSTD_count(ip+4, ip+4-offset_1, iend) + 4;
 1671|    498|                    int const gain2 = (int)(mlRep * 4);
 1672|    498|                    int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 1);
 1673|    498|                    if ((mlRep >= 4) && (gain2 > gain1))
  ------------------
  |  Branch (1673:25): [True: 498, False: 0]
  |  Branch (1673:41): [True: 110, False: 388]
  ------------------
 1674|    110|                        matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip;
  ------------------
  |  |  718|    110|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  721|    110|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|    110|#    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|    110|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1675|    498|                }
 1676|  5.89k|                if (isDxS) {
  ------------------
  |  Branch (1676:21): [True: 0, False: 5.89k]
  ------------------
 1677|      0|                    const U32 repIndex = (U32)(ip - base) - offset_1;
 1678|      0|                    const BYTE* repMatch = repIndex < prefixLowestIndex ?
  ------------------
  |  Branch (1678:44): [True: 0, False: 0]
  ------------------
 1679|      0|                                   dictBase + (repIndex - dictIndexDelta) :
 1680|      0|                                   base + repIndex;
 1681|      0|                    if ((ZSTD_index_overlap_check(prefixLowestIndex, repIndex))
  ------------------
  |  Branch (1681:25): [True: 0, False: 0]
  ------------------
 1682|      0|                        && (MEM_read32(repMatch) == MEM_read32(ip)) ) {
  ------------------
  |  Branch (1682:28): [True: 0, False: 0]
  ------------------
 1683|      0|                        const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend;
  ------------------
  |  Branch (1683:51): [True: 0, False: 0]
  ------------------
 1684|      0|                        size_t const mlRep = ZSTD_count_2segments(ip+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4;
 1685|      0|                        int const gain2 = (int)(mlRep * 4);
 1686|      0|                        int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 1);
 1687|      0|                        if ((mlRep >= 4) && (gain2 > gain1))
  ------------------
  |  Branch (1687:29): [True: 0, False: 0]
  |  Branch (1687:45): [True: 0, False: 0]
  ------------------
 1688|      0|                            matchLength = mlRep, offBase = REPCODE1_TO_OFFBASE, start = ip;
  ------------------
  |  |  718|      0|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  721|      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) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1689|      0|                    }
 1690|      0|                }
 1691|  5.89k|                {   size_t ofbCandidate=999999999;
 1692|  5.89k|                    size_t const ml2 = ZSTD_searchMax(ms, ip, iend, &ofbCandidate, mls, rowLog, searchMethod, dictMode);
 1693|  5.89k|                    int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)ofbCandidate));   /* raw approx */
 1694|  5.89k|                    int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offBase) + 7);
 1695|  5.89k|                    if ((ml2 >= 4) && (gain2 > gain1)) {
  ------------------
  |  Branch (1695:25): [True: 1.42k, False: 4.47k]
  |  Branch (1695:39): [True: 6, False: 1.41k]
  ------------------
 1696|      6|                        matchLength = ml2, offBase = ofbCandidate, start = ip;
 1697|      6|                        continue;
 1698|      6|            }   }   }
 1699|  6.61k|            break;  /* nothing found : store previous solution */
 1700|  6.62k|        }
 1701|       |
 1702|       |        /* NOTE:
 1703|       |         * Pay attention that `start[-value]` can lead to strange undefined behavior
 1704|       |         * notably if `value` is unsigned, resulting in a large positive `-value`.
 1705|       |         */
 1706|       |        /* catch up */
 1707|  6.61k|        if (OFFBASE_IS_OFFSET(offBase)) {
  ------------------
  |  |  723|  6.61k|#define OFFBASE_IS_OFFSET(o)  ((o) > ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  6.61k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  |  |  |  Branch (723:31): [True: 5.38k, False: 1.22k]
  |  |  ------------------
  ------------------
 1708|  5.38k|            if (dictMode == ZSTD_noDict) {
  ------------------
  |  Branch (1708:17): [True: 5.38k, False: 0]
  ------------------
 1709|  5.49k|                while ( ((start > anchor) & (start - OFFBASE_TO_OFFSET(offBase) > prefixLowest))
  ------------------
  |  |  725|  5.49k|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  5.49k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  5.49k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  |  Branch (1709:25): [True: 4.23k, False: 1.26k]
  ------------------
 1710|  4.23k|                     && (start[-1] == (start-OFFBASE_TO_OFFSET(offBase))[-1]) )  /* only search for offset within prefix */
  ------------------
  |  |  725|  4.23k|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  4.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  4.23k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  |  Branch (1710:25): [True: 103, False: 4.12k]
  ------------------
 1711|    103|                    { start--; matchLength++; }
 1712|  5.38k|            }
 1713|  5.38k|            if (isDxS) {
  ------------------
  |  Branch (1713:17): [True: 0, False: 5.38k]
  ------------------
 1714|      0|                U32 const matchIndex = (U32)((size_t)(start-base) - OFFBASE_TO_OFFSET(offBase));
  ------------------
  |  |  725|      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 */
  |  |  ------------------
  ------------------
 1715|      0|                const BYTE* match = (matchIndex < prefixLowestIndex) ? dictBase + matchIndex - dictIndexDelta : base + matchIndex;
  ------------------
  |  Branch (1715:37): [True: 0, False: 0]
  ------------------
 1716|      0|                const BYTE* const mStart = (matchIndex < prefixLowestIndex) ? dictLowest : prefixLowest;
  ------------------
  |  Branch (1716:44): [True: 0, False: 0]
  ------------------
 1717|      0|                while ((start>anchor) && (match>mStart) && (start[-1] == match[-1])) { start--; match--; matchLength++; }  /* catch up */
  ------------------
  |  Branch (1717:24): [True: 0, False: 0]
  |  Branch (1717:42): [True: 0, False: 0]
  |  Branch (1717:60): [True: 0, False: 0]
  ------------------
 1718|      0|            }
 1719|  5.38k|            offset_2 = offset_1; offset_1 = (U32)OFFBASE_TO_OFFSET(offBase);
  ------------------
  |  |  725|  5.38k|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  5.38k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  5.38k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
 1720|  5.38k|        }
 1721|       |        /* store sequence */
 1722|  6.61k|_storeSequence:
 1723|  6.61k|        {   size_t const litLength = (size_t)(start - anchor);
 1724|  6.61k|            ZSTD_storeSeq(seqStore, litLength, anchor, iend, (U32)offBase, matchLength);
 1725|  6.61k|            anchor = ip = start + matchLength;
 1726|  6.61k|        }
 1727|  6.61k|        if (ms->lazySkipping) {
  ------------------
  |  Branch (1727:13): [True: 0, False: 6.61k]
  ------------------
 1728|       |            /* We've found a match, disable lazy skipping mode, and refill the hash cache. */
 1729|      0|            if (searchMethod == search_rowHash) {
  ------------------
  |  Branch (1729:17): [True: 0, False: 0]
  ------------------
 1730|      0|                ZSTD_row_fillHashCache(ms, base, rowLog, mls, ms->nextToUpdate, ilimit);
 1731|      0|            }
 1732|      0|            ms->lazySkipping = 0;
 1733|      0|        }
 1734|       |
 1735|       |        /* check immediate repcode */
 1736|  6.61k|        if (isDxS) {
  ------------------
  |  Branch (1736:13): [True: 0, False: 6.61k]
  ------------------
 1737|      0|            while (ip <= ilimit) {
  ------------------
  |  Branch (1737:20): [True: 0, False: 0]
  ------------------
 1738|      0|                U32 const current2 = (U32)(ip-base);
 1739|      0|                U32 const repIndex = current2 - offset_2;
 1740|      0|                const BYTE* repMatch = repIndex < prefixLowestIndex ?
  ------------------
  |  Branch (1740:40): [True: 0, False: 0]
  ------------------
 1741|      0|                        dictBase - dictIndexDelta + repIndex :
 1742|      0|                        base + repIndex;
 1743|      0|                if ( (ZSTD_index_overlap_check(prefixLowestIndex, repIndex))
  ------------------
  |  Branch (1743:22): [True: 0, False: 0]
  ------------------
 1744|      0|                   && (MEM_read32(repMatch) == MEM_read32(ip)) ) {
  ------------------
  |  Branch (1744:23): [True: 0, False: 0]
  ------------------
 1745|      0|                    const BYTE* const repEnd2 = repIndex < prefixLowestIndex ? dictEnd : iend;
  ------------------
  |  Branch (1745:49): [True: 0, False: 0]
  ------------------
 1746|      0|                    matchLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd2, prefixLowest) + 4;
 1747|      0|                    offBase = offset_2; offset_2 = offset_1; offset_1 = (U32)offBase;   /* swap offset_2 <=> offset_1 */
 1748|      0|                    ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, matchLength);
  ------------------
  |  |  718|      0|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  721|      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) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1749|      0|                    ip += matchLength;
 1750|      0|                    anchor = ip;
 1751|      0|                    continue;
 1752|      0|                }
 1753|      0|                break;
 1754|      0|            }
 1755|      0|        }
 1756|       |
 1757|  6.61k|        if (dictMode == ZSTD_noDict) {
  ------------------
  |  Branch (1757:13): [True: 6.61k, False: 0]
  ------------------
 1758|  6.69k|            while ( ((ip <= ilimit) & (offset_2>0))
  ------------------
  |  Branch (1758:21): [True: 5.90k, False: 792]
  ------------------
 1759|  5.90k|                 && (MEM_read32(ip) == MEM_read32(ip - offset_2)) ) {
  ------------------
  |  Branch (1759:21): [True: 78, False: 5.82k]
  ------------------
 1760|       |                /* store sequence */
 1761|     78|                matchLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4;
 1762|     78|                offBase = offset_2; offset_2 = offset_1; offset_1 = (U32)offBase; /* swap repcodes */
 1763|     78|                ZSTD_storeSeq(seqStore, 0, anchor, iend, REPCODE1_TO_OFFBASE, matchLength);
  ------------------
  |  |  718|     78|#define REPCODE1_TO_OFFBASE REPCODE_TO_OFFBASE(1)
  |  |  ------------------
  |  |  |  |  721|     78|#define REPCODE_TO_OFFBASE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|     78|#    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|     78|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1764|     78|                ip += matchLength;
 1765|     78|                anchor = ip;
 1766|     78|                continue;   /* faster when present ... (?) */
 1767|     78|    }   }   }
 1768|       |
 1769|       |    /* If offset_1 started invalid (offsetSaved1 != 0) and became valid (offset_1 != 0),
 1770|       |     * rotate saved offsets. See comment in ZSTD_compressBlock_fast_noDict for more context. */
 1771|  1.99k|    offsetSaved2 = ((offsetSaved1 != 0) && (offset_1 != 0)) ? offsetSaved1 : offsetSaved2;
  ------------------
  |  Branch (1771:21): [True: 0, False: 1.99k]
  |  Branch (1771:44): [True: 0, False: 0]
  ------------------
 1772|       |
 1773|       |    /* save reps for next block */
 1774|  1.99k|    rep[0] = offset_1 ? offset_1 : offsetSaved1;
  ------------------
  |  Branch (1774:14): [True: 1.99k, False: 0]
  ------------------
 1775|  1.99k|    rep[1] = offset_2 ? offset_2 : offsetSaved2;
  ------------------
  |  Branch (1775:14): [True: 1.55k, False: 442]
  ------------------
 1776|       |
 1777|       |    /* Return the last literals size */
 1778|  1.99k|    return (size_t)(iend - anchor);
 1779|  1.99k|}
zstd_lazy.c:ZSTD_searchMax:
 1496|   179k|{
 1497|   179k|    if (dictMode == ZSTD_noDict) {
  ------------------
  |  Branch (1497:9): [True: 179k, False: 0]
  ------------------
 1498|   179k|        ZSTD_SWITCH_SEARCH_METHOD(noDict)
  ------------------
  |  | 1450|   179k|    switch (searchMethod) {                                       \
  |  |  ------------------
  |  |  |  Branch (1450:13): [True: 179k, False: 0]
  |  |  ------------------
  |  | 1451|   176k|        case search_hashChain:                                    \
  |  |  ------------------
  |  |  |  Branch (1451:9): [True: 176k, False: 2.81k]
  |  |  ------------------
  |  | 1452|   176k|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1437|   176k|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 176k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|   176k|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|   176k|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|   176k|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 176k, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|   176k|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|   176k|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|   176k|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 176k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 176k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|   176k|    }
  |  |  ------------------
  |  | 1453|   176k|            break;                                                \
  |  | 1454|   176k|        case search_binaryTree:                                   \
  |  |  ------------------
  |  |  |  Branch (1454:9): [True: 2.81k, False: 176k]
  |  |  ------------------
  |  | 1455|  2.81k|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1437|  2.81k|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 2.81k, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|  2.81k|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|  2.81k|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|  2.81k|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 2.81k, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|  2.81k|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|  2.81k|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|  2.81k|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 2.81k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 2.81k]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|  2.81k|    }
  |  |  ------------------
  |  | 1456|  2.81k|            break;                                                \
  |  | 1457|  2.81k|        case search_rowHash:                                      \
  |  |  ------------------
  |  |  |  Branch (1457:9): [True: 0, False: 179k]
  |  |  ------------------
  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1459|      0|            break;                                                \
  |  | 1460|   179k|    }                                                             \
  |  | 1461|   179k|    ZSTD_UNREACHABLE;
  |  |  ------------------
  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1499|      0|    } else if (dictMode == ZSTD_extDict) {
  ------------------
  |  Branch (1499:16): [True: 0, False: 0]
  ------------------
 1500|      0|        ZSTD_SWITCH_SEARCH_METHOD(extDict)
  ------------------
  |  | 1450|      0|    switch (searchMethod) {                                       \
  |  |  ------------------
  |  |  |  Branch (1450:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1451|      0|        case search_hashChain:                                    \
  |  |  ------------------
  |  |  |  Branch (1451:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1453|      0|            break;                                                \
  |  | 1454|      0|        case search_binaryTree:                                   \
  |  |  ------------------
  |  |  |  Branch (1454:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1456|      0|            break;                                                \
  |  | 1457|      0|        case search_rowHash:                                      \
  |  |  ------------------
  |  |  |  Branch (1457:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1459|      0|            break;                                                \
  |  | 1460|      0|    }                                                             \
  |  | 1461|      0|    ZSTD_UNREACHABLE;
  |  |  ------------------
  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1501|      0|    } else if (dictMode == ZSTD_dictMatchState) {
  ------------------
  |  Branch (1501:16): [True: 0, False: 0]
  ------------------
 1502|      0|        ZSTD_SWITCH_SEARCH_METHOD(dictMatchState)
  ------------------
  |  | 1450|      0|    switch (searchMethod) {                                       \
  |  |  ------------------
  |  |  |  Branch (1450:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1451|      0|        case search_hashChain:                                    \
  |  |  ------------------
  |  |  |  Branch (1451:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1453|      0|            break;                                                \
  |  | 1454|      0|        case search_binaryTree:                                   \
  |  |  ------------------
  |  |  |  Branch (1454:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1456|      0|            break;                                                \
  |  | 1457|      0|        case search_rowHash:                                      \
  |  |  ------------------
  |  |  |  Branch (1457:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1459|      0|            break;                                                \
  |  | 1460|      0|    }                                                             \
  |  | 1461|      0|    ZSTD_UNREACHABLE;
  |  |  ------------------
  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1503|      0|    } else if (dictMode == ZSTD_dedicatedDictSearch) {
  ------------------
  |  Branch (1503:16): [True: 0, False: 0]
  ------------------
 1504|      0|        ZSTD_SWITCH_SEARCH_METHOD(dedicatedDictSearch)
  ------------------
  |  | 1450|      0|    switch (searchMethod) {                                       \
  |  |  ------------------
  |  |  |  Branch (1450:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1451|      0|        case search_hashChain:                                    \
  |  |  ------------------
  |  |  |  Branch (1451:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1452|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_HC_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1430|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1430:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1431|      0|        return ZSTD_HC_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1360|      0|#define ZSTD_HC_SEARCH_FN(dictMode, mls) ZSTD_HcFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1453|      0|            break;                                                \
  |  | 1454|      0|        case search_binaryTree:                                   \
  |  |  ------------------
  |  |  |  Branch (1454:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1455|      0|            ZSTD_SWITCH_MLS(GEN_ZSTD_CALL_BT_SEARCH_FN, dictMode) \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1427|      0|    case mls:                                                             \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1427:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1428|      0|        return ZSTD_BT_SEARCH_FN(dictMode, mls)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1359|      0|#define ZSTD_BT_SEARCH_FN(dictMode, mls) ZSTD_BtFindBestMatch_##dictMode##_##mls
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1456|      0|            break;                                                \
  |  | 1457|      0|        case search_rowHash:                                      \
  |  |  ------------------
  |  |  |  Branch (1457:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  ------------------
  |  |  |  | 1437|      0|    switch (mls) {                     \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1437:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  | 1438|      0|        ZSTD_FOR_EACH_MLS(X, dictMode) \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1407|      0|    X(dictMode, 4)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1408|      0|    X(dictMode, 5)                     \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  | 1409|      0|    X(dictMode, 6)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1458|      0|            ZSTD_SWITCH_MLS(ZSTD_SWITCH_ROWLOG, dictMode)         \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1442|      0|    case mls:                                                                \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1442:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1443|      0|        switch (rowLog) {                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (1443:17): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1397|      0|    X(dictMode, mls, 4)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1398|      0|    X(dictMode, mls, 5)                        \
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  | 1399|      0|    X(dictMode, mls, 6)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1444|      0|            ZSTD_FOR_EACH_ROWLOG(GEN_ZSTD_CALL_ROW_SEARCH_FN, dictMode, mls) \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1433|      0|    case rowLog:                                                                   \
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (1433:5): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1434|      0|        return ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog)(ms, ip, iend, offsetPtr);
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | 1361|      0|#define ZSTD_ROW_SEARCH_FN(dictMode, mls, rowLog) ZSTD_RowFindBestMatch_##dictMode##_##mls##_##rowLog
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1445|      0|        }                                                                    \
  |  |  |  |  |  |  |  |  |  | 1446|      0|        ZSTD_UNREACHABLE;                                                    \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  | 1447|      0|        break;
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  | 1439|      0|    }
  |  |  ------------------
  |  | 1459|      0|            break;                                                \
  |  | 1460|      0|    }                                                             \
  |  | 1461|      0|    ZSTD_UNREACHABLE;
  |  |  ------------------
  |  |  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1505|      0|    }
 1506|      0|    ZSTD_UNREACHABLE;
  ------------------
  |  |  195|      0|#  define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
  |  |  ------------------
  |  |  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |  |  Branch (195:78): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1507|      0|    return 0;
 1508|      0|}
zstd_lazy.c:ZSTD_HcFindBestMatch_noDict_4:
 1380|   176k|    {                                                                                 \
 1381|   176k|        assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls);                          \
  ------------------
  |  |   70|   176k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1382|   176k|        return ZSTD_HcFindBestMatch(ms, ip, iLimit, offsetPtr, mls, ZSTD_##dictMode); \
 1383|   176k|    }                                                                                 \
zstd_lazy.c:ZSTD_HcFindBestMatch:
  672|   176k|{
  673|   176k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
  674|   176k|    U32* const chainTable = ms->chainTable;
  675|   176k|    const U32 chainSize = (1 << cParams->chainLog);
  676|   176k|    const U32 chainMask = chainSize-1;
  677|   176k|    const BYTE* const base = ms->window.base;
  678|   176k|    const BYTE* const dictBase = ms->window.dictBase;
  679|   176k|    const U32 dictLimit = ms->window.dictLimit;
  680|   176k|    const BYTE* const prefixStart = base + dictLimit;
  681|   176k|    const BYTE* const dictEnd = dictBase + dictLimit;
  682|   176k|    const U32 curr = (U32)(ip-base);
  683|   176k|    const U32 maxDistance = 1U << cParams->windowLog;
  684|   176k|    const U32 lowestValid = ms->window.lowLimit;
  685|   176k|    const U32 withinMaxDistance = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid;
  ------------------
  |  Branch (685:35): [True: 0, False: 176k]
  ------------------
  686|   176k|    const U32 isDictionary = (ms->loadedDictEnd != 0);
  687|   176k|    const U32 lowLimit = isDictionary ? lowestValid : withinMaxDistance;
  ------------------
  |  Branch (687:26): [True: 0, False: 176k]
  ------------------
  688|   176k|    const U32 minChain = curr > chainSize ? curr - chainSize : 0;
  ------------------
  |  Branch (688:26): [True: 175k, False: 937]
  ------------------
  689|   176k|    U32 nbAttempts = 1U << cParams->searchLog;
  690|   176k|    size_t ml=4-1;
  691|       |
  692|   176k|    const ZSTD_MatchState_t* const dms = ms->dictMatchState;
  693|   176k|    const U32 ddsHashLog = dictMode == ZSTD_dedicatedDictSearch
  ------------------
  |  Branch (693:28): [True: 0, False: 176k]
  ------------------
  694|   176k|                         ? dms->cParams.hashLog - ZSTD_LAZY_DDSS_BUCKET_LOG : 0;
  ------------------
  |  |   22|      0|#define ZSTD_LAZY_DDSS_BUCKET_LOG 2
  ------------------
  695|   176k|    const size_t ddsIdx = dictMode == ZSTD_dedicatedDictSearch
  ------------------
  |  Branch (695:27): [True: 0, False: 176k]
  ------------------
  696|   176k|                        ? ZSTD_hashPtr(ip, ddsHashLog, mls) << ZSTD_LAZY_DDSS_BUCKET_LOG : 0;
  ------------------
  |  |   22|      0|#define ZSTD_LAZY_DDSS_BUCKET_LOG 2
  ------------------
  697|       |
  698|   176k|    U32 matchIndex;
  699|       |
  700|   176k|    if (dictMode == ZSTD_dedicatedDictSearch) {
  ------------------
  |  Branch (700:9): [True: 0, False: 176k]
  ------------------
  701|      0|        const U32* entry = &dms->hashTable[ddsIdx];
  702|      0|        PREFETCH_L1(entry);
  ------------------
  |  |  145|      0|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
  703|      0|    }
  704|       |
  705|       |    /* HC4 match finder */
  706|   176k|    matchIndex = ZSTD_insertAndFindFirstIndex_internal(ms, cParams, ip, mls, ms->lazySkipping);
  707|       |
  708|   226k|    for ( ; (matchIndex>=lowLimit) & (nbAttempts>0) ; nbAttempts--) {
  ------------------
  |  Branch (708:13): [True: 50.3k, False: 176k]
  ------------------
  709|  50.3k|        size_t currentMl=0;
  710|  50.3k|        if ((dictMode != ZSTD_extDict) || matchIndex >= dictLimit) {
  ------------------
  |  Branch (710:13): [True: 50.3k, False: 0]
  |  Branch (710:43): [True: 0, False: 0]
  ------------------
  711|  50.3k|            const BYTE* const match = base + matchIndex;
  712|  50.3k|            assert(matchIndex >= dictLimit);   /* ensures this is true if dictMode != ZSTD_extDict */
  ------------------
  |  |   70|  50.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  713|       |            /* read 4B starting from (match + ml + 1 - sizeof(U32)) */
  714|  50.3k|            if (MEM_read32(match + ml - 3) == MEM_read32(ip + ml - 3))   /* potentially better */
  ------------------
  |  Branch (714:17): [True: 9.14k, False: 41.1k]
  ------------------
  715|  9.14k|                currentMl = ZSTD_count(ip, match, iLimit);
  716|  50.3k|        } 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|  50.3k|        if (currentMl > ml) {
  ------------------
  |  Branch (724:13): [True: 9.14k, False: 41.2k]
  ------------------
  725|  9.14k|            ml = currentMl;
  726|  9.14k|            *offsetPtr = OFFSET_TO_OFFBASE(curr - matchIndex);
  ------------------
  |  |  722|  9.14k|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  9.14k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  9.14k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  727|  9.14k|            if (ip+currentMl == iLimit) break; /* best possible, avoids read overflow on next attempt */
  ------------------
  |  Branch (727:17): [True: 346, False: 8.79k]
  ------------------
  728|  9.14k|        }
  729|       |
  730|  50.0k|        if (matchIndex <= minChain) break;
  ------------------
  |  Branch (730:13): [True: 0, False: 50.0k]
  ------------------
  731|  50.0k|        matchIndex = NEXT_IN_CHAIN(matchIndex, chainMask);
  ------------------
  |  |  626|  50.0k|#define NEXT_IN_CHAIN(d, mask)   chainTable[(d) & (mask)]
  ------------------
  732|  50.0k|    }
  733|       |
  734|   176k|    assert(nbAttempts <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */
  ------------------
  |  |   70|   176k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  735|   176k|    if (dictMode == ZSTD_dedicatedDictSearch) {
  ------------------
  |  Branch (735:9): [True: 0, False: 176k]
  ------------------
  736|      0|        ml = ZSTD_dedicatedDictSearch_lazy_search(offsetPtr, ml, nbAttempts, dms,
  737|      0|                                                  ip, iLimit, prefixStart, curr, dictLimit, ddsIdx);
  738|   176k|    } else if (dictMode == ZSTD_dictMatchState) {
  ------------------
  |  Branch (738:16): [True: 0, False: 176k]
  ------------------
  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));
  ------------------
  |  |  722|      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|   176k|    return ml;
  773|   176k|}
zstd_lazy.c:ZSTD_BtFindBestMatch_noDict_4:
 1370|  2.81k|    {                                                                                  \
 1371|  2.81k|        assert(MAX(4, MIN(6, ms->cParams.minMatch)) == mls);                           \
  ------------------
  |  |   70|  2.81k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1372|  2.81k|        return ZSTD_BtFindBestMatch(ms, ip, iLimit, offBasePtr, mls, ZSTD_##dictMode); \
 1373|  2.81k|    }                                                                                  \
zstd_lazy.c:ZSTD_BtFindBestMatch:
  400|  2.81k|{
  401|  2.81k|    DEBUGLOG(7, "ZSTD_BtFindBestMatch");
  ------------------
  |  |  104|  2.81k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.81k]
  |  |  ------------------
  ------------------
  402|  2.81k|    if (ip < ms->window.base + ms->nextToUpdate) return 0;   /* skipped area */
  ------------------
  |  Branch (402:9): [True: 270, False: 2.54k]
  ------------------
  403|  2.54k|    ZSTD_updateDUBT(ms, ip, iLimit, mls);
  404|  2.54k|    return ZSTD_DUBT_findBestMatch(ms, ip, iLimit, offBasePtr, mls, dictMode);
  405|  2.81k|}
zstd_lazy.c:ZSTD_updateDUBT:
   32|  2.54k|{
   33|  2.54k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
   34|  2.54k|    U32* const hashTable = ms->hashTable;
   35|  2.54k|    U32  const hashLog = cParams->hashLog;
   36|       |
   37|  2.54k|    U32* const bt = ms->chainTable;
   38|  2.54k|    U32  const btLog  = cParams->chainLog - 1;
   39|  2.54k|    U32  const btMask = (1 << btLog) - 1;
   40|       |
   41|  2.54k|    const BYTE* const base = ms->window.base;
   42|  2.54k|    U32 const target = (U32)(ip - base);
   43|  2.54k|    U32 idx = ms->nextToUpdate;
   44|       |
   45|  2.54k|    if (idx != target)
  ------------------
  |  Branch (45:9): [True: 453, False: 2.09k]
  ------------------
   46|    453|        DEBUGLOG(7, "ZSTD_updateDUBT, from %u to %u (dictLimit:%u)",
  ------------------
  |  |  104|    453|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 453]
  |  |  ------------------
  ------------------
   47|  2.54k|                    idx, target, ms->window.dictLimit);
   48|  2.54k|    assert(ip + 8 <= iend);   /* condition for ZSTD_hashPtr */
  ------------------
  |  |   70|  2.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   49|  2.54k|    (void)iend;
   50|       |
   51|  2.54k|    assert(idx >= ms->window.dictLimit);   /* condition for valid base+idx */
  ------------------
  |  |   70|  2.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   52|  3.97k|    for ( ; idx < target ; idx++) {
  ------------------
  |  Branch (52:13): [True: 1.43k, False: 2.54k]
  ------------------
   53|  1.43k|        size_t const h  = ZSTD_hashPtr(base + idx, hashLog, mls);   /* assumption : ip + 8 <= iend */
   54|  1.43k|        U32    const matchIndex = hashTable[h];
   55|       |
   56|  1.43k|        U32*   const nextCandidatePtr = bt + 2*(idx&btMask);
   57|  1.43k|        U32*   const sortMarkPtr  = nextCandidatePtr + 1;
   58|       |
   59|  1.43k|        DEBUGLOG(8, "ZSTD_updateDUBT: insert %u", idx);
  ------------------
  |  |  104|  1.43k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.43k]
  |  |  ------------------
  ------------------
   60|  1.43k|        hashTable[h] = idx;   /* Update Hash Table */
   61|  1.43k|        *nextCandidatePtr = matchIndex;   /* update BT like a chain */
   62|  1.43k|        *sortMarkPtr = ZSTD_DUBT_UNSORTED_MARK;
  ------------------
  |  |   34|  1.43k|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
   63|  1.43k|    }
   64|  2.54k|    ms->nextToUpdate = target;
   65|  2.54k|}
zstd_lazy.c:ZSTD_DUBT_findBestMatch:
  248|  2.54k|{
  249|  2.54k|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
  250|  2.54k|    U32*   const hashTable = ms->hashTable;
  251|  2.54k|    U32    const hashLog = cParams->hashLog;
  252|  2.54k|    size_t const h  = ZSTD_hashPtr(ip, hashLog, mls);
  253|  2.54k|    U32          matchIndex  = hashTable[h];
  254|       |
  255|  2.54k|    const BYTE* const base = ms->window.base;
  256|  2.54k|    U32    const curr = (U32)(ip-base);
  257|  2.54k|    U32    const windowLow = ZSTD_getLowestMatchIndex(ms, curr, cParams->windowLog);
  258|       |
  259|  2.54k|    U32*   const bt = ms->chainTable;
  260|  2.54k|    U32    const btLog  = cParams->chainLog - 1;
  261|  2.54k|    U32    const btMask = (1 << btLog) - 1;
  262|  2.54k|    U32    const btLow = (btMask >= curr) ? 0 : curr - btMask;
  ------------------
  |  Branch (262:26): [True: 34, False: 2.51k]
  ------------------
  263|  2.54k|    U32    const unsortLimit = MAX(btLow, windowLow);
  ------------------
  |  |   55|  2.54k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (55:19): [True: 0, False: 2.54k]
  |  |  ------------------
  ------------------
  264|       |
  265|  2.54k|    U32*         nextCandidate = bt + 2*(matchIndex&btMask);
  266|  2.54k|    U32*         unsortedMark = bt + 2*(matchIndex&btMask) + 1;
  267|  2.54k|    U32          nbCompares = 1U << cParams->searchLog;
  268|  2.54k|    U32          nbCandidates = nbCompares;
  269|  2.54k|    U32          previousCandidate = 0;
  270|       |
  271|  2.54k|    DEBUGLOG(7, "ZSTD_DUBT_findBestMatch (%u) ", curr);
  ------------------
  |  |  104|  2.54k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.54k]
  |  |  ------------------
  ------------------
  272|  2.54k|    assert(ip <= iend-8);   /* required for h calculation */
  ------------------
  |  |   70|  2.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  273|  2.54k|    assert(dictMode != ZSTD_dedicatedDictSearch);
  ------------------
  |  |   70|  2.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  274|       |
  275|       |    /* reach end of unsorted candidates list */
  276|  2.82k|    while ( (matchIndex > unsortLimit)
  ------------------
  |  Branch (276:13): [True: 1.10k, False: 1.72k]
  ------------------
  277|  1.10k|         && (*unsortedMark == ZSTD_DUBT_UNSORTED_MARK)
  ------------------
  |  |   34|  1.10k|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
  |  Branch (277:13): [True: 280, False: 826]
  ------------------
  278|    280|         && (nbCandidates > 1) ) {
  ------------------
  |  Branch (278:13): [True: 280, False: 0]
  ------------------
  279|    280|        DEBUGLOG(8, "ZSTD_DUBT_findBestMatch: candidate %u is unsorted",
  ------------------
  |  |  104|    280|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 280]
  |  |  ------------------
  ------------------
  280|    280|                    matchIndex);
  281|    280|        *unsortedMark = previousCandidate;  /* the unsortedMark becomes a reversed chain, to move up back to original position */
  282|    280|        previousCandidate = matchIndex;
  283|    280|        matchIndex = *nextCandidate;
  284|    280|        nextCandidate = bt + 2*(matchIndex&btMask);
  285|    280|        unsortedMark = bt + 2*(matchIndex&btMask) + 1;
  286|    280|        nbCandidates --;
  287|    280|    }
  288|       |
  289|       |    /* nullify last candidate if it's still unsorted
  290|       |     * simplification, detrimental to compression ratio, beneficial for speed */
  291|  2.54k|    if ( (matchIndex > unsortLimit)
  ------------------
  |  Branch (291:10): [True: 826, False: 1.72k]
  ------------------
  292|    826|      && (*unsortedMark==ZSTD_DUBT_UNSORTED_MARK) ) {
  ------------------
  |  |   34|    826|#define ZSTD_DUBT_UNSORTED_MARK 1   /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
  ------------------
  |  Branch (292:10): [True: 0, False: 826]
  ------------------
  293|      0|        DEBUGLOG(7, "ZSTD_DUBT_findBestMatch: nullify last unsorted candidate %u",
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  294|      0|                    matchIndex);
  295|      0|        *nextCandidate = *unsortedMark = 0;
  296|      0|    }
  297|       |
  298|       |    /* batch sort stacked candidates */
  299|  2.54k|    matchIndex = previousCandidate;
  300|  2.82k|    while (matchIndex) {  /* will end on matchIndex == 0 */
  ------------------
  |  Branch (300:12): [True: 280, False: 2.54k]
  ------------------
  301|    280|        U32* const nextCandidateIdxPtr = bt + 2*(matchIndex&btMask) + 1;
  302|    280|        U32 const nextCandidateIdx = *nextCandidateIdxPtr;
  303|    280|        ZSTD_insertDUBT1(ms, matchIndex, iend,
  304|    280|                         nbCandidates, unsortLimit, dictMode);
  305|    280|        matchIndex = nextCandidateIdx;
  306|    280|        nbCandidates++;
  307|    280|    }
  308|       |
  309|       |    /* find longest match */
  310|  2.54k|    {   size_t commonLengthSmaller = 0, commonLengthLarger = 0;
  311|  2.54k|        const BYTE* const dictBase = ms->window.dictBase;
  312|  2.54k|        const U32 dictLimit = ms->window.dictLimit;
  313|  2.54k|        const BYTE* const dictEnd = dictBase + dictLimit;
  314|  2.54k|        const BYTE* const prefixStart = base + dictLimit;
  315|  2.54k|        U32* smallerPtr = bt + 2*(curr&btMask);
  316|  2.54k|        U32* largerPtr  = bt + 2*(curr&btMask) + 1;
  317|  2.54k|        U32 matchEndIdx = curr + 8 + 1;
  318|  2.54k|        U32 dummy32;   /* to be nullified at the end */
  319|  2.54k|        size_t bestLength = 0;
  320|       |
  321|  2.54k|        matchIndex  = hashTable[h];
  322|  2.54k|        hashTable[h] = curr;   /* Update Hash Table */
  323|       |
  324|  3.86k|        for (; nbCompares && (matchIndex > windowLow); --nbCompares) {
  ------------------
  |  Branch (324:16): [True: 3.86k, False: 0]
  |  Branch (324:30): [True: 1.53k, False: 2.33k]
  ------------------
  325|  1.53k|            U32* const nextPtr = bt + 2*(matchIndex & btMask);
  326|  1.53k|            size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger);   /* guaranteed minimum nb of common bytes */
  ------------------
  |  |   54|  1.53k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 350, False: 1.18k]
  |  |  ------------------
  ------------------
  327|  1.53k|            const BYTE* match;
  328|       |
  329|  1.53k|            if ((dictMode != ZSTD_extDict) || (matchIndex+matchLength >= dictLimit)) {
  ------------------
  |  Branch (329:17): [True: 1.53k, False: 0]
  |  Branch (329:47): [True: 0, False: 0]
  ------------------
  330|  1.53k|                match = base + matchIndex;
  331|  1.53k|                matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend);
  332|  1.53k|            } 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|  1.53k|            if (matchLength > bestLength) {
  ------------------
  |  Branch (339:17): [True: 1.22k, False: 310]
  ------------------
  340|  1.22k|                if (matchLength > matchEndIdx - matchIndex)
  ------------------
  |  Branch (340:21): [True: 180, False: 1.04k]
  ------------------
  341|    180|                    matchEndIdx = matchIndex + (U32)matchLength;
  342|  1.22k|                if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit32(curr - matchIndex + 1) - ZSTD_highbit32((U32)*offBasePtr)) )
  ------------------
  |  Branch (342:22): [True: 1.22k, False: 0]
  ------------------
  343|  1.22k|                    bestLength = matchLength, *offBasePtr = OFFSET_TO_OFFBASE(curr - matchIndex);
  ------------------
  |  |  722|  1.22k|#define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|  1.22k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFSET_TO_OFFBASE(o)  (assert((o)>0), o + ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|  1.22k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  344|  1.22k|                if (ip+matchLength == iend) {   /* equal : no way to know if inf or sup */
  ------------------
  |  Branch (344:21): [True: 218, False: 1.00k]
  ------------------
  345|    218|                    if (dictMode == ZSTD_dictMatchState) {
  ------------------
  |  Branch (345:25): [True: 0, False: 218]
  ------------------
  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|    218|                    break;   /* drop, to guarantee consistency (miss a little bit of compression) */
  351|    218|                }
  352|  1.22k|            }
  353|       |
  354|  1.31k|            if (match[matchLength] < ip[matchLength]) {
  ------------------
  |  Branch (354:17): [True: 670, False: 645]
  ------------------
  355|       |                /* match is smaller than current */
  356|    670|                *smallerPtr = matchIndex;             /* update smaller idx */
  357|    670|                commonLengthSmaller = matchLength;    /* all smaller will now have at least this guaranteed common length */
  358|    670|                if (matchIndex <= btLow) { smallerPtr=&dummy32; break; }   /* beyond tree size, stop the search */
  ------------------
  |  Branch (358:21): [True: 0, False: 670]
  ------------------
  359|    670|                smallerPtr = nextPtr+1;               /* new "smaller" => larger of match */
  360|    670|                matchIndex = nextPtr[1];              /* new matchIndex larger than previous (closer to current) */
  361|    670|            } else {
  362|       |                /* match is larger than current */
  363|    645|                *largerPtr = matchIndex;
  364|    645|                commonLengthLarger = matchLength;
  365|    645|                if (matchIndex <= btLow) { largerPtr=&dummy32; break; }   /* beyond tree size, stop the search */
  ------------------
  |  Branch (365:21): [True: 0, False: 645]
  ------------------
  366|    645|                largerPtr = nextPtr;
  367|    645|                matchIndex = nextPtr[0];
  368|    645|        }   }
  369|       |
  370|  2.54k|        *smallerPtr = *largerPtr = 0;
  371|       |
  372|  2.54k|        assert(nbCompares <= (1U << ZSTD_SEARCHLOG_MAX)); /* Check we haven't underflowed. */
  ------------------
  |  |   70|  2.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  373|  2.54k|        if (dictMode == ZSTD_dictMatchState && nbCompares) {
  ------------------
  |  Branch (373:13): [True: 0, False: 2.54k]
  |  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|  2.54k|        assert(matchEndIdx > curr+8); /* ensure nextToUpdate is increased */
  ------------------
  |  |   70|  2.54k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  381|  2.54k|        ms->nextToUpdate = matchEndIdx - 8;   /* skip repetitive patterns */
  382|  2.54k|        if (bestLength >= MINMATCH) {
  ------------------
  |  |   98|  2.54k|#define MINMATCH 3
  ------------------
  |  Branch (382:13): [True: 797, False: 1.75k]
  ------------------
  383|    797|            U32 const mIndex = curr - (U32)OFFBASE_TO_OFFSET(*offBasePtr); (void)mIndex;
  ------------------
  |  |  725|    797|#define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   70|    797|#    define assert(condition) ((void)0)   /* disable assert (default) */
  |  |  ------------------
  |  |               #define OFFBASE_TO_OFFSET(o)  (assert(OFFBASE_IS_OFFSET(o)), (o) - ZSTD_REP_NUM)
  |  |  ------------------
  |  |  |  |   64|    797|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  |  |  ------------------
  ------------------
  384|    797|            DEBUGLOG(8, "ZSTD_DUBT_findBestMatch(%u) : found match of length %u and offsetCode %u (pos %u)",
  ------------------
  |  |  104|    797|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 797]
  |  |  ------------------
  ------------------
  385|    797|                        curr, (U32)bestLength, (U32)*offBasePtr, mIndex);
  386|    797|        }
  387|  2.54k|        return bestLength;
  388|  2.54k|    }
  389|  2.54k|}
zstd_lazy.c:ZSTD_insertDUBT1:
   78|    280|{
   79|    280|    const ZSTD_compressionParameters* const cParams = &ms->cParams;
   80|    280|    U32* const bt = ms->chainTable;
   81|    280|    U32  const btLog  = cParams->chainLog - 1;
   82|    280|    U32  const btMask = (1 << btLog) - 1;
   83|    280|    size_t commonLengthSmaller=0, commonLengthLarger=0;
   84|    280|    const BYTE* const base = ms->window.base;
   85|    280|    const BYTE* const dictBase = ms->window.dictBase;
   86|    280|    const U32 dictLimit = ms->window.dictLimit;
   87|    280|    const BYTE* const ip = (curr>=dictLimit) ? base + curr : dictBase + curr;
  ------------------
  |  Branch (87:28): [True: 280, False: 0]
  ------------------
   88|    280|    const BYTE* const iend = (curr>=dictLimit) ? inputEnd : dictBase + dictLimit;
  ------------------
  |  Branch (88:30): [True: 280, False: 0]
  ------------------
   89|    280|    const BYTE* const dictEnd = dictBase + dictLimit;
   90|    280|    const BYTE* const prefixStart = base + dictLimit;
   91|    280|    const BYTE* match;
   92|    280|    U32* smallerPtr = bt + 2*(curr&btMask);
   93|    280|    U32* largerPtr  = smallerPtr + 1;
   94|    280|    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|    280|    U32 dummy32;   /* to be nullified at the end */
   96|    280|    U32 const windowValid = ms->window.lowLimit;
   97|    280|    U32 const maxDistance = 1U << cParams->windowLog;
   98|    280|    U32 const windowLow = (curr - windowValid > maxDistance) ? curr - maxDistance : windowValid;
  ------------------
  |  Branch (98:27): [True: 0, False: 280]
  ------------------
   99|       |
  100|       |
  101|    280|    DEBUGLOG(8, "ZSTD_insertDUBT1(%u) (dictLimit=%u, lowLimit=%u)",
  ------------------
  |  |  104|    280|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 280]
  |  |  ------------------
  ------------------
  102|    280|                curr, dictLimit, windowLow);
  103|    280|    assert(curr >= btLow);
  ------------------
  |  |   70|    280|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  104|    280|    assert(ip < iend);   /* condition for ZSTD_count */
  ------------------
  |  |   70|    280|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  105|       |
  106|    677|    for (; nbCompares && (matchIndex > windowLow); --nbCompares) {
  ------------------
  |  Branch (106:12): [True: 677, False: 0]
  |  Branch (106:26): [True: 400, False: 277]
  ------------------
  107|    400|        U32* const nextPtr = bt + 2*(matchIndex & btMask);
  108|    400|        size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger);   /* guaranteed minimum nb of common bytes */
  ------------------
  |  |   54|    400|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 102, False: 298]
  |  |  ------------------
  ------------------
  109|    400|        assert(matchIndex < curr);
  ------------------
  |  |   70|    400|#    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|    400|        if ( (dictMode != ZSTD_extDict)
  ------------------
  |  Branch (114:14): [True: 400, False: 0]
  ------------------
  115|      0|          || (matchIndex+matchLength >= dictLimit)  /* both in current segment*/
  ------------------
  |  Branch (115:14): [True: 0, False: 0]
  ------------------
  116|    400|          || (curr < dictLimit) /* both in extDict */) {
  ------------------
  |  Branch (116:14): [True: 0, False: 0]
  ------------------
  117|    400|            const BYTE* const mBase = ( (dictMode != ZSTD_extDict)
  ------------------
  |  Branch (117:41): [True: 400, False: 0]
  ------------------
  118|      0|                                     || (matchIndex+matchLength >= dictLimit)) ?
  ------------------
  |  Branch (118:41): [True: 0, False: 0]
  ------------------
  119|    400|                                        base : dictBase;
  120|    400|            assert( (matchIndex+matchLength >= dictLimit)   /* might be wrong if extDict is incorrectly set to 0 */
  ------------------
  |  |   70|    400|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  121|    400|                 || (curr < dictLimit) );
  122|    400|            match = mBase + matchIndex;
  123|    400|            matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend);
  124|    400|        } 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|    400|        DEBUGLOG(8, "ZSTD_insertDUBT1: comparing %u with %u : found %u common bytes ",
  ------------------
  |  |  104|    400|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 400]
  |  |  ------------------
  ------------------
  132|    400|                    curr, matchIndex, (U32)matchLength);
  133|       |
  134|    400|        if (ip+matchLength == iend) {   /* equal : no way to know if inf or sup */
  ------------------
  |  Branch (134:13): [True: 3, False: 397]
  ------------------
  135|      3|            break;   /* drop , to guarantee consistency ; miss a bit of compression, but other solutions can corrupt tree */
  136|      3|        }
  137|       |
  138|    397|        if (match[matchLength] < ip[matchLength]) {  /* necessarily within buffer */
  ------------------
  |  Branch (138:13): [True: 217, False: 180]
  ------------------
  139|       |            /* match is smaller than current */
  140|    217|            *smallerPtr = matchIndex;             /* update smaller idx */
  141|    217|            commonLengthSmaller = matchLength;    /* all smaller will now have at least this guaranteed common length */
  142|    217|            if (matchIndex <= btLow) { smallerPtr=&dummy32; break; }   /* beyond tree size, stop searching */
  ------------------
  |  Branch (142:17): [True: 0, False: 217]
  ------------------
  143|    217|            DEBUGLOG(8, "ZSTD_insertDUBT1: %u (>btLow=%u) is smaller : next => %u",
  ------------------
  |  |  104|    217|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 217]
  |  |  ------------------
  ------------------
  144|    217|                        matchIndex, btLow, nextPtr[1]);
  145|    217|            smallerPtr = nextPtr+1;               /* new "candidate" => larger than match, which was smaller than target */
  146|    217|            matchIndex = nextPtr[1];              /* new matchIndex, larger than previous and closer to current */
  147|    217|        } else {
  148|       |            /* match is larger than current */
  149|    180|            *largerPtr = matchIndex;
  150|    180|            commonLengthLarger = matchLength;
  151|    180|            if (matchIndex <= btLow) { largerPtr=&dummy32; break; }   /* beyond tree size, stop searching */
  ------------------
  |  Branch (151:17): [True: 0, False: 180]
  ------------------
  152|    180|            DEBUGLOG(8, "ZSTD_insertDUBT1: %u (>btLow=%u) is larger => %u",
  ------------------
  |  |  104|    180|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 180]
  |  |  ------------------
  ------------------
  153|    180|                        matchIndex, btLow, nextPtr[0]);
  154|    180|            largerPtr = nextPtr;
  155|    180|            matchIndex = nextPtr[0];
  156|    180|    }   }
  157|       |
  158|    280|    *smallerPtr = *largerPtr = 0;
  159|    280|}

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

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

HUF_readDTableX1_wksp:
  386|  3.55k|{
  387|  3.55k|    U32 tableLog = 0;
  388|  3.55k|    U32 nbSymbols = 0;
  389|  3.55k|    size_t iSize;
  390|  3.55k|    void* const dtPtr = DTable + 1;
  391|  3.55k|    HUF_DEltX1* const dt = (HUF_DEltX1*)dtPtr;
  392|  3.55k|    HUF_ReadDTableX1_Workspace* wksp = (HUF_ReadDTableX1_Workspace*)workSpace;
  393|       |
  394|  3.55k|    DEBUG_STATIC_ASSERT(HUF_DECOMPRESS_WORKSPACE_SIZE >= sizeof(*wksp));
  ------------------
  |  |   39|  3.55k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  395|  3.55k|    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 (395:9): [True: 0, False: 3.55k]
  ------------------
  396|       |
  397|  3.55k|    DEBUG_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUF_DTable));
  ------------------
  |  |   39|  3.55k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  398|       |    /* ZSTD_memset(huffWeight, 0, sizeof(huffWeight)); */   /* is not necessary, even though some analyzer complain ... */
  399|       |
  400|  3.55k|    iSize = HUF_readStats_wksp(wksp->huffWeight, HUF_SYMBOLVALUE_MAX + 1, wksp->rankVal, &nbSymbols, &tableLog, src, srcSize, wksp->statsWksp, sizeof(wksp->statsWksp), flags);
  ------------------
  |  |   39|  3.55k|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
  401|  3.55k|    if (HUF_isError(iSize)) return iSize;
  ------------------
  |  |   78|  3.55k|#define HUF_isError ERR_isError
  ------------------
  |  Branch (401:9): [True: 0, False: 3.55k]
  ------------------
  402|       |
  403|       |
  404|       |    /* Table header */
  405|  3.55k|    {   DTableDesc dtd = HUF_getDTableDesc(DTable);
  406|  3.55k|        U32 const maxTableLog = dtd.maxTableLog + 1;
  407|  3.55k|        U32 const targetTableLog = MIN(maxTableLog, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   54|  3.55k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 3.55k]
  |  |  ------------------
  ------------------
  408|  3.55k|        tableLog = HUF_rescaleStats(wksp->huffWeight, wksp->rankVal, nbSymbols, tableLog, targetTableLog);
  409|  3.55k|        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 (409:13): [True: 0, False: 3.55k]
  ------------------
  410|  3.55k|        dtd.tableType = 0;
  411|  3.55k|        dtd.tableLog = (BYTE)tableLog;
  412|  3.55k|        ZSTD_memcpy(DTable, &dtd, sizeof(dtd));
  ------------------
  |  |   44|  3.55k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  413|  3.55k|    }
  414|       |
  415|       |    /* Compute symbols and rankStart given rankVal:
  416|       |     *
  417|       |     * rankVal already contains the number of values of each weight.
  418|       |     *
  419|       |     * symbols contains the symbols ordered by weight. First are the rankVal[0]
  420|       |     * weight 0 symbols, followed by the rankVal[1] weight 1 symbols, and so on.
  421|       |     * symbols[0] is filled (but unused) to avoid a branch.
  422|       |     *
  423|       |     * rankStart contains the offset where each rank belongs in the DTable.
  424|       |     * rankStart[0] is not filled because there are no entries in the table for
  425|       |     * weight 0.
  426|       |     */
  427|      0|    {   int n;
  428|  3.55k|        U32 nextRankStart = 0;
  429|  3.55k|        int const unroll = 4;
  430|  3.55k|        int const nLimit = (int)nbSymbols - unroll + 1;
  431|  46.2k|        for (n=0; n<(int)tableLog+1; n++) {
  ------------------
  |  Branch (431:19): [True: 42.6k, False: 3.55k]
  ------------------
  432|  42.6k|            U32 const curr = nextRankStart;
  433|  42.6k|            nextRankStart += wksp->rankVal[n];
  434|  42.6k|            wksp->rankStart[n] = curr;
  435|  42.6k|        }
  436|   162k|        for (n=0; n < nLimit; n += unroll) {
  ------------------
  |  Branch (436:19): [True: 158k, False: 3.55k]
  ------------------
  437|   158k|            int u;
  438|   793k|            for (u=0; u < unroll; ++u) {
  ------------------
  |  Branch (438:23): [True: 634k, False: 158k]
  ------------------
  439|   634k|                size_t const w = wksp->huffWeight[n+u];
  440|   634k|                wksp->symbols[wksp->rankStart[w]++] = (BYTE)(n+u);
  441|   634k|            }
  442|   158k|        }
  443|  6.64k|        for (; n < (int)nbSymbols; ++n) {
  ------------------
  |  Branch (443:16): [True: 3.08k, False: 3.55k]
  ------------------
  444|  3.08k|            size_t const w = wksp->huffWeight[n];
  445|  3.08k|            wksp->symbols[wksp->rankStart[w]++] = (BYTE)n;
  446|  3.08k|        }
  447|  3.55k|    }
  448|       |
  449|       |    /* fill DTable
  450|       |     * We fill all entries of each weight in order.
  451|       |     * That way length is a constant for each iteration of the outer loop.
  452|       |     * We can switch based on the length to a different inner loop which is
  453|       |     * optimized for that particular case.
  454|       |     */
  455|  3.55k|    {   U32 w;
  456|  3.55k|        int symbol = wksp->rankVal[0];
  457|  3.55k|        int rankStart = 0;
  458|  42.6k|        for (w=1; w<tableLog+1; ++w) {
  ------------------
  |  Branch (458:19): [True: 39.0k, False: 3.55k]
  ------------------
  459|  39.0k|            int const symbolCount = wksp->rankVal[w];
  460|  39.0k|            int const length = (1 << w) >> 1;
  461|  39.0k|            int uStart = rankStart;
  462|  39.0k|            BYTE const nbBits = (BYTE)(tableLog + 1 - w);
  463|  39.0k|            int s;
  464|  39.0k|            int u;
  465|  39.0k|            switch (length) {
  466|  3.55k|            case 1:
  ------------------
  |  Branch (466:13): [True: 3.55k, False: 35.5k]
  ------------------
  467|  3.55k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (467:27): [True: 0, False: 3.55k]
  ------------------
  468|      0|                    HUF_DEltX1 D;
  469|      0|                    D.byte = wksp->symbols[symbol + s];
  470|      0|                    D.nbBits = nbBits;
  471|      0|                    dt[uStart] = D;
  472|      0|                    uStart += 1;
  473|      0|                }
  474|  3.55k|                break;
  475|  3.55k|            case 2:
  ------------------
  |  Branch (475:13): [True: 3.55k, False: 35.5k]
  ------------------
  476|  3.55k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (476:27): [True: 0, False: 3.55k]
  ------------------
  477|      0|                    HUF_DEltX1 D;
  478|      0|                    D.byte = wksp->symbols[symbol + s];
  479|      0|                    D.nbBits = nbBits;
  480|      0|                    dt[uStart+0] = D;
  481|      0|                    dt[uStart+1] = D;
  482|      0|                    uStart += 2;
  483|      0|                }
  484|  3.55k|                break;
  485|  3.55k|            case 4:
  ------------------
  |  Branch (485:13): [True: 3.55k, False: 35.5k]
  ------------------
  486|  3.64k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (486:27): [True: 88, False: 3.55k]
  ------------------
  487|     88|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  488|     88|                    MEM_write64(dt + uStart, D4);
  489|     88|                    uStart += 4;
  490|     88|                }
  491|  3.55k|                break;
  492|  3.55k|            case 8:
  ------------------
  |  Branch (492:13): [True: 3.55k, False: 35.5k]
  ------------------
  493|  3.64k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (493:27): [True: 88, False: 3.55k]
  ------------------
  494|     88|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  495|     88|                    MEM_write64(dt + uStart, D4);
  496|     88|                    MEM_write64(dt + uStart + 4, D4);
  497|     88|                    uStart += 8;
  498|     88|                }
  499|  3.55k|                break;
  500|  24.8k|            default:
  ------------------
  |  Branch (500:13): [True: 24.8k, False: 14.2k]
  ------------------
  501|  92.8k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (501:27): [True: 67.9k, False: 24.8k]
  ------------------
  502|  67.9k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  503|   522k|                    for (u=0; u < length; u += 16) {
  ------------------
  |  Branch (503:31): [True: 454k, False: 67.9k]
  ------------------
  504|   454k|                        MEM_write64(dt + uStart + u + 0, D4);
  505|   454k|                        MEM_write64(dt + uStart + u + 4, D4);
  506|   454k|                        MEM_write64(dt + uStart + u + 8, D4);
  507|   454k|                        MEM_write64(dt + uStart + u + 12, D4);
  508|   454k|                    }
  509|  67.9k|                    assert(u == length);
  ------------------
  |  |   70|  67.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  510|  67.9k|                    uStart += length;
  511|  67.9k|                }
  512|  24.8k|                break;
  513|  39.0k|            }
  514|  39.0k|            symbol += symbolCount;
  515|  39.0k|            rankStart += symbolCount * length;
  516|  39.0k|        }
  517|  3.55k|    }
  518|  3.55k|    return iSize;
  519|  3.55k|}
HUF_decompress1X1_DCtx_wksp:
 1895|  3.55k|{
 1896|  3.55k|    const BYTE* ip = (const BYTE*) cSrc;
 1897|       |
 1898|  3.55k|    size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1899|  3.55k|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   78|  3.55k|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1899:9): [True: 0, False: 3.55k]
  ------------------
 1900|  3.55k|    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 (1900:9): [True: 0, False: 3.55k]
  ------------------
 1901|  3.55k|    ip += hSize; cSrcSize -= hSize;
 1902|       |
 1903|  3.55k|    return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
 1904|  3.55k|}
HUF_decompress4X_hufOnly_wksp:
 1925|      1|{
 1926|       |    /* validation checks */
 1927|      1|    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 (1927:9): [True: 0, False: 1]
  ------------------
 1928|      1|    if (cSrcSize == 0) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1928:9): [True: 1, False: 0]
  ------------------
 1929|       |
 1930|      0|    {   U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize);
 1931|       |#if defined(HUF_FORCE_DECOMPRESS_X1)
 1932|       |        (void)algoNb;
 1933|       |        assert(algoNb == 0);
 1934|       |        return HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1935|       |#elif defined(HUF_FORCE_DECOMPRESS_X2)
 1936|       |        (void)algoNb;
 1937|       |        assert(algoNb == 1);
 1938|       |        return HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1939|       |#else
 1940|      0|        return algoNb ? HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags) :
  ------------------
  |  Branch (1940:16): [True: 0, False: 0]
  ------------------
 1941|      0|                        HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1942|      1|#endif
 1943|      1|    }
 1944|      1|}
huf_decompress.c:HUF_getDTableDesc:
  144|  7.10k|{
  145|  7.10k|    DTableDesc dtd;
  146|  7.10k|    ZSTD_memcpy(&dtd, table, sizeof(dtd));
  ------------------
  |  |   44|  7.10k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  147|  7.10k|    return dtd;
  148|  7.10k|}
huf_decompress.c:HUF_rescaleStats:
  353|  3.55k|{
  354|  3.55k|    if (tableLog > targetTableLog)
  ------------------
  |  Branch (354:9): [True: 0, False: 3.55k]
  ------------------
  355|      0|        return tableLog;
  356|  3.55k|    if (tableLog < targetTableLog) {
  ------------------
  |  Branch (356:9): [True: 3.55k, False: 0]
  ------------------
  357|  3.55k|        U32 const scale = targetTableLog - tableLog;
  358|  3.55k|        U32 s;
  359|       |        /* Increase the weight for all non-zero probability symbols by scale. */
  360|   641k|        for (s = 0; s < nbSymbols; ++s) {
  ------------------
  |  Branch (360:21): [True: 638k, False: 3.55k]
  ------------------
  361|   638k|            huffWeight[s] += (BYTE)((huffWeight[s] == 0) ? 0 : scale);
  ------------------
  |  Branch (361:37): [True: 569k, False: 68.1k]
  ------------------
  362|   638k|        }
  363|       |        /* Update rankVal to reflect the new weights.
  364|       |         * All weights except 0 get moved to weight + scale.
  365|       |         * Weights [1, scale] are empty.
  366|       |         */
  367|  22.6k|        for (s = targetTableLog; s > scale; --s) {
  ------------------
  |  Branch (367:34): [True: 19.0k, False: 3.55k]
  ------------------
  368|  19.0k|            rankVal[s] = rankVal[s - scale];
  369|  19.0k|        }
  370|  23.5k|        for (s = scale; s > 0; --s) {
  ------------------
  |  Branch (370:25): [True: 20.0k, False: 3.55k]
  ------------------
  371|  20.0k|            rankVal[s] = 0;
  372|  20.0k|        }
  373|  3.55k|    }
  374|  3.55k|    return targetTableLog;
  375|  3.55k|}
huf_decompress.c:HUF_DEltX1_set4:
  335|  68.1k|static U64 HUF_DEltX1_set4(BYTE symbol, BYTE nbBits) {
  336|  68.1k|    U64 D4;
  337|  68.1k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (337:9): [True: 68.1k, False: 0]
  ------------------
  338|  68.1k|        D4 = (U64)((symbol << 8) + nbBits);
  339|  68.1k|    } else {
  340|      0|        D4 = (U64)(symbol + (nbBits << 8));
  341|      0|    }
  342|  68.1k|    assert(D4 < (1U << 16));
  ------------------
  |  |   70|  68.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  343|  68.1k|    D4 *= 0x0001000100010001ULL;
  344|  68.1k|    return D4;
  345|  68.1k|}
huf_decompress.c:HUF_decompress1X1_usingDTable_internal:
  118|  3.55k|    {                                                                       \
  119|  3.55k|        if (flags & HUF_flags_bmi2) {                                       \
  ------------------
  |  Branch (119:13): [True: 3.55k, False: 0]
  ------------------
  120|  3.55k|            return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable);         \
  121|  3.55k|        }                                                                   \
  122|  3.55k|        return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable);          \
  123|  3.55k|    }
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_bmi2:
  112|  3.55k|    {                                                                       \
  113|  3.55k|        return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable);             \
  114|  3.55k|    }                                                                       \
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_body:
  579|  3.55k|{
  580|  3.55k|    BYTE* op = (BYTE*)dst;
  581|  3.55k|    BYTE* const oend = ZSTD_maybeNullPtrAdd(op, dstSize);
  582|  3.55k|    const void* dtPtr = DTable + 1;
  583|  3.55k|    const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr;
  584|  3.55k|    BIT_DStream_t bitD;
  585|  3.55k|    DTableDesc const dtd = HUF_getDTableDesc(DTable);
  586|  3.55k|    U32 const dtLog = dtd.tableLog;
  587|       |
  588|  3.55k|    CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) );
  ------------------
  |  |   63|  3.55k|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|  3.55k|    size_t const e = f;     \
  |  |  |  |   59|  3.55k|    do {                    \
  |  |  |  |   60|  3.55k|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 0, False: 3.55k]
  |  |  |  |  ------------------
  |  |  |  |   61|  3.55k|            return e;       \
  |  |  |  |   62|  3.55k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 3.55k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  589|       |
  590|  3.55k|    HUF_decodeStreamX1(op, &bitD, oend, dt, dtLog);
  591|       |
  592|  3.55k|    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 (592:9): [True: 0, False: 3.55k]
  ------------------
  593|       |
  594|  3.55k|    return dstSize;
  595|  3.55k|}
huf_decompress.c:HUF_decodeStreamX1:
  547|  3.55k|{
  548|  3.55k|    BYTE* const pStart = p;
  549|       |
  550|       |    /* up to 4 symbols at a time */
  551|  3.55k|    if ((pEnd - p) > 3) {
  ------------------
  |  Branch (551:9): [True: 3.55k, False: 0]
  ------------------
  552|  79.1k|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) {
  ------------------
  |  Branch (552:16): [True: 75.6k, False: 3.55k]
  ------------------
  553|  75.6k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  540|  75.6k|    do {                                            \
  |  |  541|  75.6k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 75.6k, False: 0]
  |  |  ------------------
  |  |  542|  75.6k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  75.6k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 75.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  75.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 75.6k]
  |  |  ------------------
  ------------------
  554|  75.6k|            HUF_DECODE_SYMBOLX1_1(p, bitDPtr);
  ------------------
  |  |  534|  75.6k|    do {                                            \
  |  |  535|  75.6k|        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 (535:13): [True: 75.6k, False: 0]
  |  |  |  Branch (535:29): [True: 0, Folded]
  |  |  ------------------
  |  |  536|  75.6k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  75.6k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 75.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  537|  75.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (537:14): [Folded, False: 75.6k]
  |  |  ------------------
  ------------------
  555|  75.6k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  540|  75.6k|    do {                                            \
  |  |  541|  75.6k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (541:13): [True: 75.6k, False: 0]
  |  |  ------------------
  |  |  542|  75.6k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  531|  75.6k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (531:71): [Folded, False: 75.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  543|  75.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (543:14): [Folded, False: 75.6k]
  |  |  ------------------
  ------------------
  556|  75.6k|            HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  531|  75.6k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 75.6k]
  |  |  ------------------
  ------------------
  557|  75.6k|        }
  558|  3.55k|    } else {
  559|      0|        BIT_reloadDStream(bitDPtr);
  560|      0|    }
  561|       |
  562|       |    /* [0-3] symbols remaining */
  563|  3.55k|    if (MEM_32bits())
  ------------------
  |  Branch (563:9): [True: 0, False: 3.55k]
  ------------------
  564|      0|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd))
  ------------------
  |  Branch (564:16): [True: 0, False: 0]
  ------------------
  565|      0|            HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  531|      0|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  566|       |
  567|       |    /* no more data to retrieve from bitstream, no need to reload */
  568|  61.3k|    while (p < pEnd)
  ------------------
  |  Branch (568:12): [True: 57.7k, False: 3.55k]
  ------------------
  569|  57.7k|        HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  531|  57.7k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (531:71): [Folded, False: 57.7k]
  |  |  ------------------
  ------------------
  570|       |
  571|  3.55k|    return (size_t)(pEnd-pStart);
  572|  3.55k|}
huf_decompress.c:HUF_decodeSymbolX1:
  523|   360k|{
  524|   360k|    size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
  525|   360k|    BYTE const c = dt[val].byte;
  526|   360k|    BIT_skipBits(Dstream, dt[val].nbBits);
  527|   360k|    return c;
  528|   360k|}

ZSTD_freeDDict:
  213|  5.08k|{
  214|  5.08k|    if (ddict==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (214:9): [True: 5.08k, False: 0]
  ------------------
  215|      0|    {   ZSTD_customMem const cMem = ddict->cMem;
  216|      0|        ZSTD_customFree(ddict->dictBuffer, cMem);
  217|      0|        ZSTD_customFree(ddict, cMem);
  218|      0|        return 0;
  219|  5.08k|    }
  220|  5.08k|}
ZSTD_sizeof_DDict:
  231|  1.03k|{
  232|  1.03k|    if (ddict==NULL) return 0;   /* support sizeof on NULL */
  ------------------
  |  Branch (232:9): [True: 1.03k, False: 0]
  ------------------
  233|      0|    return sizeof(*ddict) + (ddict->dictBuffer ? ddict->dictSize : 0) ;
  ------------------
  |  Branch (233:30): [True: 0, False: 0]
  ------------------
  234|  1.03k|}

ZSTD_sizeof_DCtx:
  222|  1.03k|{
  223|  1.03k|    if (dctx==NULL) return 0;   /* support sizeof NULL */
  ------------------
  |  Branch (223:9): [True: 0, False: 1.03k]
  ------------------
  224|  1.03k|    return sizeof(*dctx)
  225|  1.03k|           + ZSTD_sizeof_DDict(dctx->ddictLocal)
  226|  1.03k|           + dctx->inBuffSize + dctx->outBuffSize;
  227|  1.03k|}
ZSTD_createDCtx:
  311|     61|{
  312|     61|    DEBUGLOG(3, "ZSTD_createDCtx");
  ------------------
  |  |  104|     61|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 61]
  |  |  ------------------
  ------------------
  313|     61|    return ZSTD_createDCtx_internal(ZSTD_defaultCMem);
  314|     61|}
ZSTD_freeDCtx:
  325|     61|{
  326|     61|    if (dctx==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (326:9): [True: 0, False: 61]
  ------------------
  327|     61|    RETURN_ERROR_IF(dctx->staticSize, memory_allocation, "not compatible with static DCtx");
  ------------------
  |  |  114|     61|    do {                                                                       \
  |  |  115|     61|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 61]
  |  |  ------------------
  |  |  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|     61|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 61]
  |  |  ------------------
  ------------------
  328|     61|    {   ZSTD_customMem const cMem = dctx->customMem;
  329|     61|        ZSTD_clearDict(dctx);
  330|     61|        ZSTD_customFree(dctx->inBuff, cMem);
  331|     61|        dctx->inBuff = NULL;
  332|     61|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
  333|     61|        if (dctx->legacyContext)
  ------------------
  |  Branch (333:13): [True: 0, False: 61]
  ------------------
  334|      0|            ZSTD_freeLegacyStreamContext(dctx->legacyContext, dctx->previousLegacyVersion);
  335|     61|#endif
  336|     61|        if (dctx->ddictSet) {
  ------------------
  |  Branch (336:13): [True: 0, False: 61]
  ------------------
  337|      0|            ZSTD_freeDDictHashSet(dctx->ddictSet, cMem);
  338|       |            dctx->ddictSet = NULL;
  339|      0|        }
  340|     61|        ZSTD_customFree(dctx, cMem);
  341|     61|        return 0;
  342|     61|    }
  343|     61|}
ZSTD_getFrameHeader_advanced:
  448|  5.00k|{
  449|  5.00k|    const BYTE* ip = (const BYTE*)src;
  450|  5.00k|    size_t const minInputSize = ZSTD_startingInputLength(format);
  451|       |
  452|  5.00k|    DEBUGLOG(5, "ZSTD_getFrameHeader_advanced: minInputSize = %zu, srcSize = %zu", minInputSize, srcSize);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  453|       |
  454|  5.00k|    if (srcSize > 0) {
  ------------------
  |  Branch (454:9): [True: 5.00k, False: 0]
  ------------------
  455|       |        /* note : technically could be considered an assert(), since it's an invalid entry */
  456|  5.00k|        RETURN_ERROR_IF(src==NULL, GENERIC, "invalid parameter : src==NULL, but srcSize>0");
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  457|  5.00k|    }
  458|  5.00k|    if (srcSize < minInputSize) {
  ------------------
  |  Branch (458:9): [True: 0, False: 5.00k]
  ------------------
  459|      0|        if (srcSize > 0 && format != ZSTD_f_zstd1_magicless) {
  ------------------
  |  Branch (459:13): [True: 0, False: 0]
  |  Branch (459:28): [True: 0, False: 0]
  ------------------
  460|       |            /* when receiving less than @minInputSize bytes,
  461|       |             * control these bytes at least correspond to a supported magic number
  462|       |             * in order to error out early if they don't.
  463|       |            **/
  464|      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]
  |  |  ------------------
  ------------------
  465|      0|            unsigned char hbuf[4]; MEM_writeLE32(hbuf, ZSTD_MAGICNUMBER);
  ------------------
  |  |  142|      0|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  466|      0|            assert(src != NULL);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  467|      0|            ZSTD_memcpy(hbuf, src, toCopy);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  468|      0|            if ( MEM_readLE32(hbuf) != ZSTD_MAGICNUMBER ) {
  ------------------
  |  |  142|      0|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  |  Branch (468:18): [True: 0, False: 0]
  ------------------
  469|       |                /* not a zstd frame : let's check if it's a skippable frame */
  470|      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 */
  ------------------
  471|      0|                ZSTD_memcpy(hbuf, src, toCopy);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  472|      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 (472:21): [True: 0, False: 0]
  ------------------
  473|      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]
  |  |  ------------------
  ------------------
  474|      0|                                "first bytes don't correspond to any supported magic number");
  475|      0|        }   }   }
  476|      0|        return minInputSize;
  477|      0|    }
  478|       |
  479|  5.00k|    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.00k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  480|  5.00k|    if ( (format != ZSTD_f_zstd1_magicless)
  ------------------
  |  Branch (480:10): [True: 5.00k, False: 0]
  ------------------
  481|  5.00k|      && (MEM_readLE32(src) != ZSTD_MAGICNUMBER) ) {
  ------------------
  |  |  142|  5.00k|#define ZSTD_MAGICNUMBER            0xFD2FB528    /* valid since v0.8.0 */
  ------------------
  |  Branch (481:10): [True: 2, False: 5.00k]
  ------------------
  482|      2|        if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|      2|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                      if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|      2|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  |  Branch (482:13): [True: 0, False: 2]
  ------------------
  483|       |            /* skippable frame */
  484|      0|            if (srcSize < ZSTD_SKIPPABLEHEADERSIZE)
  ------------------
  |  | 1260|      0|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  |  Branch (484:17): [True: 0, False: 0]
  ------------------
  485|      0|                return ZSTD_SKIPPABLEHEADERSIZE; /* magic number + frame length */
  ------------------
  |  | 1260|      0|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  486|      0|            ZSTD_memset(zfhPtr, 0, sizeof(*zfhPtr));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  487|      0|            zfhPtr->frameType = ZSTD_skippableFrame;
  488|      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 */
  ------------------
  489|      0|            zfhPtr->headerSize = ZSTD_SKIPPABLEHEADERSIZE;
  ------------------
  |  | 1260|      0|#define ZSTD_SKIPPABLEHEADERSIZE    8
  ------------------
  490|      0|            zfhPtr->frameContentSize = MEM_readLE32((const char *)src + ZSTD_FRAMEIDSIZE);
  ------------------
  |  |   82|      0|#define ZSTD_FRAMEIDSIZE 4   /* magic number size */
  ------------------
  491|      0|            return 0;
  492|      0|        }
  493|      2|        RETURN_ERROR(prefix_unknown, "");
  ------------------
  |  |  131|      2|    do {                                                                     \
  |  |  132|      2|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      2|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      2|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      2|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      2|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  494|      2|    }
  495|       |
  496|       |    /* ensure there is enough `srcSize` to fully read/decode frame header */
  497|  5.00k|    {   size_t const fhsize = ZSTD_frameHeaderSize_internal(src, srcSize, format);
  498|  5.00k|        if (srcSize < fhsize) return fhsize;
  ------------------
  |  Branch (498:13): [True: 0, False: 5.00k]
  ------------------
  499|  5.00k|        zfhPtr->headerSize = (U32)fhsize;
  500|  5.00k|    }
  501|       |
  502|      0|    {   BYTE const fhdByte = ip[minInputSize-1];
  503|  5.00k|        size_t pos = minInputSize;
  504|  5.00k|        U32 const dictIDSizeCode = fhdByte&3;
  505|  5.00k|        U32 const checksumFlag = (fhdByte>>2)&1;
  506|  5.00k|        U32 const singleSegment = (fhdByte>>5)&1;
  507|  5.00k|        U32 const fcsID = fhdByte>>6;
  508|  5.00k|        U64 windowSize = 0;
  509|  5.00k|        U32 dictID = 0;
  510|  5.00k|        U64 frameContentSize = ZSTD_CONTENTSIZE_UNKNOWN;
  ------------------
  |  |  203|  5.00k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  511|  5.00k|        RETURN_ERROR_IF((fhdByte & 0x08) != 0, frameParameter_unsupported,
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  512|  5.00k|                        "reserved bits, must be zero");
  513|       |
  514|  5.00k|        if (!singleSegment) {
  ------------------
  |  Branch (514:13): [True: 3, False: 4.99k]
  ------------------
  515|      3|            BYTE const wlByte = ip[pos++];
  516|      3|            U32 const windowLog = (wlByte >> 3) + ZSTD_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  |   78|      3|#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
  517|      3|            RETURN_ERROR_IF(windowLog > ZSTD_WINDOWLOG_MAX, frameParameter_windowTooLarge, "");
  ------------------
  |  |  114|      3|    do {                                                                       \
  |  |  115|      9|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [Folded, False: 3]
  |  |  |  Branch (115:13): [True: 0, False: 3]
  |  |  ------------------
  |  |  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|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3]
  |  |  ------------------
  ------------------
  518|      3|            windowSize = (1ULL << windowLog);
  519|      3|            windowSize += (windowSize >> 3) * (wlByte&7);
  520|      3|        }
  521|  5.00k|        switch(dictIDSizeCode)
  522|  5.00k|        {
  523|      0|            default:
  ------------------
  |  Branch (523:13): [True: 0, False: 5.00k]
  ------------------
  524|      0|                assert(0);  /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  525|      0|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  526|  4.99k|            case 0 : break;
  ------------------
  |  Branch (526:13): [True: 4.99k, False: 4]
  ------------------
  527|      4|            case 1 : dictID = ip[pos]; pos++; break;
  ------------------
  |  Branch (527:13): [True: 4, False: 4.99k]
  ------------------
  528|      0|            case 2 : dictID = MEM_readLE16(ip+pos); pos+=2; break;
  ------------------
  |  Branch (528:13): [True: 0, False: 5.00k]
  ------------------
  529|      0|            case 3 : dictID = MEM_readLE32(ip+pos); pos+=4; break;
  ------------------
  |  Branch (529:13): [True: 0, False: 5.00k]
  ------------------
  530|  5.00k|        }
  531|  5.00k|        switch(fcsID)
  532|  5.00k|        {
  533|      0|            default:
  ------------------
  |  Branch (533:13): [True: 0, False: 5.00k]
  ------------------
  534|      0|                assert(0);  /* impossible */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  535|      0|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  536|  4.99k|            case 0 : if (singleSegment) frameContentSize = ip[pos]; break;
  ------------------
  |  Branch (536:13): [True: 4.99k, False: 3]
  |  Branch (536:26): [True: 4.99k, False: 2]
  ------------------
  537|      1|            case 1 : frameContentSize = MEM_readLE16(ip+pos)+256; break;
  ------------------
  |  Branch (537:13): [True: 1, False: 4.99k]
  ------------------
  538|      1|            case 2 : frameContentSize = MEM_readLE32(ip+pos); break;
  ------------------
  |  Branch (538:13): [True: 1, False: 4.99k]
  ------------------
  539|      1|            case 3 : frameContentSize = MEM_readLE64(ip+pos); break;
  ------------------
  |  Branch (539:13): [True: 1, False: 4.99k]
  ------------------
  540|  5.00k|        }
  541|  5.00k|        if (singleSegment) windowSize = frameContentSize;
  ------------------
  |  Branch (541:13): [True: 4.99k, False: 3]
  ------------------
  542|       |
  543|  5.00k|        zfhPtr->frameType = ZSTD_frame;
  544|  5.00k|        zfhPtr->frameContentSize = frameContentSize;
  545|  5.00k|        zfhPtr->windowSize = windowSize;
  546|  5.00k|        zfhPtr->blockSizeMax = (unsigned) MIN(windowSize, ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   54|  5.00k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 4.99k, False: 3]
  |  |  ------------------
  ------------------
  547|  5.00k|        zfhPtr->dictID = dictID;
  548|  5.00k|        zfhPtr->checksumFlag = checksumFlag;
  549|  5.00k|    }
  550|      0|    return 0;
  551|  5.00k|}
ZSTD_getFrameContentSize:
  570|      9|{
  571|      9|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
  572|      9|    if (ZSTD_isLegacy(src, srcSize)) {
  ------------------
  |  Branch (572:9): [True: 9, False: 0]
  ------------------
  573|      9|        unsigned long long const ret = ZSTD_getDecompressedSize_legacy(src, srcSize);
  574|      9|        return ret == 0 ? ZSTD_CONTENTSIZE_UNKNOWN : ret;
  ------------------
  |  |  203|      3|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (574:16): [True: 3, False: 6]
  ------------------
  575|      9|    }
  576|      0|#endif
  577|      0|    {   ZSTD_FrameHeader zfh;
  578|      0|        if (ZSTD_getFrameHeader(&zfh, src, srcSize) != 0)
  ------------------
  |  Branch (578:13): [True: 0, False: 0]
  ------------------
  579|      0|            return ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  |  204|      0|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
  580|      0|        if (zfh.frameType == ZSTD_skippableFrame) {
  ------------------
  |  Branch (580:13): [True: 0, False: 0]
  ------------------
  581|      0|            return 0;
  582|      0|        } else {
  583|      0|            return zfh.frameContentSize;
  584|      0|    }   }
  585|      0|}
ZSTD_decompressDCtx:
 1198|  5.02k|{
 1199|  5.02k|    return ZSTD_decompress_usingDDict(dctx, dst, dstCapacity, src, srcSize, ZSTD_getDDict(dctx));
 1200|  5.02k|}
ZSTD_decompressBegin:
 1561|  5.00k|{
 1562|  5.00k|    assert(dctx != NULL);
  ------------------
  |  |   70|  5.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1563|  5.00k|#if ZSTD_TRACE
 1564|  5.00k|    dctx->traceCtx = (ZSTD_trace_decompress_begin != NULL) ? ZSTD_trace_decompress_begin(dctx) : 0;
  ------------------
  |  Branch (1564:22): [True: 0, False: 5.00k]
  ------------------
 1565|  5.00k|#endif
 1566|  5.00k|    dctx->expected = ZSTD_startingInputLength(dctx->format);  /* dctx->format must be properly set */
 1567|  5.00k|    dctx->stage = ZSTDds_getFrameHeaderSize;
 1568|  5.00k|    dctx->processedCSize = 0;
 1569|  5.00k|    dctx->decodedSize = 0;
 1570|  5.00k|    dctx->previousDstEnd = NULL;
 1571|  5.00k|    dctx->prefixStart = NULL;
 1572|  5.00k|    dctx->virtualStart = NULL;
 1573|  5.00k|    dctx->dictEnd = NULL;
 1574|  5.00k|    dctx->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);  /* cover both little and big endian */
  ------------------
  |  |   78|  5.00k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 1575|  5.00k|    dctx->litEntropy = dctx->fseEntropy = 0;
 1576|  5.00k|    dctx->dictID = 0;
 1577|  5.00k|    dctx->bType = bt_reserved;
 1578|  5.00k|    dctx->isFrameDecompression = 1;
 1579|  5.00k|    ZSTD_STATIC_ASSERT(sizeof(dctx->entropy.rep) == sizeof(repStartValue));
  ------------------
  |  |   43|  5.00k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  5.00k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1580|  5.00k|    ZSTD_memcpy(dctx->entropy.rep, repStartValue, sizeof(repStartValue));  /* initial repcodes */
  ------------------
  |  |   44|  5.00k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1581|  5.00k|    dctx->LLTptr = dctx->entropy.LLTable;
 1582|  5.00k|    dctx->MLTptr = dctx->entropy.MLTable;
 1583|  5.00k|    dctx->OFTptr = dctx->entropy.OFTable;
 1584|  5.00k|    dctx->HUFptr = dctx->entropy.hufTable;
 1585|  5.00k|    return 0;
 1586|  5.00k|}
ZSTD_decompressBegin_usingDict:
 1589|  5.00k|{
 1590|  5.00k|    FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) , "");
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 1591|  5.00k|    if (dict && dictSize)
  ------------------
  |  Branch (1591:9): [True: 0, False: 5.00k]
  |  Branch (1591:17): [True: 0, False: 0]
  ------------------
 1592|      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]
  |  |  ------------------
  ------------------
 1593|  5.00k|            ZSTD_isError(ZSTD_decompress_insertDictionary(dctx, dict, dictSize)),
 1594|  5.00k|            dictionary_corrupted, "");
 1595|  5.00k|    return 0;
 1596|  5.00k|}
ZSTD_decompress_usingDDict:
 1660|  5.02k|{
 1661|       |    /* pass content and size in case legacy frames are encountered */
 1662|  5.02k|    return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize,
 1663|       |                                     NULL, 0,
 1664|  5.02k|                                     ddict);
 1665|  5.02k|}
zstd_decompress.c:ZSTD_initDCtx_internal:
  253|     61|{
  254|     61|    dctx->staticSize  = 0;
  255|     61|    dctx->ddict       = NULL;
  256|     61|    dctx->ddictLocal  = NULL;
  257|     61|    dctx->dictEnd     = NULL;
  258|     61|    dctx->ddictIsCold = 0;
  259|     61|    dctx->dictUses = ZSTD_dont_use;
  260|     61|    dctx->inBuff      = NULL;
  261|     61|    dctx->inBuffSize  = 0;
  262|     61|    dctx->outBuffSize = 0;
  263|     61|    dctx->streamStage = zdss_init;
  264|     61|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
  265|     61|    dctx->legacyContext = NULL;
  266|     61|    dctx->previousLegacyVersion = 0;
  267|     61|#endif
  268|     61|    dctx->noForwardProgress = 0;
  269|     61|    dctx->oversizedDuration = 0;
  270|     61|    dctx->isFrameDecompression = 1;
  271|     61|#if DYNAMIC_BMI2
  272|     61|    dctx->bmi2 = ZSTD_cpuSupportsBmi2();
  273|     61|#endif
  274|     61|    dctx->ddictSet = NULL;
  275|     61|    ZSTD_DCtx_resetParameters(dctx);
  276|     61|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  277|       |    dctx->dictContentEndForFuzzing = NULL;
  278|     61|#endif
  279|     61|}
zstd_decompress.c:ZSTD_createDCtx_internal:
  294|     61|static ZSTD_DCtx* ZSTD_createDCtx_internal(ZSTD_customMem customMem) {
  295|     61|    if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL;
  ------------------
  |  Branch (295:9): [True: 0, False: 61]
  ------------------
  296|       |
  297|     61|    {   ZSTD_DCtx* const dctx = (ZSTD_DCtx*)ZSTD_customMalloc(sizeof(*dctx), customMem);
  298|     61|        if (!dctx) return NULL;
  ------------------
  |  Branch (298:13): [True: 0, False: 61]
  ------------------
  299|     61|        dctx->customMem = customMem;
  300|     61|        ZSTD_initDCtx_internal(dctx);
  301|     61|        return dctx;
  302|     61|    }
  303|     61|}
zstd_decompress.c:ZSTD_clearDict:
  317|  5.08k|{
  318|  5.08k|    ZSTD_freeDDict(dctx->ddictLocal);
  319|  5.08k|    dctx->ddictLocal = NULL;
  320|       |    dctx->ddict = NULL;
  321|  5.08k|    dctx->dictUses = ZSTD_dont_use;
  322|  5.08k|}
zstd_decompress.c:ZSTD_frameHeaderSize_internal:
  417|  10.0k|{
  418|  10.0k|    size_t const minInputSize = ZSTD_startingInputLength(format);
  419|  10.0k|    RETURN_ERROR_IF(srcSize < minInputSize, srcSize_wrong, "");
  ------------------
  |  |  114|  10.0k|    do {                                                                       \
  |  |  115|  10.0k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 10.0k]
  |  |  ------------------
  |  |  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.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 10.0k]
  |  |  ------------------
  ------------------
  420|       |
  421|  10.0k|    {   BYTE const fhd = ((const BYTE*)src)[minInputSize-1];
  422|  10.0k|        U32 const dictID= fhd & 3;
  423|  10.0k|        U32 const singleSegment = (fhd >> 5) & 1;
  424|  10.0k|        U32 const fcsId = fhd >> 6;
  425|  10.0k|        return minInputSize + !singleSegment
  426|  10.0k|             + ZSTD_did_fieldSize[dictID] + ZSTD_fcs_fieldSize[fcsId]
  427|  10.0k|             + (singleSegment && !fcsId);
  ------------------
  |  Branch (427:17): [True: 9.99k, False: 8]
  |  Branch (427:34): [True: 9.99k, False: 4]
  ------------------
  428|  10.0k|    }
  429|  10.0k|}
zstd_decompress.c:ZSTD_startingInputLength:
  233|  30.0k|{
  234|  30.0k|    size_t const startingInputLength = ZSTD_FRAMEHEADERSIZE_PREFIX(format);
  ------------------
  |  | 1257|  30.0k|#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1)   /* minimum input size required to query frame header size */
  |  |  ------------------
  |  |  |  Branch (1257:46): [True: 30.0k, False: 0]
  |  |  ------------------
  ------------------
  235|       |    /* only supports formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless */
  236|  30.0k|    assert( (format == ZSTD_f_zstd1) || (format == ZSTD_f_zstd1_magicless) );
  ------------------
  |  |   70|  30.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  237|  30.0k|    return startingInputLength;
  238|  30.0k|}
zstd_decompress.c:ZSTD_decompressMultiFrame:
 1075|  5.02k|{
 1076|  5.02k|    void* const dststart = dst;
 1077|  5.02k|    int moreThan1Frame = 0;
 1078|       |
 1079|  5.02k|    DEBUGLOG(5, "ZSTD_decompressMultiFrame");
  ------------------
  |  |  104|  5.02k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.02k]
  |  |  ------------------
  ------------------
 1080|  5.02k|    assert(dict==NULL || ddict==NULL);  /* either dict or ddict set, not both */
  ------------------
  |  |   70|  5.02k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1081|       |
 1082|  5.02k|    if (ddict) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 5.02k]
  ------------------
 1083|      0|        dict = ZSTD_DDict_dictContent(ddict);
 1084|      0|        dictSize = ZSTD_DDict_dictSize(ddict);
 1085|      0|    }
 1086|       |
 1087|  10.0k|    while (srcSize >= ZSTD_startingInputLength(dctx->format)) {
  ------------------
  |  Branch (1087:12): [True: 5.02k, False: 4.99k]
  ------------------
 1088|       |
 1089|  5.02k|#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1)
 1090|  5.02k|        if (dctx->format == ZSTD_f_zstd1 && ZSTD_isLegacy(src, srcSize)) {
  ------------------
  |  Branch (1090:13): [True: 5.02k, False: 0]
  |  Branch (1090:45): [True: 25, False: 5.00k]
  ------------------
 1091|     25|            size_t decodedSize;
 1092|     25|            size_t const frameSize = ZSTD_findFrameCompressedSizeLegacy(src, srcSize);
 1093|     25|            if (ZSTD_isError(frameSize)) return frameSize;
  ------------------
  |  |   44|     25|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1093:17): [True: 4, False: 21]
  ------------------
 1094|     21|            RETURN_ERROR_IF(dctx->staticSize, memory_allocation,
  ------------------
  |  |  114|     21|    do {                                                                       \
  |  |  115|     21|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 21]
  |  |  ------------------
  |  |  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|     21|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 21]
  |  |  ------------------
  ------------------
 1095|     21|                "legacy support is not compatible with static dctx");
 1096|       |
 1097|     21|            decodedSize = ZSTD_decompressLegacy(dst, dstCapacity, src, frameSize, dict, dictSize);
 1098|     21|            if (ZSTD_isError(decodedSize)) return decodedSize;
  ------------------
  |  |   44|     21|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1098:17): [True: 12, False: 9]
  ------------------
 1099|       |
 1100|      9|            {
 1101|      9|                unsigned long long const expectedSize = ZSTD_getFrameContentSize(src, srcSize);
 1102|      9|                RETURN_ERROR_IF(expectedSize == ZSTD_CONTENTSIZE_ERROR, corruption_detected, "Corrupted frame header!");
  ------------------
  |  |  114|      9|    do {                                                                       \
  |  |  115|      9|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 9]
  |  |  ------------------
  |  |  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|      9|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 9]
  |  |  ------------------
  ------------------
 1103|      9|                if (expectedSize != ZSTD_CONTENTSIZE_UNKNOWN) {
  ------------------
  |  |  203|      9|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1103:21): [True: 6, False: 3]
  ------------------
 1104|      6|                    RETURN_ERROR_IF(expectedSize != decodedSize, corruption_detected,
  ------------------
  |  |  114|      6|    do {                                                                       \
  |  |  115|      6|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 6, False: 0]
  |  |  ------------------
  |  |  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|      6|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1105|      6|                        "Frame header size does not match decoded size!");
 1106|      6|                }
 1107|      9|            }
 1108|       |
 1109|      3|            assert(decodedSize <= dstCapacity);
  ------------------
  |  |   70|      3|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1110|      3|            dst = (BYTE*)dst + decodedSize;
 1111|      3|            dstCapacity -= decodedSize;
 1112|       |
 1113|      3|            src = (const BYTE*)src + frameSize;
 1114|      3|            srcSize -= frameSize;
 1115|       |
 1116|      3|            continue;
 1117|      9|        }
 1118|  5.00k|#endif
 1119|       |
 1120|  5.00k|        if (dctx->format == ZSTD_f_zstd1 && srcSize >= 4) {
  ------------------
  |  Branch (1120:13): [True: 5.00k, False: 0]
  |  Branch (1120:45): [True: 5.00k, False: 0]
  ------------------
 1121|  5.00k|            U32 const magicNumber = MEM_readLE32(src);
 1122|  5.00k|            DEBUGLOG(5, "reading magic number %08X", (unsigned)magicNumber);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 1123|  5.00k|            if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  145|  5.00k|#define ZSTD_MAGIC_SKIPPABLE_MASK   0xFFFFFFF0
  ------------------
                          if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |  144|  5.00k|#define ZSTD_MAGIC_SKIPPABLE_START  0x184D2A50    /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */
  ------------------
  |  Branch (1123:17): [True: 0, False: 5.00k]
  ------------------
 1124|       |                /* skippable frame detected : skip it */
 1125|      0|                size_t const skippableSize = readSkippableFrameSize(src, srcSize);
 1126|      0|                FORWARD_IF_ERROR(skippableSize, "invalid skippable frame");
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 1127|      0|                assert(skippableSize <= srcSize);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1128|       |
 1129|      0|                src = (const BYTE *)src + skippableSize;
 1130|      0|                srcSize -= skippableSize;
 1131|      0|                continue; /* check next frame */
 1132|      0|        }   }
 1133|       |
 1134|  5.00k|        if (ddict) {
  ------------------
  |  Branch (1134:13): [True: 0, False: 5.00k]
  ------------------
 1135|       |            /* we were called from ZSTD_decompress_usingDDict */
 1136|      0|            FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDDict(dctx, ddict), "");
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 1137|  5.00k|        } else {
 1138|       |            /* this will initialize correctly with no dict if dict == NULL, so
 1139|       |             * use this in all cases but ddict */
 1140|  5.00k|            FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDict(dctx, dict, dictSize), "");
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 1141|  5.00k|        }
 1142|  5.00k|        ZSTD_checkContinuity(dctx, dst, dstCapacity);
 1143|       |
 1144|  5.00k|        {   const size_t res = ZSTD_decompressFrame(dctx, dst, dstCapacity,
 1145|  5.00k|                                                    &src, &srcSize);
 1146|  5.00k|            RETURN_ERROR_IF(
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  10.0k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 5.00k]
  |  |  |  Branch (115:13): [True: 0, False: 2]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
 1147|  5.00k|                (ZSTD_getErrorCode(res) == ZSTD_error_prefix_unknown)
 1148|  5.00k|             && (moreThan1Frame==1),
 1149|  5.00k|                srcSize_wrong,
 1150|  5.00k|                "At least one frame successfully completed, "
 1151|  5.00k|                "but following bytes are garbage: "
 1152|  5.00k|                "it's more likely to be a srcSize error, "
 1153|  5.00k|                "specifying more input bytes than size of frame(s). "
 1154|  5.00k|                "Note: one could be unlucky, it might be a corruption error instead, "
 1155|  5.00k|                "happening right at the place where we expect zstd magic bytes. "
 1156|  5.00k|                "But this is _much_ less likely than a srcSize field error.");
 1157|  5.00k|            if (ZSTD_isError(res)) return res;
  ------------------
  |  |   44|  5.00k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1157:17): [True: 10, False: 4.99k]
  ------------------
 1158|  4.99k|            assert(res <= dstCapacity);
  ------------------
  |  |   70|  4.99k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1159|  4.99k|            if (res != 0)
  ------------------
  |  Branch (1159:17): [True: 4.99k, False: 0]
  ------------------
 1160|  4.99k|                dst = (BYTE*)dst + res;
 1161|  4.99k|            dstCapacity -= res;
 1162|  4.99k|        }
 1163|      0|        moreThan1Frame = 1;
 1164|  4.99k|    }  /* while (srcSize >= ZSTD_frameHeaderSize_prefix) */
 1165|       |
 1166|  4.99k|    RETURN_ERROR_IF(srcSize, srcSize_wrong, "input not entirely consumed");
  ------------------
  |  |  114|  4.99k|    do {                                                                       \
  |  |  115|  4.99k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.99k]
  |  |  ------------------
  |  |  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.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1167|       |
 1168|  4.99k|    return (size_t)((BYTE*)dst - (BYTE*)dststart);
 1169|  4.99k|}
zstd_decompress.c:ZSTD_decompressFrame:
  956|  5.00k|{
  957|  5.00k|    const BYTE* const istart = (const BYTE*)(*srcPtr);
  958|  5.00k|    const BYTE* ip = istart;
  959|  5.00k|    BYTE* const ostart = (BYTE*)dst;
  960|  5.00k|    BYTE* const oend = dstCapacity != 0 ? ostart + dstCapacity : ostart;
  ------------------
  |  Branch (960:24): [True: 5.00k, False: 0]
  ------------------
  961|  5.00k|    BYTE* op = ostart;
  962|  5.00k|    size_t remainingSrcSize = *srcSizePtr;
  963|       |
  964|  5.00k|    DEBUGLOG(4, "ZSTD_decompressFrame (srcSize:%i)", (int)*srcSizePtr);
  ------------------
  |  |  104|  5.00k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  965|       |
  966|       |    /* check */
  967|  5.00k|    RETURN_ERROR_IF(
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  15.0k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 5.00k, False: 0]
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  968|  5.00k|        remainingSrcSize < ZSTD_FRAMEHEADERSIZE_MIN(dctx->format)+ZSTD_blockHeaderSize,
  969|  5.00k|        srcSize_wrong, "");
  970|       |
  971|       |    /* Frame Header */
  972|  5.00k|    {   size_t const frameHeaderSize = ZSTD_frameHeaderSize_internal(
  973|  5.00k|                ip, ZSTD_FRAMEHEADERSIZE_PREFIX(dctx->format), dctx->format);
  ------------------
  |  | 1257|  5.00k|#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1)   /* minimum input size required to query frame header size */
  |  |  ------------------
  |  |  |  Branch (1257:46): [True: 5.00k, False: 0]
  |  |  ------------------
  ------------------
  974|  5.00k|        if (ZSTD_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  |   44|  5.00k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (974:13): [True: 0, False: 5.00k]
  ------------------
  975|  5.00k|        RETURN_ERROR_IF(remainingSrcSize < frameHeaderSize+ZSTD_blockHeaderSize,
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  976|  5.00k|                        srcSize_wrong, "");
  977|  5.00k|        FORWARD_IF_ERROR( ZSTD_decodeFrameHeader(dctx, ip, frameHeaderSize) , "");
  ------------------
  |  |  146|  5.00k|    do {                                                                           \
  |  |  147|  5.00k|        size_t const err_code = (err);                                             \
  |  |  148|  5.00k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 2, False: 5.00k]
  |  |  ------------------
  |  |  149|      2|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      2|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      2|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      2|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      2|            return err_code;                                                       \
  |  |  155|      2|        }                                                                          \
  |  |  156|  5.00k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  978|  5.00k|        ip += frameHeaderSize; remainingSrcSize -= frameHeaderSize;
  979|  5.00k|    }
  980|       |
  981|       |    /* Shrink the blockSizeMax if enabled */
  982|  5.00k|    if (dctx->maxBlockSizeParam != 0)
  ------------------
  |  Branch (982:9): [True: 0, False: 5.00k]
  ------------------
  983|      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]
  |  |  ------------------
  ------------------
  984|       |
  985|       |    /* Loop on each block */
  986|  5.00k|    while (1) {
  ------------------
  |  Branch (986:12): [True: 5.00k, Folded]
  ------------------
  987|  5.00k|        BYTE* oBlockEnd = oend;
  988|  5.00k|        size_t decodedSize;
  989|  5.00k|        blockProperties_t blockProperties;
  990|  5.00k|        size_t const cBlockSize = ZSTD_getcBlockSize(ip, remainingSrcSize, &blockProperties);
  991|  5.00k|        if (ZSTD_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  |   44|  5.00k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (991:13): [True: 1, False: 5.00k]
  ------------------
  992|       |
  993|  5.00k|        ip += ZSTD_blockHeaderSize;
  994|  5.00k|        remainingSrcSize -= ZSTD_blockHeaderSize;
  995|  5.00k|        RETURN_ERROR_IF(cBlockSize > remainingSrcSize, srcSize_wrong, "");
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 4.99k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
  996|       |
  997|  4.99k|        if (ip >= op && ip < oBlockEnd) {
  ------------------
  |  Branch (997:13): [True: 4.94k, False: 57]
  |  Branch (997:25): [True: 0, False: 4.94k]
  ------------------
  998|       |            /* We are decompressing in-place. Limit the output pointer so that we
  999|       |             * don't overwrite the block that we are currently reading. This will
 1000|       |             * fail decompression if the input & output pointers aren't spaced
 1001|       |             * far enough apart.
 1002|       |             *
 1003|       |             * This is important to set, even when the pointers are far enough
 1004|       |             * apart, because ZSTD_decompressBlock_internal() can decide to store
 1005|       |             * literals in the output buffer, after the block it is decompressing.
 1006|       |             * Since we don't want anything to overwrite our input, we have to tell
 1007|       |             * ZSTD_decompressBlock_internal to never write past ip.
 1008|       |             *
 1009|       |             * See ZSTD_allocateLiteralsBuffer() for reference.
 1010|       |             */
 1011|      0|            oBlockEnd = op + (ip - op);
 1012|      0|        }
 1013|       |
 1014|  4.99k|        switch(blockProperties.blockType)
 1015|  4.99k|        {
 1016|  4.99k|        case bt_compressed:
  ------------------
  |  Branch (1016:9): [True: 4.99k, False: 4]
  ------------------
 1017|  4.99k|            assert(dctx->isFrameDecompression == 1);
  ------------------
  |  |   70|  4.99k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1018|  4.99k|            decodedSize = ZSTD_decompressBlock_internal(dctx, op, (size_t)(oBlockEnd-op), ip, cBlockSize, not_streaming);
 1019|  4.99k|            break;
 1020|      0|        case bt_raw :
  ------------------
  |  Branch (1020:9): [True: 0, False: 4.99k]
  ------------------
 1021|       |            /* Use oend instead of oBlockEnd because this function is safe to overlap. It uses memmove. */
 1022|      0|            decodedSize = ZSTD_copyRawBlock(op, (size_t)(oend-op), ip, cBlockSize);
 1023|      0|            break;
 1024|      4|        case bt_rle :
  ------------------
  |  Branch (1024:9): [True: 4, False: 4.99k]
  ------------------
 1025|      4|            decodedSize = ZSTD_setRleBlock(op, (size_t)(oBlockEnd-op), *ip, blockProperties.origSize);
 1026|      4|            break;
 1027|      0|        case bt_reserved :
  ------------------
  |  Branch (1027:9): [True: 0, False: 4.99k]
  ------------------
 1028|      0|        default:
  ------------------
  |  Branch (1028:9): [True: 0, False: 4.99k]
  ------------------
 1029|      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]
  |  |  ------------------
  ------------------
 1030|  4.99k|        }
 1031|  4.99k|        FORWARD_IF_ERROR(decodedSize, "Block decompression failure");
  ------------------
  |  |  146|  4.99k|    do {                                                                           \
  |  |  147|  4.99k|        size_t const err_code = (err);                                             \
  |  |  148|  4.99k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 3, False: 4.99k]
  |  |  ------------------
  |  |  149|      3|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|      3|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|      3|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|      3|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|      3|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|      3|            return err_code;                                                       \
  |  |  155|      3|        }                                                                          \
  |  |  156|  4.99k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1032|  4.99k|        DEBUGLOG(5, "Decompressed block of dSize = %u", (unsigned)decodedSize);
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1033|  4.99k|        if (dctx->validateChecksum) {
  ------------------
  |  Branch (1033:13): [True: 2, False: 4.99k]
  ------------------
 1034|      2|            XXH64_update(&dctx->xxhState, op, decodedSize);
  ------------------
  |  |  460|      2|#  define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update)
  |  |  ------------------
  |  |  |  |  443|      2|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|      2|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1035|      2|        }
 1036|  4.99k|        if (decodedSize) /* support dst = NULL,0 */ {
  ------------------
  |  Branch (1036:13): [True: 4.99k, False: 0]
  ------------------
 1037|  4.99k|            op += decodedSize;
 1038|  4.99k|        }
 1039|  4.99k|        assert(ip != NULL);
  ------------------
  |  |   70|  4.99k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1040|  4.99k|        ip += cBlockSize;
 1041|  4.99k|        remainingSrcSize -= cBlockSize;
 1042|  4.99k|        if (blockProperties.lastBlock) break;
  ------------------
  |  Branch (1042:13): [True: 4.99k, False: 1]
  ------------------
 1043|  4.99k|    }
 1044|       |
 1045|  4.99k|    if (dctx->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN) {
  ------------------
  |  |  203|  4.99k|#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
  ------------------
  |  Branch (1045:9): [True: 4.99k, False: 0]
  ------------------
 1046|  4.99k|        RETURN_ERROR_IF((U64)(op-ostart) != dctx->fParams.frameContentSize,
  ------------------
  |  |  114|  4.99k|    do {                                                                       \
  |  |  115|  4.99k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 4.99k]
  |  |  ------------------
  |  |  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.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1047|  4.99k|                        corruption_detected, "");
 1048|  4.99k|    }
 1049|  4.99k|    if (dctx->fParams.checksumFlag) { /* Frame content checksum verification */
  ------------------
  |  Branch (1049:9): [True: 0, False: 4.99k]
  ------------------
 1050|      0|        RETURN_ERROR_IF(remainingSrcSize<4, checksum_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]
  |  |  ------------------
  ------------------
 1051|      0|        if (!dctx->forceIgnoreChecksum) {
  ------------------
  |  Branch (1051:13): [True: 0, False: 0]
  ------------------
 1052|      0|            U32 const checkCalc = (U32)XXH64_digest(&dctx->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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1053|      0|            U32 checkRead;
 1054|      0|            checkRead = MEM_readLE32(ip);
 1055|      0|            RETURN_ERROR_IF(checkRead != checkCalc, checksum_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]
  |  |  ------------------
  ------------------
 1056|      0|        }
 1057|      0|        ip += 4;
 1058|      0|        remainingSrcSize -= 4;
 1059|      0|    }
 1060|  4.99k|    ZSTD_DCtx_trace_end(dctx, (U64)(op-ostart), (U64)(ip-istart), /* streaming */ 0);
 1061|       |    /* Allow caller to get size read */
 1062|  4.99k|    DEBUGLOG(4, "ZSTD_decompressFrame: decompressed frame of size %i, consuming %i bytes of input", (int)(op-ostart), (int)(ip - (const BYTE*)*srcPtr));
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1063|  4.99k|    *srcPtr = ip;
 1064|  4.99k|    *srcSizePtr = remainingSrcSize;
 1065|  4.99k|    return (size_t)(op-ostart);
 1066|  4.99k|}
zstd_decompress.c:ZSTD_getDDict:
 1181|  5.02k|{
 1182|  5.02k|    switch (dctx->dictUses) {
 1183|      0|    default:
  ------------------
  |  Branch (1183:5): [True: 0, False: 5.02k]
  ------------------
 1184|      0|        assert(0 /* Impossible */);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1185|      0|        ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
 1186|  5.02k|    case ZSTD_dont_use:
  ------------------
  |  Branch (1186:5): [True: 5.02k, False: 0]
  ------------------
 1187|  5.02k|        ZSTD_clearDict(dctx);
 1188|  5.02k|        return NULL;
 1189|      0|    case ZSTD_use_indefinitely:
  ------------------
  |  Branch (1189:5): [True: 0, False: 5.02k]
  ------------------
 1190|      0|        return dctx->ddict;
 1191|      0|    case ZSTD_use_once:
  ------------------
  |  Branch (1191:5): [True: 0, False: 5.02k]
  ------------------
 1192|      0|        dctx->dictUses = ZSTD_dont_use;
 1193|      0|        return dctx->ddict;
 1194|  5.02k|    }
 1195|  5.02k|}
zstd_decompress.c:ZSTD_decodeFrameHeader:
  703|  5.00k|{
  704|  5.00k|    size_t const result = ZSTD_getFrameHeader_advanced(&(dctx->fParams), src, headerSize, dctx->format);
  705|  5.00k|    if (ZSTD_isError(result)) return result;    /* invalid header */
  ------------------
  |  |   44|  5.00k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (705:9): [True: 2, False: 5.00k]
  ------------------
  706|  5.00k|    RETURN_ERROR_IF(result>0, srcSize_wrong, "headerSize too small");
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
  707|       |
  708|       |    /* Reference DDict requested by frame if dctx references multiple ddicts */
  709|  5.00k|    if (dctx->refMultipleDDicts == ZSTD_rmd_refMultipleDDicts && dctx->ddictSet) {
  ------------------
  |  Branch (709:9): [True: 0, False: 5.00k]
  |  Branch (709:66): [True: 0, False: 0]
  ------------------
  710|      0|        ZSTD_DCtx_selectFrameDDict(dctx);
  711|      0|    }
  712|       |
  713|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  714|       |    /* Skip the dictID check in fuzzing mode, because it makes the search
  715|       |     * harder.
  716|       |     */
  717|       |    RETURN_ERROR_IF(dctx->fParams.dictID && (dctx->dictID != dctx->fParams.dictID),
  718|       |                    dictionary_wrong, "");
  719|       |#endif
  720|  5.00k|    dctx->validateChecksum = (dctx->fParams.checksumFlag && !dctx->forceIgnoreChecksum) ? 1 : 0;
  ------------------
  |  Branch (720:31): [True: 4, False: 4.99k]
  |  Branch (720:61): [True: 4, False: 0]
  ------------------
  721|  5.00k|    if (dctx->validateChecksum) XXH64_reset(&dctx->xxhState, 0);
  ------------------
  |  |  459|      4|#  define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
  |  |  ------------------
  |  |  |  |  443|      4|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|      4|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (721:9): [True: 4, False: 4.99k]
  ------------------
  722|  5.00k|    dctx->processedCSize += headerSize;
  723|  5.00k|    return 0;
  724|  5.00k|}
zstd_decompress.c:ZSTD_setRleBlock:
  912|      4|{
  913|      4|    RETURN_ERROR_IF(regenSize > dstCapacity, dstSize_tooSmall, "");
  ------------------
  |  |  114|      4|    do {                                                                       \
  |  |  115|      4|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4]
  |  |  ------------------
  |  |  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|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4]
  |  |  ------------------
  ------------------
  914|      4|    if (dst == NULL) {
  ------------------
  |  Branch (914:9): [True: 0, False: 4]
  ------------------
  915|      0|        if (regenSize == 0) return 0;
  ------------------
  |  Branch (915:13): [True: 0, False: 0]
  ------------------
  916|      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]
  |  |  ------------------
  ------------------
  917|      0|    }
  918|      4|    ZSTD_memset(dst, b, regenSize);
  ------------------
  |  |   46|      4|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  919|      4|    return regenSize;
  920|      4|}
zstd_decompress.c:ZSTD_DCtx_trace_end:
  923|  4.99k|{
  924|  4.99k|#if ZSTD_TRACE
  925|  4.99k|    if (dctx->traceCtx && ZSTD_trace_decompress_end != NULL) {
  ------------------
  |  Branch (925:9): [True: 0, False: 4.99k]
  |  Branch (925:27): [True: 0, False: 0]
  ------------------
  926|      0|        ZSTD_Trace trace;
  927|      0|        ZSTD_memset(&trace, 0, sizeof(trace));
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  928|      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    5
  |  |  ------------------
  |  |               #define ZSTD_VERSION_NUMBER  (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
  |  |  ------------------
  |  |  |  |  114|      0|#define ZSTD_VERSION_RELEASE  7
  |  |  ------------------
  ------------------
  929|      0|        trace.streaming = streaming;
  930|      0|        if (dctx->ddict) {
  ------------------
  |  Branch (930:13): [True: 0, False: 0]
  ------------------
  931|      0|            trace.dictionaryID = ZSTD_getDictID_fromDDict(dctx->ddict);
  932|      0|            trace.dictionarySize = ZSTD_DDict_dictSize(dctx->ddict);
  933|      0|            trace.dictionaryIsCold = dctx->ddictIsCold;
  934|      0|        }
  935|      0|        trace.uncompressedSize = (size_t)uncompressedSize;
  936|      0|        trace.compressedSize = (size_t)compressedSize;
  937|      0|        trace.dctx = dctx;
  938|      0|        ZSTD_trace_decompress_end(dctx->traceCtx, &trace);
  939|      0|    }
  940|       |#else
  941|       |    (void)dctx;
  942|       |    (void)uncompressedSize;
  943|       |    (void)compressedSize;
  944|       |    (void)streaming;
  945|       |#endif
  946|  4.99k|}
zstd_decompress.c:ZSTD_DCtx_resetParameters:
  241|     61|{
  242|     61|    assert(dctx->streamStage == zdss_init);
  ------------------
  |  |   70|     61|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  243|     61|    dctx->format = ZSTD_f_zstd1;
  244|     61|    dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT;
  ------------------
  |  |   40|     61|#  define ZSTD_MAXWINDOWSIZE_DEFAULT (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1)
  |  |  ------------------
  |  |  |  | 1287|     61|#define ZSTD_WINDOWLOG_LIMIT_DEFAULT 27   /* by default, the streaming decoder will refuse any frame
  |  |  ------------------
  ------------------
  245|     61|    dctx->outBufferMode = ZSTD_bm_buffered;
  246|     61|    dctx->forceIgnoreChecksum = ZSTD_d_validateChecksum;
  247|     61|    dctx->refMultipleDDicts = ZSTD_rmd_refSingleDDict;
  248|     61|    dctx->disableHufAsm = 0;
  249|     61|    dctx->maxBlockSizeParam = 0;
  250|     61|}

ZSTD_getcBlockSize:
   65|  5.00k|{
   66|  5.00k|    RETURN_ERROR_IF(srcSize < ZSTD_blockHeaderSize, srcSize_wrong, "");
  ------------------
  |  |  114|  5.00k|    do {                                                                       \
  |  |  115|  5.00k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 5.00k]
  |  |  ------------------
  |  |  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.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.00k]
  |  |  ------------------
  ------------------
   67|       |
   68|  5.00k|    {   U32 const cBlockHeader = MEM_readLE24(src);
   69|  5.00k|        U32 const cSize = cBlockHeader >> 3;
   70|  5.00k|        bpPtr->lastBlock = cBlockHeader & 1;
   71|  5.00k|        bpPtr->blockType = (blockType_e)((cBlockHeader >> 1) & 3);
   72|  5.00k|        bpPtr->origSize = cSize;   /* only useful for RLE */
   73|  5.00k|        if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (73:13): [True: 4, False: 4.99k]
  ------------------
   74|  4.99k|        RETURN_ERROR_IF(bpPtr->blockType == bt_reserved, corruption_detected, "");
  ------------------
  |  |  114|  4.99k|    do {                                                                       \
  |  |  115|  4.99k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 4.99k]
  |  |  ------------------
  |  |  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.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
   75|  4.99k|        return cSize;
   76|  4.99k|    }
   77|  4.99k|}
ZSTD_buildFSETable:
  630|  1.23k|{
  631|  1.23k|#if DYNAMIC_BMI2
  632|  1.23k|    if (bmi2) {
  ------------------
  |  Branch (632:9): [True: 1.23k, False: 0]
  ------------------
  633|  1.23k|        ZSTD_buildFSETable_body_bmi2(dt, normalizedCounter, maxSymbolValue,
  634|  1.23k|                baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  635|  1.23k|        return;
  636|  1.23k|    }
  637|      0|#endif
  638|      0|    (void)bmi2;
  639|      0|    ZSTD_buildFSETable_body_default(dt, normalizedCounter, maxSymbolValue,
  640|      0|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  641|      0|}
ZSTD_decodeSeqHeaders:
  697|  4.99k|{
  698|  4.99k|    const BYTE* const istart = (const BYTE*)src;
  699|  4.99k|    const BYTE* const iend = istart + srcSize;
  700|  4.99k|    const BYTE* ip = istart;
  701|  4.99k|    int nbSeq;
  702|  4.99k|    DEBUGLOG(5, "ZSTD_decodeSeqHeaders");
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
  703|       |
  704|       |    /* check */
  705|  4.99k|    RETURN_ERROR_IF(srcSize < MIN_SEQUENCES_SIZE, srcSize_wrong, "");
  ------------------
  |  |  114|  4.99k|    do {                                                                       \
  |  |  115|  4.99k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.99k]
  |  |  ------------------
  |  |  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.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
  706|       |
  707|       |    /* SeqHead */
  708|  4.99k|    nbSeq = *ip++;
  709|  4.99k|    if (nbSeq > 0x7F) {
  ------------------
  |  Branch (709:9): [True: 0, False: 4.99k]
  ------------------
  710|      0|        if (nbSeq == 0xFF) {
  ------------------
  |  Branch (710:13): [True: 0, False: 0]
  ------------------
  711|      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]
  |  |  ------------------
  ------------------
  712|      0|            nbSeq = MEM_readLE16(ip) + LONGNBSEQ;
  ------------------
  |  |   96|      0|#define LONGNBSEQ 0x7F00
  ------------------
  713|      0|            ip+=2;
  714|      0|        } else {
  715|      0|            RETURN_ERROR_IF(ip >= 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]
  |  |  ------------------
  ------------------
  716|      0|            nbSeq = ((nbSeq-0x80)<<8) + *ip++;
  717|      0|        }
  718|      0|    }
  719|  4.99k|    *nbSeqPtr = nbSeq;
  720|       |
  721|  4.99k|    if (nbSeq == 0) {
  ------------------
  |  Branch (721:9): [True: 732, False: 4.26k]
  ------------------
  722|       |        /* No sequence : section ends immediately */
  723|    732|        RETURN_ERROR_IF(ip != iend, corruption_detected,
  ------------------
  |  |  114|    732|    do {                                                                       \
  |  |  115|    732|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 732]
  |  |  ------------------
  |  |  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|    732|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 732]
  |  |  ------------------
  ------------------
  724|    732|            "extraneous data present in the Sequences section");
  725|    732|        return (size_t)(ip - istart);
  726|    732|    }
  727|       |
  728|       |    /* FSE table descriptors */
  729|  4.26k|    RETURN_ERROR_IF(ip+1 > iend, srcSize_wrong, ""); /* minimum possible size: 1 byte for symbol encoding types */
  ------------------
  |  |  114|  4.26k|    do {                                                                       \
  |  |  115|  4.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |  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.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  730|  4.26k|    RETURN_ERROR_IF(*ip & 3, corruption_detected, ""); /* The last field, Reserved, must be all-zeroes. */
  ------------------
  |  |  114|  4.26k|    do {                                                                       \
  |  |  115|  4.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |  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.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  731|  4.26k|    {   SymbolEncodingType_e const LLtype = (SymbolEncodingType_e)(*ip >> 6);
  732|  4.26k|        SymbolEncodingType_e const OFtype = (SymbolEncodingType_e)((*ip >> 4) & 3);
  733|  4.26k|        SymbolEncodingType_e const MLtype = (SymbolEncodingType_e)((*ip >> 2) & 3);
  734|  4.26k|        ip++;
  735|       |
  736|       |        /* Build DTables */
  737|  4.26k|        {   size_t const llhSize = ZSTD_buildSeqTable(dctx->entropy.LLTable, &dctx->LLTptr,
  738|  4.26k|                                                      LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  104|  4.26k|#define MaxLL   35
  ------------------
                                                                    LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  109|  4.26k|#define LLFSELog    9
  ------------------
  739|  4.26k|                                                      ip, iend-ip,
  740|  4.26k|                                                      LL_base, LL_bits,
  741|  4.26k|                                                      LL_defaultDTable, dctx->fseEntropy,
  742|  4.26k|                                                      dctx->ddictIsCold, nbSeq,
  743|  4.26k|                                                      dctx->workspace, sizeof(dctx->workspace),
  744|  4.26k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  745|  4.26k|            RETURN_ERROR_IF(ZSTD_isError(llhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  4.26k|    do {                                                                       \
  |  |  115|  4.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |  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.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  746|  4.26k|            ip += llhSize;
  747|  4.26k|        }
  748|       |
  749|      0|        {   size_t const ofhSize = ZSTD_buildSeqTable(dctx->entropy.OFTable, &dctx->OFTptr,
  750|  4.26k|                                                      OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  106|  4.26k|#define MaxOff  31
  ------------------
                                                                    OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  110|  4.26k|#define OffFSELog   8
  ------------------
  751|  4.26k|                                                      ip, iend-ip,
  752|  4.26k|                                                      OF_base, OF_bits,
  753|  4.26k|                                                      OF_defaultDTable, dctx->fseEntropy,
  754|  4.26k|                                                      dctx->ddictIsCold, nbSeq,
  755|  4.26k|                                                      dctx->workspace, sizeof(dctx->workspace),
  756|  4.26k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  757|  4.26k|            RETURN_ERROR_IF(ZSTD_isError(ofhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  4.26k|    do {                                                                       \
  |  |  115|  4.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |  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.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  758|  4.26k|            ip += ofhSize;
  759|  4.26k|        }
  760|       |
  761|      0|        {   size_t const mlhSize = ZSTD_buildSeqTable(dctx->entropy.MLTable, &dctx->MLTptr,
  762|  4.26k|                                                      MLtype, MaxML, MLFSELog,
  ------------------
  |  |  103|  4.26k|#define MaxML   52
  ------------------
                                                                    MLtype, MaxML, MLFSELog,
  ------------------
  |  |  108|  4.26k|#define MLFSELog    9
  ------------------
  763|  4.26k|                                                      ip, iend-ip,
  764|  4.26k|                                                      ML_base, ML_bits,
  765|  4.26k|                                                      ML_defaultDTable, dctx->fseEntropy,
  766|  4.26k|                                                      dctx->ddictIsCold, nbSeq,
  767|  4.26k|                                                      dctx->workspace, sizeof(dctx->workspace),
  768|  4.26k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  769|  4.26k|            RETURN_ERROR_IF(ZSTD_isError(mlhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  4.26k|    do {                                                                       \
  |  |  115|  4.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |  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.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
  770|  4.26k|            ip += mlhSize;
  771|  4.26k|        }
  772|  4.26k|    }
  773|       |
  774|      0|    return ip-istart;
  775|  4.26k|}
ZSTD_decompressBlock_internal:
 2069|  4.99k|{   /* blockType == blockCompressed */
 2070|  4.99k|    const BYTE* ip = (const BYTE*)src;
 2071|  4.99k|    DEBUGLOG(5, "ZSTD_decompressBlock_internal (cSize : %u)", (unsigned)srcSize);
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 2072|       |
 2073|       |    /* Note : the wording of the specification
 2074|       |     * allows compressed block to be sized exactly ZSTD_blockSizeMax(dctx).
 2075|       |     * This generally does not happen, as it makes little sense,
 2076|       |     * since an uncompressed block would feature same size and have no decompression cost.
 2077|       |     * Also, note that decoder from reference libzstd before < v1.5.4
 2078|       |     * would consider this edge case as an error.
 2079|       |     * As a consequence, avoid generating compressed blocks of size ZSTD_blockSizeMax(dctx)
 2080|       |     * for broader compatibility with the deployed ecosystem of zstd decoders */
 2081|  4.99k|    RETURN_ERROR_IF(srcSize > ZSTD_blockSizeMax(dctx), srcSize_wrong, "");
  ------------------
  |  |  114|  4.99k|    do {                                                                       \
  |  |  115|  4.99k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.99k]
  |  |  ------------------
  |  |  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.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 2082|       |
 2083|       |    /* Decode literals section */
 2084|  4.99k|    {   size_t const litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize, dst, dstCapacity, streaming);
 2085|  4.99k|        DEBUGLOG(5, "ZSTD_decodeLiteralsBlock : cSize=%u, nbLiterals=%zu", (U32)litCSize, dctx->litSize);
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 2086|  4.99k|        if (ZSTD_isError(litCSize)) return litCSize;
  ------------------
  |  |   44|  4.99k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2086:13): [True: 3, False: 4.99k]
  ------------------
 2087|  4.99k|        ip += litCSize;
 2088|  4.99k|        srcSize -= litCSize;
 2089|  4.99k|    }
 2090|       |
 2091|       |    /* Build Decoding Tables */
 2092|      0|    {
 2093|       |        /* Compute the maximum block size, which must also work when !frame and fParams are unset.
 2094|       |         * Additionally, take the min with dstCapacity to ensure that the totalHistorySize fits in a size_t.
 2095|       |         */
 2096|  4.99k|        size_t const blockSizeMax = MIN(dstCapacity, ZSTD_blockSizeMax(dctx));
  ------------------
  |  |   54|  4.99k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 4.99k]
  |  |  ------------------
  ------------------
 2097|  4.99k|        size_t const totalHistorySize = ZSTD_totalHistorySize(ZSTD_maybeNullPtrAdd((BYTE*)dst, blockSizeMax), (BYTE const*)dctx->virtualStart);
 2098|       |        /* isLongOffset must be true if there are long offsets.
 2099|       |         * Offsets are long if they are larger than ZSTD_maxShortOffset().
 2100|       |         * We don't expect that to be the case in 64-bit mode.
 2101|       |         *
 2102|       |         * We check here to see if our history is large enough to allow long offsets.
 2103|       |         * If it isn't, then we can't possible have (valid) long offsets. If the offset
 2104|       |         * is invalid, then it is okay to read it incorrectly.
 2105|       |         *
 2106|       |         * If isLongOffsets is true, then we will later check our decoding table to see
 2107|       |         * if it is even possible to generate long offsets.
 2108|       |         */
 2109|  4.99k|        ZSTD_longOffset_e isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (totalHistorySize > ZSTD_maxShortOffset()));
  ------------------
  |  Branch (2109:62): [True: 0, False: 4.99k]
  |  Branch (2109:78): [True: 0, False: 0]
  ------------------
 2110|       |        /* These macros control at build-time which decompressor implementation
 2111|       |         * we use. If neither is defined, we do some inspection and dispatch at
 2112|       |         * runtime.
 2113|       |         */
 2114|  4.99k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2115|  4.99k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2116|  4.99k|        int usePrefetchDecoder = dctx->ddictIsCold;
 2117|       |#else
 2118|       |        /* Set to 1 to avoid computing offset info if we don't need to.
 2119|       |         * Otherwise this value is ignored.
 2120|       |         */
 2121|       |        int usePrefetchDecoder = 1;
 2122|       |#endif
 2123|  4.99k|        int nbSeq;
 2124|  4.99k|        size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize);
 2125|  4.99k|        if (ZSTD_isError(seqHSize)) return seqHSize;
  ------------------
  |  |   44|  4.99k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2125:13): [True: 0, False: 4.99k]
  ------------------
 2126|  4.99k|        ip += seqHSize;
 2127|  4.99k|        srcSize -= seqHSize;
 2128|       |
 2129|  4.99k|        RETURN_ERROR_IF((dst == NULL || dstCapacity == 0) && nbSeq > 0, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  4.99k|    do {                                                                       \
  |  |  115|  19.9k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.99k]
  |  |  |  Branch (115:13): [True: 0, False: 4.99k]
  |  |  |  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.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 2130|  4.99k|        RETURN_ERROR_IF(MEM_64bits() && sizeof(size_t) == sizeof(void*) && (size_t)(-1) - (size_t)dst < (size_t)(1 << 20), dstSize_tooSmall,
  ------------------
  |  |  114|  4.99k|    do {                                                                       \
  |  |  115|  24.9k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4.99k, False: 0]
  |  |  |  Branch (115:13): [True: 0, Folded]
  |  |  |  Branch (115:13): [True: 0, False: 4.99k]
  |  |  ------------------
  |  |  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.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 2131|  4.99k|                "invalid dst");
 2132|       |
 2133|       |        /* If we could potentially have long offsets, or we might want to use the prefetch decoder,
 2134|       |         * compute information about the share of long offsets, and the maximum nbAdditionalBits.
 2135|       |         * NOTE: could probably use a larger nbSeq limit
 2136|       |         */
 2137|  4.99k|        if (isLongOffset || (!usePrefetchDecoder && (totalHistorySize > (1u << 24)) && (nbSeq > 8))) {
  ------------------
  |  Branch (2137:13): [True: 0, False: 4.99k]
  |  Branch (2137:30): [True: 4.99k, False: 0]
  |  Branch (2137:53): [True: 0, False: 4.99k]
  |  Branch (2137:88): [True: 0, False: 0]
  ------------------
 2138|      0|            ZSTD_OffsetInfo const info = ZSTD_getOffsetInfo(dctx->OFTptr, nbSeq);
 2139|      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 (2139:17): [True: 0, False: 0]
  |  Branch (2139:33): [True: 0, False: 0]
  ------------------
 2140|       |                /* If isLongOffset, but the maximum number of additional bits that we see in our table is small
 2141|       |                 * enough, then we know it is impossible to have too long an offset in this block, so we can
 2142|       |                 * use the regular offset decoder.
 2143|       |                 */
 2144|      0|                isLongOffset = ZSTD_lo_isRegularOffset;
 2145|      0|            }
 2146|      0|            if (!usePrefetchDecoder) {
  ------------------
  |  Branch (2146:17): [True: 0, False: 0]
  ------------------
 2147|      0|                U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */
  ------------------
  |  Branch (2147:38): [True: 0, False: 0]
  ------------------
 2148|      0|                usePrefetchDecoder = (info.longOffsetShare >= minShare);
 2149|      0|            }
 2150|      0|        }
 2151|       |
 2152|  4.99k|        dctx->ddictIsCold = 0;
 2153|       |
 2154|  4.99k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2155|  4.99k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2156|  4.99k|        if (usePrefetchDecoder) {
  ------------------
  |  Branch (2156:13): [True: 0, False: 4.99k]
  ------------------
 2157|       |#else
 2158|       |        (void)usePrefetchDecoder;
 2159|       |        {
 2160|       |#endif
 2161|      0|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
 2162|      0|            return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2163|      0|#endif
 2164|      0|        }
 2165|       |
 2166|  4.99k|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
 2167|       |        /* else */
 2168|  4.99k|        if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (2168:13): [True: 0, False: 4.99k]
  ------------------
 2169|      0|            return ZSTD_decompressSequencesSplitLitBuffer(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2170|  4.99k|        else
 2171|  4.99k|            return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2172|  4.99k|#endif
 2173|  4.99k|    }
 2174|  4.99k|}
ZSTD_checkContinuity:
 2179|  5.00k|{
 2180|  5.00k|    if (dst != dctx->previousDstEnd && dstSize > 0) {   /* not contiguous */
  ------------------
  |  Branch (2180:9): [True: 5.00k, False: 0]
  |  Branch (2180:40): [True: 5.00k, False: 0]
  ------------------
 2181|  5.00k|        dctx->dictEnd = dctx->previousDstEnd;
 2182|  5.00k|        dctx->virtualStart = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->prefixStart));
 2183|  5.00k|        dctx->prefixStart = dst;
 2184|  5.00k|        dctx->previousDstEnd = dst;
 2185|  5.00k|    }
 2186|  5.00k|}
zstd_decompress_block.c:ZSTD_decodeLiteralsBlock:
  137|  4.99k|{
  138|  4.99k|    DEBUGLOG(5, "ZSTD_decodeLiteralsBlock");
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
  139|  4.99k|    RETURN_ERROR_IF(srcSize < MIN_CBLOCK_SIZE, corruption_detected, "");
  ------------------
  |  |  114|  4.99k|    do {                                                                       \
  |  |  115|  4.99k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.99k]
  |  |  ------------------
  |  |  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.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
  140|       |
  141|  4.99k|    {   const BYTE* const istart = (const BYTE*) src;
  142|  4.99k|        SymbolEncodingType_e const litEncType = (SymbolEncodingType_e)(istart[0] & 3);
  143|  4.99k|        size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
  144|       |
  145|  4.99k|        switch(litEncType)
  146|  4.99k|        {
  147|      0|        case set_repeat:
  ------------------
  |  Branch (147:9): [True: 0, False: 4.99k]
  ------------------
  148|      0|            DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block");
  ------------------
  |  |  104|      0|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 0]
  |  |  ------------------
  ------------------
  149|      0|            RETURN_ERROR_IF(dctx->litEntropy==0, 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]
  |  |  ------------------
  ------------------
  150|      0|            ZSTD_FALLTHROUGH;
  ------------------
  |  |  262|      0|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  151|       |
  152|  3.55k|        case set_compressed:
  ------------------
  |  Branch (152:9): [True: 3.55k, False: 1.43k]
  ------------------
  153|  3.55k|            RETURN_ERROR_IF(srcSize < 5, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need up to 5 for case 3");
  ------------------
  |  |  114|  3.55k|    do {                                                                       \
  |  |  115|  3.55k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.55k]
  |  |  ------------------
  |  |  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.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  154|  3.55k|            {   size_t lhSize, litSize, litCSize;
  155|  3.55k|                U32 singleStream=0;
  156|  3.55k|                U32 const lhlCode = (istart[0] >> 2) & 3;
  157|  3.55k|                U32 const lhc = MEM_readLE32(istart);
  158|  3.55k|                size_t hufSuccess;
  159|  3.55k|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|  3.55k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 2, False: 3.55k]
  |  |  ------------------
  ------------------
  160|  3.55k|                int const flags = 0
  161|  3.55k|                    | (ZSTD_DCtx_get_bmi2(dctx) ? HUF_flags_bmi2 : 0)
  ------------------
  |  Branch (161:24): [True: 3.55k, False: 0]
  ------------------
  162|  3.55k|                    | (dctx->disableHufAsm ? HUF_flags_disableAsm : 0);
  ------------------
  |  Branch (162:24): [True: 0, False: 3.55k]
  ------------------
  163|  3.55k|                switch(lhlCode)
  164|  3.55k|                {
  165|  3.55k|                case 0: case 1: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (165:17): [True: 3.55k, False: 2]
  |  Branch (165:25): [True: 1, False: 3.55k]
  |  Branch (165:33): [True: 0, False: 3.55k]
  ------------------
  166|       |                    /* 2 - 2 - 10 - 10 */
  167|  3.55k|                    singleStream = !lhlCode;
  168|  3.55k|                    lhSize = 3;
  169|  3.55k|                    litSize  = (lhc >> 4) & 0x3FF;
  170|  3.55k|                    litCSize = (lhc >> 14) & 0x3FF;
  171|  3.55k|                    break;
  172|      1|                case 2:
  ------------------
  |  Branch (172:17): [True: 1, False: 3.55k]
  ------------------
  173|       |                    /* 2 - 2 - 14 - 14 */
  174|      1|                    lhSize = 4;
  175|      1|                    litSize  = (lhc >> 4) & 0x3FFF;
  176|      1|                    litCSize = lhc >> 18;
  177|      1|                    break;
  178|      0|                case 3:
  ------------------
  |  Branch (178:17): [True: 0, False: 3.55k]
  ------------------
  179|       |                    /* 2 - 2 - 18 - 18 */
  180|      0|                    lhSize = 5;
  181|      0|                    litSize  = (lhc >> 4) & 0x3FFFF;
  182|      0|                    litCSize = (lhc >> 22) + ((size_t)istart[4] << 10);
  183|      0|                    break;
  184|  3.55k|                }
  185|  3.55k|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  3.55k|    do {                                                                       \
  |  |  115|  10.6k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3.55k, False: 0]
  |  |  |  Branch (115:13): [True: 0, False: 3.55k]
  |  |  ------------------
  |  |  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.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  186|  3.55k|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|  3.55k|    do {                                                                       \
  |  |  115|  3.55k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.55k]
  |  |  ------------------
  |  |  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.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  187|  3.55k|                if (!singleStream)
  ------------------
  |  Branch (187:21): [True: 2, False: 3.55k]
  ------------------
  188|      2|                    RETURN_ERROR_IF(litSize < MIN_LITERALS_FOR_4_STREAMS, literals_headerWrong,
  ------------------
  |  |  114|      2|    do {                                                                       \
  |  |  115|      2|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 2]
  |  |  ------------------
  |  |  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|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  189|  3.55k|                        "Not enough literals (%zu) for the 4-streams mode (min %u)",
  190|  3.55k|                        litSize, MIN_LITERALS_FOR_4_STREAMS);
  191|  3.55k|                RETURN_ERROR_IF(litCSize + lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|  3.55k|    do {                                                                       \
  |  |  115|  3.55k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 3.55k]
  |  |  ------------------
  |  |  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.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  192|  3.55k|                RETURN_ERROR_IF(expectedWriteSize < litSize , dstSize_tooSmall, "");
  ------------------
  |  |  114|  3.55k|    do {                                                                       \
  |  |  115|  3.55k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 3.55k]
  |  |  ------------------
  |  |  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.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  193|  3.55k|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 0);
  194|       |
  195|       |                /* prefetch huffman table if cold */
  196|  3.55k|                if (dctx->ddictIsCold && (litSize > 768 /* heuristic */)) {
  ------------------
  |  Branch (196:21): [True: 0, False: 3.55k]
  |  Branch (196:42): [True: 0, False: 0]
  ------------------
  197|      0|                    PREFETCH_AREA(dctx->HUFptr, sizeof(dctx->entropy.hufTable));
  ------------------
  |  |  159|      0|    do {                                                 \
  |  |  160|      0|        const char* const _ptr = (const char*)(p);       \
  |  |  161|      0|        size_t const _size = (size_t)(s);                \
  |  |  162|      0|        size_t _pos;                                     \
  |  |  163|      0|        for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
  |  |  ------------------
  |  |  |  |  156|      0|#define CACHELINE_SIZE 64
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  164|      0|            PREFETCH_L2(_ptr + _pos);                    \
  |  |  ------------------
  |  |  |  |  146|      0|#    define PREFETCH_L2(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
  |  |  ------------------
  |  |  165|      0|        }                                                \
  |  |  166|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  198|      0|                }
  199|       |
  200|  3.55k|                if (litEncType==set_repeat) {
  ------------------
  |  Branch (200:21): [True: 0, False: 3.55k]
  ------------------
  201|      0|                    if (singleStream) {
  ------------------
  |  Branch (201:25): [True: 0, False: 0]
  ------------------
  202|      0|                        hufSuccess = HUF_decompress1X_usingDTable(
  203|      0|                            dctx->litBuffer, litSize, istart+lhSize, litCSize,
  204|      0|                            dctx->HUFptr, flags);
  205|      0|                    } else {
  206|      0|                        assert(litSize >= MIN_LITERALS_FOR_4_STREAMS);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  207|      0|                        hufSuccess = HUF_decompress4X_usingDTable(
  208|      0|                            dctx->litBuffer, litSize, istart+lhSize, litCSize,
  209|      0|                            dctx->HUFptr, flags);
  210|      0|                    }
  211|  3.55k|                } else {
  212|  3.55k|                    if (singleStream) {
  ------------------
  |  Branch (212:25): [True: 3.55k, False: 1]
  ------------------
  213|       |#if defined(HUF_FORCE_DECOMPRESS_X2)
  214|       |                        hufSuccess = HUF_decompress1X_DCtx_wksp(
  215|       |                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  216|       |                            istart+lhSize, litCSize, dctx->workspace,
  217|       |                            sizeof(dctx->workspace), flags);
  218|       |#else
  219|  3.55k|                        hufSuccess = HUF_decompress1X1_DCtx_wksp(
  220|  3.55k|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  221|  3.55k|                            istart+lhSize, litCSize, dctx->workspace,
  222|  3.55k|                            sizeof(dctx->workspace), flags);
  223|  3.55k|#endif
  224|  3.55k|                    } else {
  225|      1|                        hufSuccess = HUF_decompress4X_hufOnly_wksp(
  226|      1|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  227|      1|                            istart+lhSize, litCSize, dctx->workspace,
  228|      1|                            sizeof(dctx->workspace), flags);
  229|      1|                    }
  230|  3.55k|                }
  231|  3.55k|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (231:21): [True: 0, False: 3.55k]
  ------------------
  232|      0|                {
  233|      0|                    assert(litSize > ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  234|      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]
  |  |  ------------------
  ------------------
  235|      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]
  |  |  ------------------
  ------------------
  236|      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;
  ------------------
  |  |  199|      0|#define WILDCOPY_OVERLENGTH 32
  ------------------
  237|      0|                    dctx->litBufferEnd -= WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|      0|#define WILDCOPY_OVERLENGTH 32
  ------------------
  238|      0|                    assert(dctx->litBufferEnd <= (BYTE*)dst + blockSizeMax);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  239|      0|                }
  240|       |
  241|  3.55k|                RETURN_ERROR_IF(HUF_isError(hufSuccess), corruption_detected, "");
  ------------------
  |  |  114|  3.55k|    do {                                                                       \
  |  |  115|  3.55k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 3.55k]
  |  |  ------------------
  |  |  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.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.55k]
  |  |  ------------------
  ------------------
  242|       |
  243|  3.55k|                dctx->litPtr = dctx->litBuffer;
  244|  3.55k|                dctx->litSize = litSize;
  245|  3.55k|                dctx->litEntropy = 1;
  246|  3.55k|                if (litEncType==set_compressed) dctx->HUFptr = dctx->entropy.hufTable;
  ------------------
  |  Branch (246:21): [True: 3.55k, False: 0]
  ------------------
  247|  3.55k|                return litCSize + lhSize;
  248|  3.55k|            }
  249|       |
  250|  1.43k|        case set_basic:
  ------------------
  |  Branch (250:9): [True: 1.43k, False: 3.55k]
  ------------------
  251|  1.43k|            {   size_t litSize, lhSize;
  252|  1.43k|                U32 const lhlCode = ((istart[0]) >> 2) & 3;
  253|  1.43k|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|  1.43k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 1, False: 1.43k]
  |  |  ------------------
  ------------------
  254|  1.43k|                switch(lhlCode)
  255|  1.43k|                {
  256|    554|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (256:17): [True: 262, False: 1.17k]
  |  Branch (256:25): [True: 292, False: 1.14k]
  |  Branch (256:33): [True: 0, False: 1.43k]
  ------------------
  257|    554|                    lhSize = 1;
  258|    554|                    litSize = istart[0] >> 3;
  259|    554|                    break;
  260|    885|                case 1:
  ------------------
  |  Branch (260:17): [True: 885, False: 554]
  ------------------
  261|    885|                    lhSize = 2;
  262|    885|                    litSize = MEM_readLE16(istart) >> 4;
  263|    885|                    break;
  264|      0|                case 3:
  ------------------
  |  Branch (264:17): [True: 0, False: 1.43k]
  ------------------
  265|      0|                    lhSize = 3;
  266|      0|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize = 3");
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  267|      0|                    litSize = MEM_readLE24(istart) >> 4;
  268|      0|                    break;
  269|  1.43k|                }
  270|       |
  271|  1.43k|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  1.43k|    do {                                                                       \
  |  |  115|  4.31k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1.43k, False: 0]
  |  |  |  Branch (115:13): [True: 0, False: 1.43k]
  |  |  ------------------
  |  |  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|  1.43k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.43k]
  |  |  ------------------
  ------------------
  272|  1.43k|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|  1.43k|    do {                                                                       \
  |  |  115|  1.43k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 1.43k]
  |  |  ------------------
  |  |  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|  1.43k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.43k]
  |  |  ------------------
  ------------------
  273|  1.43k|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  114|  1.43k|    do {                                                                       \
  |  |  115|  1.43k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 1.43k]
  |  |  ------------------
  |  |  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|  1.43k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.43k]
  |  |  ------------------
  ------------------
  274|  1.43k|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  275|  1.43k|                if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  |  199|  1.43k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (275:21): [True: 1.41k, False: 22]
  ------------------
  276|  1.41k|                    RETURN_ERROR_IF(litSize+lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|  1.41k|    do {                                                                       \
  |  |  115|  1.41k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 1.41k]
  |  |  ------------------
  |  |  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.41k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.41k]
  |  |  ------------------
  ------------------
  277|  1.41k|                    if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (277:25): [True: 0, False: 1.41k]
  ------------------
  278|      0|                    {
  279|      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]
  |  |  ------------------
  ------------------
  280|      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]
  |  |  ------------------
  ------------------
  281|      0|                    }
  282|  1.41k|                    else
  283|  1.41k|                    {
  284|  1.41k|                        ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize);
  ------------------
  |  |   44|  1.41k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  285|  1.41k|                    }
  286|  1.41k|                    dctx->litPtr = dctx->litBuffer;
  287|  1.41k|                    dctx->litSize = litSize;
  288|  1.41k|                    return lhSize+litSize;
  289|  1.41k|                }
  290|       |                /* direct reference into compressed stream */
  291|     22|                dctx->litPtr = istart+lhSize;
  292|     22|                dctx->litSize = litSize;
  293|     22|                dctx->litBufferEnd = dctx->litPtr + litSize;
  294|     22|                dctx->litBufferLocation = ZSTD_not_in_dst;
  295|     22|                return lhSize+litSize;
  296|  1.43k|            }
  297|       |
  298|      0|        case set_rle:
  ------------------
  |  Branch (298:9): [True: 0, False: 4.99k]
  ------------------
  299|      0|            {   U32 const lhlCode = ((istart[0]) >> 2) & 3;
  300|      0|                size_t litSize, lhSize;
  301|      0|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  302|      0|                switch(lhlCode)
  303|      0|                {
  304|      0|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (304:17): [True: 0, False: 0]
  |  Branch (304:25): [True: 0, False: 0]
  |  Branch (304:33): [True: 0, False: 0]
  ------------------
  305|      0|                    lhSize = 1;
  306|      0|                    litSize = istart[0] >> 3;
  307|      0|                    break;
  308|      0|                case 1:
  ------------------
  |  Branch (308:17): [True: 0, False: 0]
  ------------------
  309|      0|                    lhSize = 2;
  310|      0|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 3");
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  311|      0|                    litSize = MEM_readLE16(istart) >> 4;
  312|      0|                    break;
  313|      0|                case 3:
  ------------------
  |  Branch (313:17): [True: 0, False: 0]
  ------------------
  314|      0|                    lhSize = 3;
  315|      0|                    RETURN_ERROR_IF(srcSize<4, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 4");
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  316|      0|                    litSize = MEM_readLE24(istart) >> 4;
  317|      0|                    break;
  318|      0|                }
  319|      0|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|      0|    do {                                                                       \
  |  |  115|      0|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 0]
  |  |  |  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]
  |  |  ------------------
  ------------------
  320|      0|                RETURN_ERROR_IF(litSize > blockSizeMax, 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]
  |  |  ------------------
  ------------------
  321|      0|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  322|      0|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  323|      0|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (323:21): [True: 0, False: 0]
  ------------------
  324|      0|                {
  325|      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]
  |  |  ------------------
  ------------------
  326|      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]
  |  |  ------------------
  ------------------
  327|      0|                }
  328|      0|                else
  329|      0|                {
  330|      0|                    ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize);
  ------------------
  |  |   46|      0|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  331|      0|                }
  332|      0|                dctx->litPtr = dctx->litBuffer;
  333|      0|                dctx->litSize = litSize;
  334|      0|                return lhSize+1;
  335|      0|            }
  336|      0|        default:
  ------------------
  |  Branch (336:9): [True: 0, False: 4.99k]
  ------------------
  337|      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]
  |  |  ------------------
  ------------------
  338|  4.99k|        }
  339|  4.99k|    }
  340|  4.99k|}
zstd_decompress_block.c:ZSTD_allocateLiteralsBuffer:
   82|  4.99k|{
   83|  4.99k|    size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
   84|  4.99k|    assert(litSize <= blockSizeMax);
  ------------------
  |  |   70|  4.99k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   85|  4.99k|    assert(dctx->isFrameDecompression || streaming == not_streaming);
  ------------------
  |  |   70|  4.99k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   86|  4.99k|    assert(expectedWriteSize <= blockSizeMax);
  ------------------
  |  |   70|  4.99k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   87|  4.99k|    if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  199|  4.99k|#define WILDCOPY_OVERLENGTH 32
  ------------------
                  if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  199|  4.99k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (87:9): [True: 4.99k, False: 0]
  |  Branch (87:39): [True: 2, False: 4.99k]
  ------------------
   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|      2|        dctx->litBuffer = (BYTE*)dst + blockSizeMax + WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|      2|#define WILDCOPY_OVERLENGTH 32
  ------------------
   94|      2|        dctx->litBufferEnd = dctx->litBuffer + litSize;
   95|      2|        dctx->litBufferLocation = ZSTD_in_dst;
   96|  4.99k|    } else if (litSize <= ZSTD_LITBUFFEREXTRASIZE) {
  ------------------
  |  |  118|  4.99k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  4.99k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  9.98k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 4.99k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 4.99k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (96:16): [True: 4.99k, False: 0]
  ------------------
   97|       |        /* Literals fit entirely within the extra buffer, put them there to avoid
   98|       |         * having to split the literals.
   99|       |         */
  100|  4.99k|        dctx->litBuffer = dctx->litExtraBuffer;
  101|  4.99k|        dctx->litBufferEnd = dctx->litBuffer + litSize;
  102|  4.99k|        dctx->litBufferLocation = ZSTD_not_in_dst;
  103|  4.99k|    } 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;
  ------------------
  |  |  199|      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.99k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body_bmi2:
  620|  1.23k|{
  621|  1.23k|    ZSTD_buildFSETable_body(dt, normalizedCounter, maxSymbolValue,
  622|  1.23k|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  623|  1.23k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body:
  489|  1.23k|{
  490|  1.23k|    ZSTD_seqSymbol* const tableDecode = dt+1;
  491|  1.23k|    U32 const maxSV1 = maxSymbolValue + 1;
  492|  1.23k|    U32 const tableSize = 1 << tableLog;
  493|       |
  494|  1.23k|    U16* symbolNext = (U16*)wksp;
  495|  1.23k|    BYTE* spread = (BYTE*)(symbolNext + MaxSeq + 1);
  ------------------
  |  |  107|  1.23k|#define MaxSeq MAX(MaxLL, MaxML)   /* Assumption : MaxOff < MaxLL,MaxML */
  |  |  ------------------
  |  |  |  |   55|  1.23k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [Folded, False: 1.23k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  496|  1.23k|    U32 highThreshold = tableSize - 1;
  497|       |
  498|       |
  499|       |    /* Sanity Checks */
  500|  1.23k|    assert(maxSymbolValue <= MaxSeq);
  ------------------
  |  |   70|  1.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  501|  1.23k|    assert(tableLog <= MaxFSELog);
  ------------------
  |  |   70|  1.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  502|  1.23k|    assert(wkspSize >= ZSTD_BUILD_FSE_TABLE_WKSP_SIZE);
  ------------------
  |  |   70|  1.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  503|  1.23k|    (void)wkspSize;
  504|       |    /* Init, lay down lowprob symbols */
  505|  1.23k|    {   ZSTD_seqSymbol_header DTableH;
  506|  1.23k|        DTableH.tableLog = tableLog;
  507|  1.23k|        DTableH.fastMode = 1;
  508|  1.23k|        {   S16 const largeLimit= (S16)(1 << (tableLog-1));
  509|  1.23k|            U32 s;
  510|  10.2k|            for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (510:23): [True: 9.01k, False: 1.23k]
  ------------------
  511|  9.01k|                if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (511:21): [True: 0, False: 9.01k]
  ------------------
  512|      0|                    tableDecode[highThreshold--].baseValue = s;
  513|      0|                    symbolNext[s] = 1;
  514|  9.01k|                } else {
  515|  9.01k|                    if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
  ------------------
  |  Branch (515:25): [True: 1.06k, False: 7.95k]
  ------------------
  516|  9.01k|                    assert(normalizedCounter[s]>=0);
  ------------------
  |  |   70|  9.01k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  517|  9.01k|                    symbolNext[s] = (U16)normalizedCounter[s];
  518|  9.01k|        }   }   }
  519|  1.23k|        ZSTD_memcpy(dt, &DTableH, sizeof(DTableH));
  ------------------
  |  |   44|  1.23k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  520|  1.23k|    }
  521|       |
  522|       |    /* Spread symbols */
  523|  1.23k|    assert(tableSize <= 512);
  ------------------
  |  |   70|  1.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  524|       |    /* Specialized symbol spreading for the case when there are
  525|       |     * no low probability (-1 count) symbols. When compressing
  526|       |     * small blocks we avoid low probability symbols to hit this
  527|       |     * case, since header decoding speed matters more.
  528|       |     */
  529|  1.23k|    if (highThreshold == tableSize - 1) {
  ------------------
  |  Branch (529:9): [True: 1.23k, False: 0]
  ------------------
  530|  1.23k|        size_t const tableMask = tableSize-1;
  531|  1.23k|        size_t const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|  1.23k|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  532|       |        /* First lay down the symbols in order.
  533|       |         * We use a uint64_t to lay down 8 bytes at a time. This reduces branch
  534|       |         * misses since small blocks generally have small table logs, so nearly
  535|       |         * all symbols have counts <= 8. We ensure we have 8 bytes at the end of
  536|       |         * our buffer to handle the over-write.
  537|       |         */
  538|  1.23k|        {
  539|  1.23k|            U64 const add = 0x0101010101010101ull;
  540|  1.23k|            size_t pos = 0;
  541|  1.23k|            U64 sv = 0;
  542|  1.23k|            U32 s;
  543|  10.2k|            for (s=0; s<maxSV1; ++s, sv += add) {
  ------------------
  |  Branch (543:23): [True: 9.01k, False: 1.23k]
  ------------------
  544|  9.01k|                int i;
  545|  9.01k|                int const n = normalizedCounter[s];
  546|  9.01k|                MEM_write64(spread + pos, sv);
  547|  11.8k|                for (i = 8; i < n; i += 8) {
  ------------------
  |  Branch (547:29): [True: 2.86k, False: 9.01k]
  ------------------
  548|  2.86k|                    MEM_write64(spread + pos + i, sv);
  549|  2.86k|                }
  550|  9.01k|                assert(n>=0);
  ------------------
  |  |   70|  9.01k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  551|  9.01k|                pos += (size_t)n;
  552|  9.01k|            }
  553|  1.23k|        }
  554|       |        /* Now we spread those positions across the table.
  555|       |         * The benefit of doing it in two stages is that we avoid the
  556|       |         * variable size inner loop, which caused lots of branch misses.
  557|       |         * Now we can run through all the positions without any branch misses.
  558|       |         * We unroll the loop twice, since that is what empirically worked best.
  559|       |         */
  560|  1.23k|        {
  561|  1.23k|            size_t position = 0;
  562|  1.23k|            size_t s;
  563|  1.23k|            size_t const unroll = 2;
  564|  1.23k|            assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
  ------------------
  |  |   70|  1.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  565|  21.0k|            for (s = 0; s < (size_t)tableSize; s += unroll) {
  ------------------
  |  Branch (565:25): [True: 19.8k, False: 1.23k]
  ------------------
  566|  19.8k|                size_t u;
  567|  59.4k|                for (u = 0; u < unroll; ++u) {
  ------------------
  |  Branch (567:29): [True: 39.6k, False: 19.8k]
  ------------------
  568|  39.6k|                    size_t const uPosition = (position + (u * step)) & tableMask;
  569|  39.6k|                    tableDecode[uPosition].baseValue = spread[s + u];
  570|  39.6k|                }
  571|  19.8k|                position = (position + (unroll * step)) & tableMask;
  572|  19.8k|            }
  573|  1.23k|            assert(position == 0);
  ------------------
  |  |   70|  1.23k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  574|  1.23k|        }
  575|  1.23k|    } else {
  576|      0|        U32 const tableMask = tableSize-1;
  577|      0|        U32 const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|      0|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  578|      0|        U32 s, position = 0;
  579|      0|        for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (579:19): [True: 0, False: 0]
  ------------------
  580|      0|            int i;
  581|      0|            int const n = normalizedCounter[s];
  582|      0|            for (i=0; i<n; i++) {
  ------------------
  |  Branch (582:23): [True: 0, False: 0]
  ------------------
  583|      0|                tableDecode[position].baseValue = s;
  584|      0|                position = (position + step) & tableMask;
  585|      0|                while (UNLIKELY(position > highThreshold)) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  |  188|      0|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  586|      0|        }   }
  587|      0|        assert(position == 0); /* position must reach all cells once, otherwise normalizedCounter is incorrect */
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  588|      0|    }
  589|       |
  590|       |    /* Build Decoding table */
  591|  1.23k|    {
  592|  1.23k|        U32 u;
  593|  40.8k|        for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (593:19): [True: 39.6k, False: 1.23k]
  ------------------
  594|  39.6k|            U32 const symbol = tableDecode[u].baseValue;
  595|  39.6k|            U32 const nextState = symbolNext[symbol]++;
  596|  39.6k|            tableDecode[u].nbBits = (BYTE) (tableLog - ZSTD_highbit32(nextState) );
  597|  39.6k|            tableDecode[u].nextState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
  598|  39.6k|            assert(nbAdditionalBits[symbol] < 255);
  ------------------
  |  |   70|  39.6k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  599|  39.6k|            tableDecode[u].nbAdditionalBits = nbAdditionalBits[symbol];
  600|  39.6k|            tableDecode[u].baseValue = baseValue[symbol];
  601|  39.6k|        }
  602|  1.23k|    }
  603|  1.23k|}
zstd_decompress_block.c:ZSTD_buildSeqTable:
  654|  12.7k|{
  655|  12.7k|    switch(type)
  656|  12.7k|    {
  657|    412|    case set_rle :
  ------------------
  |  Branch (657:5): [True: 412, False: 12.3k]
  ------------------
  658|    412|        RETURN_ERROR_IF(!srcSize, srcSize_wrong, "");
  ------------------
  |  |  114|    412|    do {                                                                       \
  |  |  115|    412|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 412]
  |  |  ------------------
  |  |  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|    412|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 412]
  |  |  ------------------
  ------------------
  659|    412|        RETURN_ERROR_IF((*(const BYTE*)src) > max, corruption_detected, "");
  ------------------
  |  |  114|    412|    do {                                                                       \
  |  |  115|    412|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 412]
  |  |  ------------------
  |  |  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|    412|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 412]
  |  |  ------------------
  ------------------
  660|    412|        {   U32 const symbol = *(const BYTE*)src;
  661|    412|            U32 const baseline = baseValue[symbol];
  662|    412|            U8 const nbBits = nbAdditionalBits[symbol];
  663|    412|            ZSTD_buildSeqTable_rle(DTableSpace, baseline, nbBits);
  664|    412|        }
  665|    412|        *DTablePtr = DTableSpace;
  666|    412|        return 1;
  667|  11.1k|    case set_basic :
  ------------------
  |  Branch (667:5): [True: 11.1k, False: 1.65k]
  ------------------
  668|  11.1k|        *DTablePtr = defaultTable;
  669|  11.1k|        return 0;
  670|      0|    case set_repeat:
  ------------------
  |  Branch (670:5): [True: 0, False: 12.7k]
  ------------------
  671|      0|        RETURN_ERROR_IF(!flagRepeatTable, 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]
  |  |  ------------------
  ------------------
  672|       |        /* prefetch FSE table if used */
  673|      0|        if (ddictIsCold && (nbSeq > 24 /* heuristic */)) {
  ------------------
  |  Branch (673:13): [True: 0, False: 0]
  |  Branch (673:28): [True: 0, False: 0]
  ------------------
  674|      0|            const void* const pStart = *DTablePtr;
  675|      0|            size_t const pSize = sizeof(ZSTD_seqSymbol) * (SEQSYMBOL_TABLE_SIZE(maxLog));
  ------------------
  |  |   74|      0| #define SEQSYMBOL_TABLE_SIZE(log)   (1 + (1 << (log)))
  ------------------
  676|      0|            PREFETCH_AREA(pStart, pSize);
  ------------------
  |  |  159|      0|    do {                                                 \
  |  |  160|      0|        const char* const _ptr = (const char*)(p);       \
  |  |  161|      0|        size_t const _size = (size_t)(s);                \
  |  |  162|      0|        size_t _pos;                                     \
  |  |  163|      0|        for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
  |  |  ------------------
  |  |  |  |  156|      0|#define CACHELINE_SIZE 64
  |  |  ------------------
  |  |  |  Branch (163:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  164|      0|            PREFETCH_L2(_ptr + _pos);                    \
  |  |  ------------------
  |  |  |  |  146|      0|#    define PREFETCH_L2(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
  |  |  ------------------
  |  |  165|      0|        }                                                \
  |  |  166|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (166:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  677|      0|        }
  678|      0|        return 0;
  679|  1.23k|    case set_compressed :
  ------------------
  |  Branch (679:5): [True: 1.23k, False: 11.5k]
  ------------------
  680|  1.23k|        {   unsigned tableLog;
  681|  1.23k|            S16 norm[MaxSeq+1];
  682|  1.23k|            size_t const headerSize = FSE_readNCount(norm, &max, &tableLog, src, srcSize);
  683|  1.23k|            RETURN_ERROR_IF(FSE_isError(headerSize), corruption_detected, "");
  ------------------
  |  |  114|  1.23k|    do {                                                                       \
  |  |  115|  1.23k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 1.23k]
  |  |  ------------------
  |  |  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|  1.23k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.23k]
  |  |  ------------------
  ------------------
  684|  1.23k|            RETURN_ERROR_IF(tableLog > maxLog, corruption_detected, "");
  ------------------
  |  |  114|  1.23k|    do {                                                                       \
  |  |  115|  1.23k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 1.23k]
  |  |  ------------------
  |  |  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|  1.23k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.23k]
  |  |  ------------------
  ------------------
  685|  1.23k|            ZSTD_buildFSETable(DTableSpace, norm, max, baseValue, nbAdditionalBits, tableLog, wksp, wkspSize, bmi2);
  686|  1.23k|            *DTablePtr = DTableSpace;
  687|  1.23k|            return headerSize;
  688|  1.23k|        }
  689|      0|    default :
  ------------------
  |  Branch (689:5): [True: 0, False: 12.7k]
  ------------------
  690|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  691|      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]
  |  |  ------------------
  ------------------
  692|  12.7k|    }
  693|  12.7k|}
zstd_decompress_block.c:ZSTD_buildSeqTable_rle:
  464|    412|{
  465|    412|    void* ptr = dt;
  466|    412|    ZSTD_seqSymbol_header* const DTableH = (ZSTD_seqSymbol_header*)ptr;
  467|    412|    ZSTD_seqSymbol* const cell = dt + 1;
  468|       |
  469|    412|    DTableH->tableLog = 0;
  470|    412|    DTableH->fastMode = 0;
  471|       |
  472|    412|    cell->nbBits = 0;
  473|    412|    cell->nextState = 0;
  474|    412|    assert(nbAddBits < 255);
  ------------------
  |  |   70|    412|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  475|    412|    cell->nbAdditionalBits = nbAddBits;
  476|    412|    cell->baseValue = baseValue;
  477|    412|}
zstd_decompress_block.c:ZSTD_blockSizeMax:
   55|  24.9k|{
   56|  24.9k|    size_t const blockSizeMax = dctx->isFrameDecompression ? dctx->fParams.blockSizeMax : ZSTD_BLOCKSIZE_MAX;
  ------------------
  |  |  148|  24.9k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|      0|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  |  Branch (56:33): [True: 24.9k, False: 0]
  ------------------
   57|  24.9k|    assert(blockSizeMax <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  24.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   58|  24.9k|    return blockSizeMax;
   59|  24.9k|}
zstd_decompress_block.c:ZSTD_totalHistorySize:
 1997|  4.99k|{
 1998|  4.99k|    return (size_t)(op - virtualStart);
 1999|  4.99k|}
zstd_decompress_block.c:ZSTD_initFseState:
 1193|  12.7k|{
 1194|  12.7k|    const void* ptr = dt;
 1195|  12.7k|    const ZSTD_seqSymbol_header* const DTableH = (const ZSTD_seqSymbol_header*)ptr;
 1196|  12.7k|    DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog);
 1197|  12.7k|    DEBUGLOG(6, "ZSTD_initFseState : val=%u using %u bits",
  ------------------
  |  |  104|  12.7k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 12.7k]
  |  |  ------------------
  ------------------
 1198|  12.7k|                (U32)DStatePtr->state, DTableH->tableLog);
 1199|  12.7k|    BIT_reloadDStream(bitD);
 1200|  12.7k|    DStatePtr->table = dt + 1;
 1201|  12.7k|}
zstd_decompress_block.c:ZSTD_decodeSequence:
 1230|  23.1k|{
 1231|  23.1k|    seq_t seq;
 1232|       |    /*
 1233|       |     * ZSTD_seqSymbol is a 64 bits wide structure.
 1234|       |     * It can be loaded in one operation
 1235|       |     * and its fields extracted by simply shifting or bit-extracting on aarch64.
 1236|       |     * GCC doesn't recognize this and generates more unnecessary ldr/ldrb/ldrh
 1237|       |     * operations that cause performance drop. This can be avoided by using this
 1238|       |     * ZSTD_memcpy hack.
 1239|       |     */
 1240|       |#if defined(__aarch64__) && (defined(__GNUC__) && !defined(__clang__))
 1241|       |    ZSTD_seqSymbol llDInfoS, mlDInfoS, ofDInfoS;
 1242|       |    ZSTD_seqSymbol* const llDInfo = &llDInfoS;
 1243|       |    ZSTD_seqSymbol* const mlDInfo = &mlDInfoS;
 1244|       |    ZSTD_seqSymbol* const ofDInfo = &ofDInfoS;
 1245|       |    ZSTD_memcpy(llDInfo, seqState->stateLL.table + seqState->stateLL.state, sizeof(ZSTD_seqSymbol));
 1246|       |    ZSTD_memcpy(mlDInfo, seqState->stateML.table + seqState->stateML.state, sizeof(ZSTD_seqSymbol));
 1247|       |    ZSTD_memcpy(ofDInfo, seqState->stateOffb.table + seqState->stateOffb.state, sizeof(ZSTD_seqSymbol));
 1248|       |#else
 1249|  23.1k|    const ZSTD_seqSymbol* const llDInfo = seqState->stateLL.table + seqState->stateLL.state;
 1250|  23.1k|    const ZSTD_seqSymbol* const mlDInfo = seqState->stateML.table + seqState->stateML.state;
 1251|  23.1k|    const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state;
 1252|  23.1k|#endif
 1253|  23.1k|    seq.matchLength = mlDInfo->baseValue;
 1254|  23.1k|    seq.litLength = llDInfo->baseValue;
 1255|  23.1k|    {   U32 const ofBase = ofDInfo->baseValue;
 1256|  23.1k|        BYTE const llBits = llDInfo->nbAdditionalBits;
 1257|  23.1k|        BYTE const mlBits = mlDInfo->nbAdditionalBits;
 1258|  23.1k|        BYTE const ofBits = ofDInfo->nbAdditionalBits;
 1259|  23.1k|        BYTE const totalBits = llBits+mlBits+ofBits;
 1260|       |
 1261|  23.1k|        U16 const llNext = llDInfo->nextState;
 1262|  23.1k|        U16 const mlNext = mlDInfo->nextState;
 1263|  23.1k|        U16 const ofNext = ofDInfo->nextState;
 1264|  23.1k|        U32 const llnbBits = llDInfo->nbBits;
 1265|  23.1k|        U32 const mlnbBits = mlDInfo->nbBits;
 1266|  23.1k|        U32 const ofnbBits = ofDInfo->nbBits;
 1267|       |
 1268|  23.1k|        assert(llBits <= MaxLLBits);
  ------------------
  |  |   70|  23.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1269|  23.1k|        assert(mlBits <= MaxMLBits);
  ------------------
  |  |   70|  23.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1270|  23.1k|        assert(ofBits <= MaxOff);
  ------------------
  |  |   70|  23.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1271|       |        /*
 1272|       |         * As gcc has better branch and block analyzers, sometimes it is only
 1273|       |         * valuable to mark likeliness for clang, it gives around 3-4% of
 1274|       |         * performance.
 1275|       |         */
 1276|       |
 1277|       |        /* sequence */
 1278|  23.1k|        {   size_t offset;
 1279|  23.1k|            if (ofBits > 1) {
  ------------------
  |  Branch (1279:17): [True: 9.54k, False: 13.6k]
  ------------------
 1280|  9.54k|                ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
  ------------------
  |  |   43|  9.54k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  9.54k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1281|  9.54k|                ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
  ------------------
  |  |   43|  9.54k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  9.54k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1282|  9.54k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32);
  ------------------
  |  |   43|  9.54k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  9.54k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1283|  9.54k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 - LONG_OFFSETS_MAX_EXTRA_BITS_32 >= MaxMLBits);
  ------------------
  |  |   43|  9.54k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  9.54k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1284|  9.54k|                if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) {
  ------------------
  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  ------------------
  |  Branch (1284:21): [True: 0, False: 9.54k]
  |  Branch (1284:37): [True: 0, False: 0]
  |  Branch (1284:52): [True: 0, False: 0]
  ------------------
 1285|       |                    /* Always read extra bits, this keeps the logic simple,
 1286|       |                     * avoids branches, and avoids accidentally reading 0 bits.
 1287|       |                     */
 1288|      0|                    U32 const extraBits = LONG_OFFSETS_MAX_EXTRA_BITS_32;
  ------------------
  |  | 1216|      0|    (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                   (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |  |  Branch (1216:6): [True: 0, Folded]
  |  |  ------------------
  |  | 1217|      0|        ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                       ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  | 1218|      0|        : 0)
  ------------------
 1289|      0|                    offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
 1290|      0|                    BIT_reloadDStream(&seqState->DStream);
 1291|      0|                    offset += BIT_readBitsFast(&seqState->DStream, extraBits);
 1292|  9.54k|                } else {
 1293|  9.54k|                    offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/);   /* <=  (ZSTD_WINDOWLOG_MAX-1) bits */
 1294|  9.54k|                    if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);
  ------------------
  |  Branch (1294:25): [True: 0, False: 9.54k]
  ------------------
 1295|  9.54k|                }
 1296|  9.54k|                seqState->prevOffset[2] = seqState->prevOffset[1];
 1297|  9.54k|                seqState->prevOffset[1] = seqState->prevOffset[0];
 1298|  9.54k|                seqState->prevOffset[0] = offset;
 1299|  13.6k|            } else {
 1300|  13.6k|                U32 const ll0 = (llDInfo->baseValue == 0);
 1301|  13.6k|                if (LIKELY((ofBits == 0))) {
  ------------------
  |  |  187|  13.6k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 11.0k, False: 2.64k]
  |  |  ------------------
  ------------------
 1302|  11.0k|                    offset = seqState->prevOffset[ll0];
 1303|  11.0k|                    seqState->prevOffset[1] = seqState->prevOffset[!ll0];
 1304|  11.0k|                    seqState->prevOffset[0] = offset;
 1305|  11.0k|                } else {
 1306|  2.64k|                    offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1);
 1307|  2.64k|                    {   size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset];
  ------------------
  |  Branch (1307:39): [True: 0, False: 2.64k]
  ------------------
 1308|  2.64k|                        temp -= !temp; /* 0 is not valid: input corrupted => force offset to -1 => corruption detected at execSequence */
 1309|  2.64k|                        if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1];
  ------------------
  |  Branch (1309:29): [True: 1.18k, False: 1.45k]
  ------------------
 1310|  2.64k|                        seqState->prevOffset[1] = seqState->prevOffset[0];
 1311|  2.64k|                        seqState->prevOffset[0] = offset = temp;
 1312|  2.64k|            }   }   }
 1313|  23.1k|            seq.offset = offset;
 1314|  23.1k|        }
 1315|       |
 1316|  23.1k|        if (mlBits > 0)
  ------------------
  |  Branch (1316:13): [True: 194, False: 22.9k]
  ------------------
 1317|    194|            seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/);
 1318|       |
 1319|  23.1k|        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))
  ------------------
  |  | 1216|      0|    (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                   (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |  |  Branch (1216:6): [True: 0, Folded]
  |  |  ------------------
  |  | 1217|      0|        ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  | 1263|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                       ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  | 1218|      0|        : 0)
  ------------------
  |  Branch (1319:13): [True: 0, False: 23.1k]
  |  Branch (1319:29): [True: 0, False: 0]
  ------------------
 1320|      0|            BIT_reloadDStream(&seqState->DStream);
 1321|  23.1k|        if (MEM_64bits() && UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
  ------------------
  |  |  188|  23.1k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 23.1k]
  |  |  ------------------
  ------------------
  |  Branch (1321:13): [True: 23.1k, False: 0]
  ------------------
 1322|      0|            BIT_reloadDStream(&seqState->DStream);
 1323|       |        /* Ensure there are enough bits to read the rest of data in 64-bit mode. */
 1324|  23.1k|        ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
  ------------------
  |  |   43|  23.1k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  23.1k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1325|       |
 1326|  23.1k|        if (llBits > 0)
  ------------------
  |  Branch (1326:13): [True: 4.53k, False: 18.6k]
  ------------------
 1327|  4.53k|            seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/);
 1328|       |
 1329|  23.1k|        if (MEM_32bits())
  ------------------
  |  Branch (1329:13): [True: 0, False: 23.1k]
  ------------------
 1330|      0|            BIT_reloadDStream(&seqState->DStream);
 1331|       |
 1332|  23.1k|        DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
  ------------------
  |  |  104|  23.1k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 23.1k]
  |  |  ------------------
  ------------------
 1333|  23.1k|                    (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
 1334|       |
 1335|  23.1k|        if (!isLastSeq) {
  ------------------
  |  Branch (1335:13): [True: 18.9k, False: 4.26k]
  ------------------
 1336|       |            /* don't update FSE state for last Sequence */
 1337|  18.9k|            ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llNext, llnbBits);    /* <=  9 bits */
 1338|  18.9k|            ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits);    /* <=  9 bits */
 1339|  18.9k|            if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);    /* <= 18 bits */
  ------------------
  |  Branch (1339:17): [True: 0, False: 18.9k]
  ------------------
 1340|  18.9k|            ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits);  /* <=  8 bits */
 1341|  18.9k|            BIT_reloadDStream(&seqState->DStream);
 1342|  18.9k|        }
 1343|  23.1k|    }
 1344|       |
 1345|  23.1k|    return seq;
 1346|  23.1k|}
zstd_decompress_block.c:ZSTD_updateFseStateWithDInfo:
 1205|  56.7k|{
 1206|  56.7k|    size_t const lowBits = BIT_readBits(bitD, nbBits);
 1207|  56.7k|    DStatePtr->state = nextState + lowBits;
 1208|  56.7k|}
zstd_decompress_block.c:ZSTD_execSequence:
 1005|  23.1k|{
 1006|  23.1k|    BYTE* const oLitEnd = op + sequence.litLength;
 1007|  23.1k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 1008|  23.1k|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 1009|  23.1k|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;   /* risk : address space underflow on oend=NULL */
  ------------------
  |  |  199|  23.1k|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1010|  23.1k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 1011|  23.1k|    const BYTE* match = oLitEnd - sequence.offset;
 1012|       |
 1013|  23.1k|    assert(op != NULL /* Precondition */);
  ------------------
  |  |   70|  23.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1014|  23.1k|    assert(oend_w < oend /* No underflow */);
  ------------------
  |  |   70|  23.1k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1015|       |
 1016|       |#if defined(__aarch64__)
 1017|       |    /* prefetch sequence starting from match that will be used for copy later */
 1018|       |    PREFETCH_L1(match);
 1019|       |#endif
 1020|       |    /* Handle edge cases in a slow path:
 1021|       |     *   - Read beyond end of literals
 1022|       |     *   - Match end is within WILDCOPY_OVERLIMIT of oend
 1023|       |     *   - 32-bit mode and the match length overflows
 1024|       |     */
 1025|  23.1k|    if (UNLIKELY(
  ------------------
  |  |  188|   103k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 6.38k, False: 16.7k]
  |  |  |  Branch (188:40): [True: 0, False: 23.1k]
  |  |  |  Branch (188:40): [True: 6.38k, False: 16.7k]
  |  |  |  Branch (188:40): [True: 0, False: 16.7k]
  |  |  |  Branch (188:40): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1026|  23.1k|        iLitEnd > litLimit ||
 1027|  23.1k|        oMatchEnd > oend_w ||
 1028|  23.1k|        (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH)))
 1029|  6.38k|        return ZSTD_execSequenceEnd(op, oend, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd);
 1030|       |
 1031|       |    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */
 1032|  16.7k|    assert(op <= oLitEnd /* No overflow */);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1033|  16.7k|    assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1034|  16.7k|    assert(oMatchEnd <= oend /* No underflow */);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1035|  16.7k|    assert(iLitEnd <= litLimit /* Literal length is in bounds */);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1036|  16.7k|    assert(oLitEnd <= oend_w /* Can wildcopy literals */);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1037|  16.7k|    assert(oMatchEnd <= oend_w /* Can wildcopy matches */);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1038|       |
 1039|       |    /* Copy Literals:
 1040|       |     * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9.
 1041|       |     * We likely don't need the full 32-byte wildcopy.
 1042|       |     */
 1043|  16.7k|    assert(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1044|  16.7k|    ZSTD_copy16(op, (*litPtr));
 1045|  16.7k|    if (UNLIKELY(sequence.litLength > 16)) {
  ------------------
  |  |  188|  16.7k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 3.13k, False: 13.6k]
  |  |  ------------------
  ------------------
 1046|  3.13k|        ZSTD_wildcopy(op + 16, (*litPtr) + 16, sequence.litLength - 16, ZSTD_no_overlap);
 1047|  3.13k|    }
 1048|  16.7k|    op = oLitEnd;
 1049|  16.7k|    *litPtr = iLitEnd;   /* update for next sequence */
 1050|       |
 1051|       |    /* Copy Match */
 1052|  16.7k|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (1052:9): [True: 0, False: 16.7k]
  ------------------
 1053|       |        /* offset beyond prefix -> go into extDict */
 1054|      0|        RETURN_ERROR_IF(UNLIKELY(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]
  |  |  ------------------
  ------------------
 1055|      0|        match = dictEnd + (match - prefixStart);
 1056|      0|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (1056:13): [True: 0, False: 0]
  ------------------
 1057|      0|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|      0|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1058|      0|            return sequenceLength;
 1059|      0|        }
 1060|       |        /* span extDict & currentPrefixSegment */
 1061|      0|        {   size_t const length1 = dictEnd - match;
 1062|      0|        ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|      0|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1063|      0|        op = oLitEnd + length1;
 1064|      0|        sequence.matchLength -= length1;
 1065|      0|        match = prefixStart;
 1066|      0|        }
 1067|      0|    }
 1068|       |    /* Match within prefix of 1 or more bytes */
 1069|  16.7k|    assert(op <= oMatchEnd);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1070|  16.7k|    assert(oMatchEnd <= oend_w);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1071|  16.7k|    assert(match >= prefixStart);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1072|  16.7k|    assert(sequence.matchLength >= 1);
  ------------------
  |  |   70|  16.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1073|       |
 1074|       |    /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy
 1075|       |     * without overlap checking.
 1076|       |     */
 1077|  16.7k|    if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) {
  ------------------
  |  |  187|  16.7k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (187:19): [True: 7.29k, False: 9.50k]
  |  |  ------------------
  ------------------
 1078|       |        /* We bet on a full wildcopy for matches, since we expect matches to be
 1079|       |         * longer than literals (in general). In silesia, ~10% of matches are longer
 1080|       |         * than 16 bytes.
 1081|       |         */
 1082|  7.29k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength, ZSTD_no_overlap);
 1083|  7.29k|        return sequenceLength;
 1084|  7.29k|    }
 1085|  9.50k|    assert(sequence.offset < WILDCOPY_VECLEN);
  ------------------
  |  |   70|  9.50k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1086|       |
 1087|       |    /* Copy 8 bytes and spread the offset to be >= 8. */
 1088|  9.50k|    ZSTD_overlapCopy8(&op, &match, sequence.offset);
 1089|       |
 1090|       |    /* If the match length is > 8 bytes, then continue with the wildcopy. */
 1091|  9.50k|    if (sequence.matchLength > 8) {
  ------------------
  |  Branch (1091:9): [True: 3.00k, False: 6.50k]
  ------------------
 1092|  3.00k|        assert(op < oMatchEnd);
  ------------------
  |  |   70|  3.00k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1093|  3.00k|        ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength - 8, ZSTD_overlap_src_before_dst);
 1094|  3.00k|    }
 1095|  9.50k|    return sequenceLength;
 1096|  16.7k|}
zstd_decompress_block.c:ZSTD_execSequenceEnd:
  911|  6.38k|{
  912|  6.38k|    BYTE* const oLitEnd = op + sequence.litLength;
  913|  6.38k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
  914|  6.38k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
  915|  6.38k|    const BYTE* match = oLitEnd - sequence.offset;
  916|  6.38k|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  199|  6.38k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  917|       |
  918|       |    /* bounds checks : careful of address space overflow in 32-bit mode */
  919|  6.38k|    RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer");
  ------------------
  |  |  114|  6.38k|    do {                                                                       \
  |  |  115|  6.38k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 6.38k]
  |  |  ------------------
  |  |  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|  6.38k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 6.38k]
  |  |  ------------------
  ------------------
  920|  6.38k|    RETURN_ERROR_IF(sequence.litLength > (size_t)(litLimit - *litPtr), corruption_detected, "try to read beyond literal buffer");
  ------------------
  |  |  114|  6.38k|    do {                                                                       \
  |  |  115|  6.38k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 6.38k]
  |  |  ------------------
  |  |  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|  6.38k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 6.38k]
  |  |  ------------------
  ------------------
  921|  6.38k|    assert(op < op + sequenceLength);
  ------------------
  |  |   70|  6.38k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  922|  6.38k|    assert(oLitEnd < op + sequenceLength);
  ------------------
  |  |   70|  6.38k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  923|       |
  924|       |    /* copy literals */
  925|  6.38k|    ZSTD_safecopy(op, oend_w, *litPtr, sequence.litLength, ZSTD_no_overlap);
  926|  6.38k|    op = oLitEnd;
  927|  6.38k|    *litPtr = iLitEnd;
  928|       |
  929|       |    /* copy Match */
  930|  6.38k|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (930:9): [True: 0, False: 6.38k]
  ------------------
  931|       |        /* offset beyond prefix */
  932|      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]
  |  |  ------------------
  ------------------
  933|      0|        match = dictEnd - (prefixStart - match);
  934|      0|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (934:13): [True: 0, False: 0]
  ------------------
  935|      0|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|      0|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  936|      0|            return sequenceLength;
  937|      0|        }
  938|       |        /* span extDict & currentPrefixSegment */
  939|      0|        {   size_t const length1 = dictEnd - match;
  940|      0|        ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|      0|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  941|      0|        op = oLitEnd + length1;
  942|      0|        sequence.matchLength -= length1;
  943|      0|        match = prefixStart;
  944|      0|        }
  945|      0|    }
  946|  6.38k|    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst);
  947|  6.38k|    return sequenceLength;
  948|  6.38k|}
zstd_decompress_block.c:ZSTD_safecopy:
  837|  12.7k|static void ZSTD_safecopy(BYTE* op, const BYTE* const oend_w, BYTE const* ip, ptrdiff_t length, ZSTD_overlap_e ovtype) {
  838|  12.7k|    ptrdiff_t const diff = op - ip;
  839|  12.7k|    BYTE* const oend = op + length;
  840|       |
  841|  12.7k|    assert((ovtype == ZSTD_no_overlap && (diff <= -8 || diff >= 8 || op >= oend_w)) ||
  ------------------
  |  |   70|  12.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  842|  12.7k|           (ovtype == ZSTD_overlap_src_before_dst && diff >= 0));
  843|       |
  844|  12.7k|    if (length < 8) {
  ------------------
  |  Branch (844:9): [True: 6.99k, False: 5.78k]
  ------------------
  845|       |        /* Handle short lengths. */
  846|  30.3k|        while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (846:16): [True: 23.3k, False: 6.99k]
  ------------------
  847|  6.99k|        return;
  848|  6.99k|    }
  849|  5.78k|    if (ovtype == ZSTD_overlap_src_before_dst) {
  ------------------
  |  Branch (849:9): [True: 3.59k, False: 2.18k]
  ------------------
  850|       |        /* Copy 8 bytes and ensure the offset >= 8 when there can be overlap. */
  851|  3.59k|        assert(length >= 8);
  ------------------
  |  |   70|  3.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  852|  3.59k|        ZSTD_overlapCopy8(&op, &ip, diff);
  853|  3.59k|        length -= 8;
  854|  3.59k|        assert(op - ip >= 8);
  ------------------
  |  |   70|  3.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  855|  3.59k|        assert(op <= oend);
  ------------------
  |  |   70|  3.59k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  856|  3.59k|    }
  857|       |
  858|  5.78k|    if (oend <= oend_w) {
  ------------------
  |  Branch (858:9): [True: 454, False: 5.32k]
  ------------------
  859|       |        /* No risk of overwrite. */
  860|    454|        ZSTD_wildcopy(op, ip, length, ovtype);
  861|    454|        return;
  862|    454|    }
  863|  5.32k|    if (op <= oend_w) {
  ------------------
  |  Branch (863:9): [True: 1.68k, False: 3.64k]
  ------------------
  864|       |        /* Wildcopy until we get close to the end. */
  865|  1.68k|        assert(oend > oend_w);
  ------------------
  |  |   70|  1.68k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  866|  1.68k|        ZSTD_wildcopy(op, ip, oend_w - op, ovtype);
  867|  1.68k|        ip += oend_w - op;
  868|  1.68k|        op += oend_w - op;
  869|  1.68k|    }
  870|       |    /* Handle the leftovers. */
  871|  48.1k|    while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (871:12): [True: 42.8k, False: 5.32k]
  ------------------
  872|  5.32k|}
zstd_decompress_block.c:ZSTD_overlapCopy8:
  804|  13.0k|HINT_INLINE void ZSTD_overlapCopy8(BYTE** op, BYTE const** ip, size_t offset) {
  805|  13.0k|    assert(*ip <= *op);
  ------------------
  |  |   70|  13.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  806|  13.0k|    if (offset < 8) {
  ------------------
  |  Branch (806:9): [True: 9.77k, False: 3.32k]
  ------------------
  807|       |        /* close range match, overlap */
  808|  9.77k|        static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */
  809|  9.77k|        static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
  810|  9.77k|        int const sub2 = dec64table[offset];
  811|  9.77k|        (*op)[0] = (*ip)[0];
  812|  9.77k|        (*op)[1] = (*ip)[1];
  813|  9.77k|        (*op)[2] = (*ip)[2];
  814|  9.77k|        (*op)[3] = (*ip)[3];
  815|  9.77k|        *ip += dec32table[offset];
  816|  9.77k|        ZSTD_copy4(*op+4, *ip);
  817|  9.77k|        *ip -= sub2;
  818|  9.77k|    } else {
  819|  3.32k|        ZSTD_copy8(*op, *ip);
  820|  3.32k|    }
  821|  13.0k|    *ip += 8;
  822|  13.0k|    *op += 8;
  823|  13.0k|    assert(*op - *ip >= 8);
  ------------------
  |  |   70|  13.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  824|  13.0k|}
zstd_decompress_block.c:ZSTD_copy4:
   47|  9.77k|static void ZSTD_copy4(void* dst, const void* src) { ZSTD_memcpy(dst, src, 4); }
  ------------------
  |  |   44|  9.77k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
zstd_decompress_block.c:ZSTD_decompressSequences:
 1943|  4.99k|{
 1944|  4.99k|    DEBUGLOG(5, "ZSTD_decompressSequences");
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1945|  4.99k|#if DYNAMIC_BMI2
 1946|  4.99k|    if (ZSTD_DCtx_get_bmi2(dctx)) {
  ------------------
  |  Branch (1946:9): [True: 4.99k, False: 0]
  ------------------
 1947|  4.99k|        return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1948|  4.99k|    }
 1949|      0|#endif
 1950|      0|    return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1951|  4.99k|}
zstd_decompress_block.c:ZSTD_decompressSequences_bmi2:
 1911|  4.99k|{
 1912|  4.99k|    return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 1913|  4.99k|}
zstd_decompress_block.c:ZSTD_decompressSequences_body:
 1619|  4.99k|{
 1620|  4.99k|    const BYTE* ip = (const BYTE*)seqStart;
 1621|  4.99k|    const BYTE* const iend = ip + seqSize;
 1622|  4.99k|    BYTE* const ostart = (BYTE*)dst;
 1623|  4.99k|    BYTE* const oend = dctx->litBufferLocation == ZSTD_not_in_dst ? ZSTD_maybeNullPtrAdd(ostart, maxDstSize) : dctx->litBuffer;
  ------------------
  |  Branch (1623:24): [True: 4.99k, False: 0]
  ------------------
 1624|  4.99k|    BYTE* op = ostart;
 1625|  4.99k|    const BYTE* litPtr = dctx->litPtr;
 1626|  4.99k|    const BYTE* const litEnd = litPtr + dctx->litSize;
 1627|  4.99k|    const BYTE* const prefixStart = (const BYTE*)(dctx->prefixStart);
 1628|  4.99k|    const BYTE* const vBase = (const BYTE*)(dctx->virtualStart);
 1629|  4.99k|    const BYTE* const dictEnd = (const BYTE*)(dctx->dictEnd);
 1630|  4.99k|    DEBUGLOG(5, "ZSTD_decompressSequences_body: nbSeq = %d", nbSeq);
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1631|       |
 1632|       |    /* Regen sequences */
 1633|  4.99k|    if (nbSeq) {
  ------------------
  |  Branch (1633:9): [True: 4.26k, False: 732]
  ------------------
 1634|  4.26k|        seqState_t seqState;
 1635|  4.26k|        dctx->fseEntropy = 1;
 1636|  17.0k|        { U32 i; for (i = 0; i < ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  17.0k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1636:30): [True: 12.7k, False: 4.26k]
  ------------------
 1637|  4.26k|        RETURN_ERROR_IF(
  ------------------
  |  |  114|  4.26k|    do {                                                                       \
  |  |  115|  4.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |  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.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
 1638|  4.26k|            ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend - ip)),
 1639|  4.26k|            corruption_detected, "");
 1640|  4.26k|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1641|  4.26k|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1642|  4.26k|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1643|  4.26k|        assert(dst != NULL);
  ------------------
  |  |   70|  4.26k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1644|       |
 1645|  4.26k|#if defined(__GNUC__) && defined(__x86_64__)
 1646|  4.26k|            __asm__(".p2align 6");
 1647|  4.26k|            __asm__("nop");
 1648|       |#  if __GNUC__ >= 7
 1649|       |            __asm__(".p2align 5");
 1650|       |            __asm__("nop");
 1651|       |            __asm__(".p2align 3");
 1652|       |#  else
 1653|  4.26k|            __asm__(".p2align 4");
 1654|  4.26k|            __asm__("nop");
 1655|  4.26k|            __asm__(".p2align 3");
 1656|  4.26k|#  endif
 1657|  4.26k|#endif
 1658|       |
 1659|  27.4k|        for ( ; nbSeq ; nbSeq--) {
  ------------------
  |  Branch (1659:17): [True: 23.1k, False: 4.26k]
  ------------------
 1660|  23.1k|            seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1661|  23.1k|            size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litEnd, prefixStart, vBase, dictEnd);
 1662|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1663|       |            assert(!ZSTD_isError(oneSeqSize));
 1664|       |            ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1665|       |#endif
 1666|  23.1k|            if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  188|  23.1k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (188:21): [True: 0, False: 23.1k]
  |  |  ------------------
  ------------------
 1667|      0|                return oneSeqSize;
 1668|  23.1k|            DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|  23.1k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 23.1k]
  |  |  ------------------
  ------------------
 1669|  23.1k|            op += oneSeqSize;
 1670|  23.1k|        }
 1671|       |
 1672|       |        /* check if reached exact end */
 1673|  4.26k|        assert(nbSeq == 0);
  ------------------
  |  |   70|  4.26k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1674|  4.26k|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|  4.26k|    do {                                                                       \
  |  |  115|  4.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.26k]
  |  |  ------------------
  |  |  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.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
 1675|       |        /* save reps for next block */
 1676|  17.0k|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|  17.0k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1676:28): [True: 12.7k, False: 4.26k]
  ------------------
 1677|  4.26k|    }
 1678|       |
 1679|       |    /* last literal segment */
 1680|  4.99k|    {   size_t const lastLLSize = (size_t)(litEnd - litPtr);
 1681|  4.99k|        DEBUGLOG(6, "copy last literals : %u", (U32)lastLLSize);
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1682|  4.99k|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|  4.99k|    do {                                                                       \
  |  |  115|  4.99k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 4.99k]
  |  |  ------------------
  |  |  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.99k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1683|  4.99k|        if (op != NULL) {
  ------------------
  |  Branch (1683:13): [True: 4.99k, False: 0]
  ------------------
 1684|  4.99k|            ZSTD_memcpy(op, litPtr, lastLLSize);
  ------------------
  |  |   44|  4.99k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1685|  4.99k|            op += lastLLSize;
 1686|  4.99k|    }   }
 1687|       |
 1688|  4.99k|    DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart));
  ------------------
  |  |  104|  4.99k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 4.99k]
  |  |  ------------------
  ------------------
 1689|  4.99k|    return (size_t)(op - ostart);
 1690|  4.99k|}

zstd_decompress_block.c:ZSTD_DCtx_get_bmi2:
  213|  21.3k|MEM_STATIC int ZSTD_DCtx_get_bmi2(const struct ZSTD_DCtx_s *dctx) {
  214|  21.3k|#if DYNAMIC_BMI2
  215|  21.3k|    return dctx->bmi2;
  216|       |#else
  217|       |    (void)dctx;
  218|       |    return 0;
  219|       |#endif
  220|  21.3k|}

zstd_decompress.c:ZSTD_isLegacy:
   57|  5.09k|{
   58|  5.09k|    U32 magicNumberLE;
   59|  5.09k|    if (srcSize<4) return 0;
  ------------------
  |  Branch (59:9): [True: 0, False: 5.09k]
  ------------------
   60|  5.09k|    magicNumberLE = MEM_readLE32(src);
   61|  5.09k|    switch(magicNumberLE)
   62|  5.09k|    {
   63|       |#if (ZSTD_LEGACY_SUPPORT <= 1)
   64|       |        case ZSTDv01_magicNumberLE:return 1;
   65|       |#endif
   66|       |#if (ZSTD_LEGACY_SUPPORT <= 2)
   67|       |        case ZSTDv02_magicNumber : return 2;
   68|       |#endif
   69|       |#if (ZSTD_LEGACY_SUPPORT <= 3)
   70|       |        case ZSTDv03_magicNumber : return 3;
   71|       |#endif
   72|       |#if (ZSTD_LEGACY_SUPPORT <= 4)
   73|       |        case ZSTDv04_magicNumber : return 4;
   74|       |#endif
   75|      0|#if (ZSTD_LEGACY_SUPPORT <= 5)
   76|     16|        case ZSTDv05_MAGICNUMBER : return 5;
  ------------------
  |  |  153|     16|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
  |  Branch (76:9): [True: 16, False: 5.07k]
  ------------------
   77|      0|#endif
   78|      0|#if (ZSTD_LEGACY_SUPPORT <= 6)
   79|     36|        case ZSTDv06_MAGICNUMBER : return 6;
  ------------------
  |  |  164|     36|#define ZSTDv06_MAGICNUMBER 0xFD2FB526   /* v0.6 */
  ------------------
  |  Branch (79:9): [True: 36, False: 5.05k]
  ------------------
   80|      0|#endif
   81|      0|#if (ZSTD_LEGACY_SUPPORT <= 7)
   82|     37|        case ZSTDv07_MAGICNUMBER : return 7;
  ------------------
  |  |  180|     37|#define ZSTDv07_MAGICNUMBER            0xFD2FB527   /* v0.7 */
  ------------------
  |  Branch (82:9): [True: 37, False: 5.05k]
  ------------------
   83|      0|#endif
   84|  5.00k|        default : return 0;
  ------------------
  |  Branch (84:9): [True: 5.00k, False: 89]
  ------------------
   85|  5.09k|    }
   86|  5.09k|}
zstd_decompress.c:ZSTD_getDecompressedSize_legacy:
   90|      9|{
   91|      9|    U32 const version = ZSTD_isLegacy(src, srcSize);
   92|      9|    if (version < 5) return 0;  /* no decompressed size in frame header, or not a legacy format */
  ------------------
  |  Branch (92:9): [True: 0, False: 9]
  ------------------
   93|      9|#if (ZSTD_LEGACY_SUPPORT <= 5)
   94|      9|    if (version==5) {
  ------------------
  |  Branch (94:9): [True: 1, False: 8]
  ------------------
   95|      1|        ZSTDv05_parameters fParams;
   96|      1|        size_t const frResult = ZSTDv05_getFrameParams(&fParams, src, srcSize);
   97|      1|        if (frResult != 0) return 0;
  ------------------
  |  Branch (97:13): [True: 0, False: 1]
  ------------------
   98|      1|        return fParams.srcSize;
   99|      1|    }
  100|      8|#endif
  101|      8|#if (ZSTD_LEGACY_SUPPORT <= 6)
  102|      8|    if (version==6) {
  ------------------
  |  Branch (102:9): [True: 5, False: 3]
  ------------------
  103|      5|        ZSTDv06_frameParams fParams;
  104|      5|        size_t const frResult = ZSTDv06_getFrameParams(&fParams, src, srcSize);
  105|      5|        if (frResult != 0) return 0;
  ------------------
  |  Branch (105:13): [True: 0, False: 5]
  ------------------
  106|      5|        return fParams.frameContentSize;
  107|      5|    }
  108|      3|#endif
  109|      3|#if (ZSTD_LEGACY_SUPPORT <= 7)
  110|      3|    if (version==7) {
  ------------------
  |  Branch (110:9): [True: 3, False: 0]
  ------------------
  111|      3|        ZSTDv07_frameParams fParams;
  112|      3|        size_t const frResult = ZSTDv07_getFrameParams(&fParams, src, srcSize);
  113|      3|        if (frResult != 0) return 0;
  ------------------
  |  Branch (113:13): [True: 0, False: 3]
  ------------------
  114|      3|        return fParams.frameContentSize;
  115|      3|    }
  116|      0|#endif
  117|      0|    return 0;   /* should not be possible */
  118|      3|}
zstd_decompress.c:ZSTD_findFrameSizeInfoLegacy:
  196|     25|{
  197|     25|    ZSTD_frameSizeInfo frameSizeInfo;
  198|     25|    U32 const version = ZSTD_isLegacy(src, srcSize);
  199|     25|    switch(version)
  200|     25|    {
  201|       |#if (ZSTD_LEGACY_SUPPORT <= 1)
  202|       |        case 1 :
  203|       |            ZSTDv01_findFrameSizeInfoLegacy(src, srcSize,
  204|       |                &frameSizeInfo.compressedSize,
  205|       |                &frameSizeInfo.decompressedBound);
  206|       |            break;
  207|       |#endif
  208|       |#if (ZSTD_LEGACY_SUPPORT <= 2)
  209|       |        case 2 :
  210|       |            ZSTDv02_findFrameSizeInfoLegacy(src, srcSize,
  211|       |                &frameSizeInfo.compressedSize,
  212|       |                &frameSizeInfo.decompressedBound);
  213|       |            break;
  214|       |#endif
  215|       |#if (ZSTD_LEGACY_SUPPORT <= 3)
  216|       |        case 3 :
  217|       |            ZSTDv03_findFrameSizeInfoLegacy(src, srcSize,
  218|       |                &frameSizeInfo.compressedSize,
  219|       |                &frameSizeInfo.decompressedBound);
  220|       |            break;
  221|       |#endif
  222|       |#if (ZSTD_LEGACY_SUPPORT <= 4)
  223|       |        case 4 :
  224|       |            ZSTDv04_findFrameSizeInfoLegacy(src, srcSize,
  225|       |                &frameSizeInfo.compressedSize,
  226|       |                &frameSizeInfo.decompressedBound);
  227|       |            break;
  228|       |#endif
  229|      0|#if (ZSTD_LEGACY_SUPPORT <= 5)
  230|      5|        case 5 :
  ------------------
  |  Branch (230:9): [True: 5, False: 20]
  ------------------
  231|      5|            ZSTDv05_findFrameSizeInfoLegacy(src, srcSize,
  232|      5|                &frameSizeInfo.compressedSize,
  233|      5|                &frameSizeInfo.decompressedBound);
  234|      5|            break;
  235|      0|#endif
  236|      0|#if (ZSTD_LEGACY_SUPPORT <= 6)
  237|      9|        case 6 :
  ------------------
  |  Branch (237:9): [True: 9, False: 16]
  ------------------
  238|      9|            ZSTDv06_findFrameSizeInfoLegacy(src, srcSize,
  239|      9|                &frameSizeInfo.compressedSize,
  240|      9|                &frameSizeInfo.decompressedBound);
  241|      9|            break;
  242|      0|#endif
  243|      0|#if (ZSTD_LEGACY_SUPPORT <= 7)
  244|     11|        case 7 :
  ------------------
  |  Branch (244:9): [True: 11, False: 14]
  ------------------
  245|     11|            ZSTDv07_findFrameSizeInfoLegacy(src, srcSize,
  246|     11|                &frameSizeInfo.compressedSize,
  247|     11|                &frameSizeInfo.decompressedBound);
  248|     11|            break;
  249|      0|#endif
  250|      0|        default :
  ------------------
  |  Branch (250:9): [True: 0, False: 25]
  ------------------
  251|      0|            frameSizeInfo.compressedSize = ERROR(prefix_unknown);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  252|      0|            frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  |  204|      0|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
  253|      0|            break;
  254|     25|    }
  255|     25|    if (!ZSTD_isError(frameSizeInfo.compressedSize) && frameSizeInfo.compressedSize > srcSize) {
  ------------------
  |  |   44|     25|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (255:9): [True: 21, False: 4]
  |  Branch (255:56): [True: 0, False: 21]
  ------------------
  256|      0|        frameSizeInfo.compressedSize = 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  257|      0|        frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  |  204|      0|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
  258|      0|    }
  259|       |    /* In all cases, decompressedBound == nbBlocks * ZSTD_BLOCKSIZE_MAX.
  260|       |     * So we can compute nbBlocks without having to change every function.
  261|       |     */
  262|     25|    if (frameSizeInfo.decompressedBound != ZSTD_CONTENTSIZE_ERROR) {
  ------------------
  |  |  204|     25|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
  |  Branch (262:9): [True: 21, False: 4]
  ------------------
  263|     21|        assert((frameSizeInfo.decompressedBound & (ZSTD_BLOCKSIZE_MAX - 1)) == 0);
  ------------------
  |  |   70|     21|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  264|     21|        frameSizeInfo.nbBlocks = (size_t)(frameSizeInfo.decompressedBound / ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |  148|     21|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|     21|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  265|     21|    }
  266|     25|    return frameSizeInfo;
  267|     25|}
zstd_decompress.c:ZSTD_findFrameCompressedSizeLegacy:
  270|     25|{
  271|     25|    ZSTD_frameSizeInfo frameSizeInfo = ZSTD_findFrameSizeInfoLegacy(src, srcSize);
  272|     25|    return frameSizeInfo.compressedSize;
  273|     25|}
zstd_decompress.c:ZSTD_decompressLegacy:
  125|     21|{
  126|     21|    U32 const version = ZSTD_isLegacy(src, compressedSize);
  127|     21|    char x;
  128|       |    /* Avoid passing NULL to legacy decoding. */
  129|     21|    if (dst == NULL) {
  ------------------
  |  Branch (129:9): [True: 0, False: 21]
  ------------------
  130|      0|        assert(dstCapacity == 0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  131|      0|        dst = &x;
  132|      0|    }
  133|     21|    if (src == NULL) {
  ------------------
  |  Branch (133:9): [True: 0, False: 21]
  ------------------
  134|      0|        assert(compressedSize == 0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  135|      0|        src = &x;
  136|      0|    }
  137|     21|    if (dict == NULL) {
  ------------------
  |  Branch (137:9): [True: 21, False: 0]
  ------------------
  138|     21|        assert(dictSize == 0);
  ------------------
  |  |   70|     21|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  139|     21|        dict = &x;
  140|     21|    }
  141|     21|    (void)dst; (void)dstCapacity; (void)dict; (void)dictSize;  /* unused when ZSTD_LEGACY_SUPPORT >= 8 */
  142|     21|    switch(version)
  143|     21|    {
  144|       |#if (ZSTD_LEGACY_SUPPORT <= 1)
  145|       |        case 1 :
  146|       |            return ZSTDv01_decompress(dst, dstCapacity, src, compressedSize);
  147|       |#endif
  148|       |#if (ZSTD_LEGACY_SUPPORT <= 2)
  149|       |        case 2 :
  150|       |            return ZSTDv02_decompress(dst, dstCapacity, src, compressedSize);
  151|       |#endif
  152|       |#if (ZSTD_LEGACY_SUPPORT <= 3)
  153|       |        case 3 :
  154|       |            return ZSTDv03_decompress(dst, dstCapacity, src, compressedSize);
  155|       |#endif
  156|       |#if (ZSTD_LEGACY_SUPPORT <= 4)
  157|       |        case 4 :
  158|       |            return ZSTDv04_decompress(dst, dstCapacity, src, compressedSize);
  159|       |#endif
  160|      0|#if (ZSTD_LEGACY_SUPPORT <= 5)
  161|      4|        case 5 :
  ------------------
  |  Branch (161:9): [True: 4, False: 17]
  ------------------
  162|      4|            {   size_t result;
  163|      4|                ZSTDv05_DCtx* const zd = ZSTDv05_createDCtx();
  164|      4|                if (zd==NULL) 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 (164:21): [True: 0, False: 4]
  ------------------
  165|      4|                result = ZSTDv05_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize);
  166|      4|                ZSTDv05_freeDCtx(zd);
  167|      4|                return result;
  168|      4|            }
  169|      0|#endif
  170|      0|#if (ZSTD_LEGACY_SUPPORT <= 6)
  171|      8|        case 6 :
  ------------------
  |  Branch (171:9): [True: 8, False: 13]
  ------------------
  172|      8|            {   size_t result;
  173|      8|                ZSTDv06_DCtx* const zd = ZSTDv06_createDCtx();
  174|      8|                if (zd==NULL) 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 (174:21): [True: 0, False: 8]
  ------------------
  175|      8|                result = ZSTDv06_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize);
  176|      8|                ZSTDv06_freeDCtx(zd);
  177|      8|                return result;
  178|      8|            }
  179|      0|#endif
  180|      0|#if (ZSTD_LEGACY_SUPPORT <= 7)
  181|      9|        case 7 :
  ------------------
  |  Branch (181:9): [True: 9, False: 12]
  ------------------
  182|      9|            {   size_t result;
  183|      9|                ZSTDv07_DCtx* const zd = ZSTDv07_createDCtx();
  184|      9|                if (zd==NULL) 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 (184:21): [True: 0, False: 9]
  ------------------
  185|      9|                result = ZSTDv07_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize);
  186|      9|                ZSTDv07_freeDCtx(zd);
  187|      9|                return result;
  188|      9|            }
  189|      0|#endif
  190|      0|        default :
  ------------------
  |  Branch (190:9): [True: 0, False: 21]
  ------------------
  191|      0|            return ERROR(prefix_unknown);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  192|     21|    }
  193|     21|}

HUFv05_isError:
 1723|      7|unsigned HUFv05_isError(size_t code) { return ERR_isError(code); }
HUFv05_readDTableX2:
 1818|      2|{
 1819|      2|    BYTE huffWeight[HUFv05_MAX_SYMBOL_VALUE + 1];
 1820|      2|    U32 rankVal[HUFv05_ABSOLUTEMAX_TABLELOG + 1];   /* large enough for values from 0 to 16 */
 1821|      2|    U32 tableLog = 0;
 1822|      2|    size_t iSize;
 1823|      2|    U32 nbSymbols = 0;
 1824|      2|    U32 n;
 1825|      2|    U32 nextRankStart;
 1826|      2|    void* const dtPtr = DTable + 1;
 1827|      2|    HUFv05_DEltX2* const dt = (HUFv05_DEltX2*)dtPtr;
 1828|       |
 1829|      2|    HUFv05_STATIC_ASSERT(sizeof(HUFv05_DEltX2) == sizeof(U16));   /* if compilation fails here, assertion is false */
  ------------------
  |  | 1725|      2|#define HUFv05_STATIC_ASSERT(c) { enum { HUFv05_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 1830|       |    /* memset(huffWeight, 0, sizeof(huffWeight)); */   /* is not necessary, even though some analyzer complain ... */
 1831|       |
 1832|      2|    iSize = HUFv05_readStats(huffWeight, HUFv05_MAX_SYMBOL_VALUE + 1, rankVal, &nbSymbols, &tableLog, src, srcSize);
  ------------------
  |  | 1714|      2|#define HUFv05_MAX_SYMBOL_VALUE 255
  ------------------
 1833|      2|    if (HUFv05_isError(iSize)) return iSize;
  ------------------
  |  Branch (1833:9): [True: 0, False: 2]
  ------------------
 1834|       |
 1835|       |    /* check result */
 1836|      2|    if (tableLog > DTable[0]) return ERROR(tableLog_tooLarge);   /* DTable is too small */
  ------------------
  |  |   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 (1836:9): [True: 0, False: 2]
  ------------------
 1837|      2|    DTable[0] = (U16)tableLog;   /* maybe should separate sizeof allocated DTable, from used size of DTable, in case of re-use */
 1838|       |
 1839|       |    /* Prepare ranks */
 1840|      2|    nextRankStart = 0;
 1841|     11|    for (n=1; n<=tableLog; n++) {
  ------------------
  |  Branch (1841:15): [True: 9, False: 2]
  ------------------
 1842|      9|        U32 current = nextRankStart;
 1843|      9|        nextRankStart += (rankVal[n] << (n-1));
 1844|      9|        rankVal[n] = current;
 1845|      9|    }
 1846|       |
 1847|       |    /* fill DTable */
 1848|     70|    for (n=0; n<nbSymbols; n++) {
  ------------------
  |  Branch (1848:15): [True: 68, False: 2]
  ------------------
 1849|     68|        const U32 w = huffWeight[n];
 1850|     68|        const U32 length = (1 << w) >> 1;
 1851|     68|        U32 i;
 1852|     68|        HUFv05_DEltX2 D;
 1853|     68|        D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w);
 1854|    200|        for (i = rankVal[w]; i < rankVal[w] + length; i++)
  ------------------
  |  Branch (1854:30): [True: 132, False: 68]
  ------------------
 1855|    132|            dt[i] = D;
 1856|     68|        rankVal[w] += length;
 1857|     68|    }
 1858|       |
 1859|      2|    return iSize;
 1860|      2|}
HUFv05_decompress1X2_usingDTable:
 1908|      1|{
 1909|      1|    BYTE* op = (BYTE*)dst;
 1910|      1|    BYTE* const oend = op + dstSize;
 1911|      1|    const U32 dtLog = DTable[0];
 1912|      1|    const void* dtPtr = DTable;
 1913|      1|    const HUFv05_DEltX2* const dt = ((const HUFv05_DEltX2*)dtPtr)+1;
 1914|      1|    BITv05_DStream_t bitD;
 1915|       |
 1916|      1|    if (dstSize <= cSrcSize) 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 (1916:9): [True: 0, False: 1]
  ------------------
 1917|      1|    { size_t const errorCode = BITv05_initDStream(&bitD, cSrc, cSrcSize);
 1918|      1|      if (HUFv05_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (1918:11): [True: 0, False: 1]
  ------------------
 1919|       |
 1920|      1|    HUFv05_decodeStreamX2(op, &bitD, oend, dt, dtLog);
 1921|       |
 1922|       |    /* check */
 1923|      1|    if (!BITv05_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 (1923:9): [True: 0, False: 1]
  ------------------
 1924|       |
 1925|      1|    return dstSize;
 1926|      1|}
HUFv05_decompress1X2:
 1929|      1|{
 1930|      1|    HUFv05_CREATE_STATIC_DTABLEX2(DTable, HUFv05_MAX_TABLELOG);
  ------------------
  |  | 1604|      1|        unsigned short DTable[HUFv05_DTABLE_SIZE(maxTableLog)] = { maxTableLog }
  ------------------
 1931|      1|    const BYTE* ip = (const BYTE*) cSrc;
 1932|      1|    size_t errorCode;
 1933|       |
 1934|      1|    errorCode = HUFv05_readDTableX2 (DTable, cSrc, cSrcSize);
 1935|      1|    if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1935:9): [True: 0, False: 1]
  ------------------
 1936|      1|    if (errorCode >= 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 (1936:9): [True: 0, False: 1]
  ------------------
 1937|      1|    ip += errorCode;
 1938|      1|    cSrcSize -= errorCode;
 1939|       |
 1940|      1|    return HUFv05_decompress1X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable);
 1941|      1|}
HUFv05_decompress4X2_usingDTable:
 1948|      1|{
 1949|       |    /* Check */
 1950|      1|    if (cSrcSize < 10) return ERROR(corruption_detected);   /* strict minimum : jump table + 1 byte per stream */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1950:9): [True: 1, False: 0]
  ------------------
 1951|      0|    {
 1952|      0|        const BYTE* const istart = (const BYTE*) cSrc;
 1953|      0|        BYTE* const ostart = (BYTE*) dst;
 1954|      0|        BYTE* const oend = ostart + dstSize;
 1955|      0|        const void* const dtPtr = DTable;
 1956|      0|        const HUFv05_DEltX2* const dt = ((const HUFv05_DEltX2*)dtPtr) +1;
 1957|      0|        const U32 dtLog = DTable[0];
 1958|      0|        size_t errorCode;
 1959|       |
 1960|       |        /* Init */
 1961|      0|        BITv05_DStream_t bitD1;
 1962|      0|        BITv05_DStream_t bitD2;
 1963|      0|        BITv05_DStream_t bitD3;
 1964|      0|        BITv05_DStream_t bitD4;
 1965|      0|        const size_t length1 = MEM_readLE16(istart);
 1966|      0|        const size_t length2 = MEM_readLE16(istart+2);
 1967|      0|        const size_t length3 = MEM_readLE16(istart+4);
 1968|      0|        size_t length4;
 1969|      0|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
 1970|      0|        const BYTE* const istart2 = istart1 + length1;
 1971|      0|        const BYTE* const istart3 = istart2 + length2;
 1972|      0|        const BYTE* const istart4 = istart3 + length3;
 1973|      0|        const size_t segmentSize = (dstSize+3) / 4;
 1974|      0|        BYTE* const opStart2 = ostart + segmentSize;
 1975|      0|        BYTE* const opStart3 = opStart2 + segmentSize;
 1976|      0|        BYTE* const opStart4 = opStart3 + segmentSize;
 1977|      0|        BYTE* op1 = ostart;
 1978|      0|        BYTE* op2 = opStart2;
 1979|      0|        BYTE* op3 = opStart3;
 1980|      0|        BYTE* op4 = opStart4;
 1981|      0|        U32 endSignal;
 1982|       |
 1983|      0|        length4 = cSrcSize - (length1 + length2 + length3 + 6);
 1984|      0|        if (length4 > cSrcSize) return ERROR(corruption_detected);   /* 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1984:13): [True: 0, False: 0]
  ------------------
 1985|      0|        errorCode = BITv05_initDStream(&bitD1, istart1, length1);
 1986|      0|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1986:13): [True: 0, False: 0]
  ------------------
 1987|      0|        errorCode = BITv05_initDStream(&bitD2, istart2, length2);
 1988|      0|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1988:13): [True: 0, False: 0]
  ------------------
 1989|      0|        errorCode = BITv05_initDStream(&bitD3, istart3, length3);
 1990|      0|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1990:13): [True: 0, False: 0]
  ------------------
 1991|      0|        errorCode = BITv05_initDStream(&bitD4, istart4, length4);
 1992|      0|        if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (1992:13): [True: 0, False: 0]
  ------------------
 1993|       |
 1994|       |        /* 16-32 symbols per loop (4-8 symbols per stream) */
 1995|      0|        endSignal = BITv05_reloadDStream(&bitD1) | BITv05_reloadDStream(&bitD2) | BITv05_reloadDStream(&bitD3) | BITv05_reloadDStream(&bitD4);
 1996|      0|        for ( ; (endSignal==BITv05_DStream_unfinished) && (op4<(oend-7)) ; ) {
  ------------------
  |  Branch (1996:17): [True: 0, False: 0]
  |  Branch (1996:59): [True: 0, False: 0]
  ------------------
 1997|      0|            HUFv05_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1998|      0|            HUFv05_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1999|      0|            HUFv05_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2000|      0|            HUFv05_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2001|      0|            HUFv05_DECODE_SYMBOLX2_1(op1, &bitD1);
  ------------------
  |  | 1874|      0|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 0, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2002|      0|            HUFv05_DECODE_SYMBOLX2_1(op2, &bitD2);
  ------------------
  |  | 1874|      0|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 0, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2003|      0|            HUFv05_DECODE_SYMBOLX2_1(op3, &bitD3);
  ------------------
  |  | 1874|      0|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 0, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2004|      0|            HUFv05_DECODE_SYMBOLX2_1(op4, &bitD4);
  ------------------
  |  | 1874|      0|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 0, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2005|      0|            HUFv05_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2006|      0|            HUFv05_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2007|      0|            HUFv05_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2008|      0|            HUFv05_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2009|      0|            HUFv05_DECODE_SYMBOLX2_0(op1, &bitD1);
  ------------------
  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2010|      0|            HUFv05_DECODE_SYMBOLX2_0(op2, &bitD2);
  ------------------
  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2011|      0|            HUFv05_DECODE_SYMBOLX2_0(op3, &bitD3);
  ------------------
  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2012|      0|            HUFv05_DECODE_SYMBOLX2_0(op4, &bitD4);
  ------------------
  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2013|      0|            endSignal = BITv05_reloadDStream(&bitD1) | BITv05_reloadDStream(&bitD2) | BITv05_reloadDStream(&bitD3) | BITv05_reloadDStream(&bitD4);
 2014|      0|        }
 2015|       |
 2016|       |        /* check corruption */
 2017|      0|        if (op1 > opStart2) 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 (2017:13): [True: 0, False: 0]
  ------------------
 2018|      0|        if (op2 > opStart3) 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 (2018:13): [True: 0, False: 0]
  ------------------
 2019|      0|        if (op3 > opStart4) 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 (2019:13): [True: 0, False: 0]
  ------------------
 2020|       |        /* note : op4 supposed already verified within main loop */
 2021|       |
 2022|       |        /* finish bitStreams one by one */
 2023|      0|        HUFv05_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog);
 2024|      0|        HUFv05_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog);
 2025|      0|        HUFv05_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog);
 2026|      0|        HUFv05_decodeStreamX2(op4, &bitD4, oend,     dt, dtLog);
 2027|       |
 2028|       |        /* check */
 2029|      0|        endSignal = BITv05_endOfDStream(&bitD1) & BITv05_endOfDStream(&bitD2) & BITv05_endOfDStream(&bitD3) & BITv05_endOfDStream(&bitD4);
 2030|      0|        if (!endSignal) 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 (2030:13): [True: 0, False: 0]
  ------------------
 2031|       |
 2032|       |        /* decoded size */
 2033|      0|        return dstSize;
 2034|      0|    }
 2035|      0|}
HUFv05_decompress4X2:
 2039|      1|{
 2040|      1|    HUFv05_CREATE_STATIC_DTABLEX2(DTable, HUFv05_MAX_TABLELOG);
  ------------------
  |  | 1604|      1|        unsigned short DTable[HUFv05_DTABLE_SIZE(maxTableLog)] = { maxTableLog }
  ------------------
 2041|      1|    const BYTE* ip = (const BYTE*) cSrc;
 2042|      1|    size_t errorCode;
 2043|       |
 2044|      1|    errorCode = HUFv05_readDTableX2 (DTable, cSrc, cSrcSize);
 2045|      1|    if (HUFv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2045:9): [True: 0, False: 1]
  ------------------
 2046|      1|    if (errorCode >= 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 (2046:9): [True: 0, False: 1]
  ------------------
 2047|      1|    ip += errorCode;
 2048|      1|    cSrcSize -= errorCode;
 2049|       |
 2050|      1|    return HUFv05_decompress4X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable);
 2051|      1|}
HUFv05_decompress:
 2465|      1|{
 2466|      1|    static const decompressionAlgo decompress[3] = { HUFv05_decompress4X2, HUFv05_decompress4X4, NULL };
 2467|       |    /* estimate decompression time */
 2468|      1|    U32 Q;
 2469|      1|    const U32 D256 = (U32)(dstSize >> 8);
 2470|      1|    U32 Dtime[3];
 2471|      1|    U32 algoNb = 0;
 2472|      1|    int n;
 2473|       |
 2474|       |    /* validation checks */
 2475|      1|    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 (2475:9): [True: 0, False: 1]
  ------------------
 2476|      1|    if (cSrcSize >= dstSize) return ERROR(corruption_detected);   /* invalid, or not compressed, but not compressed already dealt with */
  ------------------
  |  |   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 (2476:9): [True: 0, False: 1]
  ------------------
 2477|      1|    if (cSrcSize == 1) { memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; }   /* RLE */
  ------------------
  |  Branch (2477:9): [True: 0, False: 1]
  ------------------
 2478|       |
 2479|       |    /* decoder timing evaluation */
 2480|      1|    Q = (U32)(cSrcSize * 16 / dstSize);   /* Q < 16 since dstSize > cSrcSize */
 2481|      4|    for (n=0; n<3; n++)
  ------------------
  |  Branch (2481:15): [True: 3, False: 1]
  ------------------
 2482|      3|        Dtime[n] = algoTime[Q][n].tableTime + (algoTime[Q][n].decode256Time * D256);
 2483|       |
 2484|      1|    Dtime[1] += Dtime[1] >> 4; Dtime[2] += Dtime[2] >> 3; /* advantage to algorithms using less memory, for cache eviction */
 2485|       |
 2486|      1|    if (Dtime[1] < Dtime[0]) algoNb = 1;
  ------------------
  |  Branch (2486:9): [True: 0, False: 1]
  ------------------
 2487|       |
 2488|      1|    return decompress[algoNb](dst, dstSize, cSrc, cSrcSize);
 2489|       |
 2490|       |    /* return HUFv05_decompress4X2(dst, dstSize, cSrc, cSrcSize); */   /* multi-streams single-symbol decoding */
 2491|       |    /* return HUFv05_decompress4X4(dst, dstSize, cSrc, cSrcSize); */   /* multi-streams double-symbols decoding */
 2492|       |    /* return HUFv05_decompress4X6(dst, dstSize, cSrc, cSrcSize); */   /* multi-streams quad-symbols decoding */
 2493|      1|}
ZSTDv05_isError:
 2577|     37|unsigned ZSTDv05_isError(size_t code) { return ERR_isError(code); }
ZSTDv05_decompressBegin:
 2617|      8|{
 2618|      8|    dctx->expected = ZSTDv05_frameHeaderSize_min;
 2619|      8|    dctx->stage = ZSTDv05ds_getFrameHeaderSize;
 2620|      8|    dctx->previousDstEnd = NULL;
 2621|      8|    dctx->base = NULL;
 2622|      8|    dctx->vBase = NULL;
 2623|      8|    dctx->dictEnd = NULL;
 2624|      8|    dctx->hufTableX4[0] = ZSTD_HUFFDTABLE_CAPACITY_LOG;
  ------------------
  |  |  436|      8|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 2625|      8|    dctx->flagStaticTables = 0;
 2626|      8|    return 0;
 2627|      8|}
ZSTDv05_createDCtx:
 2630|      4|{
 2631|      4|    ZSTDv05_DCtx* dctx = (ZSTDv05_DCtx*)malloc(sizeof(ZSTDv05_DCtx));
 2632|      4|    if (dctx==NULL) return NULL;
  ------------------
  |  Branch (2632:9): [True: 0, False: 4]
  ------------------
 2633|      4|    ZSTDv05_decompressBegin(dctx);
 2634|      4|    return dctx;
 2635|      4|}
ZSTDv05_freeDCtx:
 2638|      4|{
 2639|      4|    free(dctx);
 2640|      4|    return 0;   /* reserved as a potential error code in the future */
 2641|      4|}
ZSTDv05_getFrameParams:
 2752|      5|{
 2753|      5|    U32 magicNumber;
 2754|      5|    if (srcSize < ZSTDv05_frameHeaderSize_min) return ZSTDv05_frameHeaderSize_max;
  ------------------
  |  |  400|      0|#define ZSTDv05_frameHeaderSize_max 5         /* define, for static allocation */
  ------------------
  |  Branch (2754:9): [True: 0, False: 5]
  ------------------
 2755|      5|    magicNumber = MEM_readLE32(src);
 2756|      5|    if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |  153|      5|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
                  if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |   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 (2756:9): [True: 0, False: 5]
  ------------------
 2757|      5|    memset(params, 0, sizeof(*params));
 2758|      5|    params->windowLog = (((const BYTE*)src)[4] & 15) + ZSTDv05_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  |  256|      5|#define ZSTDv05_WINDOWLOG_ABSOLUTEMIN 11
  ------------------
 2759|      5|    if ((((const BYTE*)src)[4] >> 4) != 0) return ERROR(frameParameter_unsupported);   /* reserved bits */
  ------------------
  |  |   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 (2759:9): [True: 0, False: 5]
  ------------------
 2760|      5|    return 0;
 2761|      5|}
ZSTDv05_decompress_usingDict:
 3449|      4|{
 3450|      4|    ZSTDv05_decompressBegin_usingDict(dctx, dict, dictSize);
 3451|      4|    ZSTDv05_checkContinuity(dctx, dst);
 3452|      4|    return ZSTDv05_decompress_continueDCtx(dctx, dst, maxDstSize, src, srcSize);
 3453|      4|}
ZSTDv05_findFrameSizeInfoLegacy:
 3485|      5|{
 3486|      5|    const BYTE* ip = (const BYTE*)src;
 3487|      5|    size_t remainingSize = srcSize;
 3488|      5|    size_t nbBlocks = 0;
 3489|      5|    blockProperties_t blockProperties;
 3490|       |
 3491|       |    /* Frame Header */
 3492|      5|    if (srcSize < ZSTDv05_frameHeaderSize_min) {
  ------------------
  |  Branch (3492:9): [True: 0, False: 5]
  ------------------
 3493|      0|        ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3494|      0|        return;
 3495|      0|    }
 3496|      5|    if (MEM_readLE32(src) != ZSTDv05_MAGICNUMBER) {
  ------------------
  |  |  153|      5|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
  |  Branch (3496:9): [True: 0, False: 5]
  ------------------
 3497|      0|        ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(prefix_unknown));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3498|      0|        return;
 3499|      0|    }
 3500|      5|    ip += ZSTDv05_frameHeaderSize_min; remainingSize -= ZSTDv05_frameHeaderSize_min;
 3501|       |
 3502|       |    /* Loop on each block */
 3503|     10|    while (1)
  ------------------
  |  Branch (3503:12): [True: 10, Folded]
  ------------------
 3504|     10|    {
 3505|     10|        size_t cBlockSize = ZSTDv05_getcBlockSize(ip, remainingSize, &blockProperties);
 3506|     10|        if (ZSTDv05_isError(cBlockSize)) {
  ------------------
  |  Branch (3506:13): [True: 0, False: 10]
  ------------------
 3507|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, cBlockSize);
 3508|      0|            return;
 3509|      0|        }
 3510|       |
 3511|     10|        ip += ZSTDv05_blockHeaderSize;
 3512|     10|        remainingSize -= ZSTDv05_blockHeaderSize;
 3513|     10|        if (cBlockSize > remainingSize) {
  ------------------
  |  Branch (3513:13): [True: 1, False: 9]
  ------------------
 3514|      1|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3515|      1|            return;
 3516|      1|        }
 3517|       |
 3518|      9|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3518:13): [True: 4, False: 5]
  ------------------
 3519|       |
 3520|      5|        ip += cBlockSize;
 3521|      5|        remainingSize -= cBlockSize;
 3522|      5|        nbBlocks++;
 3523|      5|    }
 3524|       |
 3525|      4|    *cSize = ip - (const BYTE*)src;
 3526|      4|    *dBound = nbBlocks * BLOCKSIZE;
  ------------------
  |  |  396|      4|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|      4|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
 3527|      4|}
ZSTDv05_decompressBegin_usingDict:
 3687|      4|{
 3688|      4|    size_t errorCode;
 3689|      4|    errorCode = ZSTDv05_decompressBegin(dctx);
 3690|      4|    if (ZSTDv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (3690:9): [True: 0, False: 4]
  ------------------
 3691|       |
 3692|      4|    if (dict && dictSize) {
  ------------------
  |  Branch (3692:9): [True: 4, False: 0]
  |  Branch (3692:17): [True: 0, False: 4]
  ------------------
 3693|      0|        errorCode = ZSTDv05_decompress_insertDictionary(dctx, dict, dictSize);
 3694|      0|        if (ZSTDv05_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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 (3694:13): [True: 0, False: 0]
  ------------------
 3695|      0|    }
 3696|       |
 3697|      4|    return 0;
 3698|      4|}
zstd_v05.c:BITv05_highbit32:
  702|      7|{
  703|       |#   if defined(_MSC_VER)   /* Visual */
  704|       |    unsigned long r;
  705|       |    return _BitScanReverse(&r, val) ? (unsigned)r : 0;
  706|       |#   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */
  707|       |    return __builtin_clz (val) ^ 31;
  708|       |#   else   /* Software version */
  709|       |    static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };
  710|       |    U32 v = val;
  711|       |    unsigned r;
  712|       |    v |= v >> 1;
  713|       |    v |= v >> 2;
  714|       |    v |= v >> 4;
  715|       |    v |= v >> 8;
  716|       |    v |= v >> 16;
  717|       |    r = DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27];
  718|       |    return r;
  719|       |#   endif
  720|      7|}
zstd_v05.c:BITv05_skipBits:
  785|      4|{
  786|      4|    bitD->bitsConsumed += nbBits;
  787|      4|}
zstd_v05.c:BITv05_lookBitsFast:
  779|      4|{
  780|      4|    const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1;
  781|      4|    return (bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> (((bitMask+1)-nbBits) & bitMask);
  782|      4|}
zstd_v05.c:HUFv05_readStats:
 1745|      2|{
 1746|      2|    U32 weightTotal;
 1747|      2|    U32 tableLog;
 1748|      2|    const BYTE* ip = (const BYTE*) src;
 1749|      2|    size_t iSize;
 1750|      2|    size_t oSize;
 1751|      2|    U32 n;
 1752|       |
 1753|      2|    if (!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 (1753:9): [True: 0, False: 2]
  ------------------
 1754|      2|    iSize = ip[0];
 1755|       |    /* memset(huffWeight, 0, hwSize); */   /* is not necessary, even though some analyzer complain ... */
 1756|       |
 1757|      2|    if (iSize >= 128)  { /* special header */
  ------------------
  |  Branch (1757:9): [True: 2, False: 0]
  ------------------
 1758|      2|        if (iSize >= (242)) {  /* RLE */
  ------------------
  |  Branch (1758:13): [True: 2, False: 0]
  ------------------
 1759|      2|            static int l[14] = { 1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64, 127, 128 };
 1760|      2|            oSize = l[iSize-242];
 1761|      2|            memset(huffWeight, 1, hwSize);
 1762|      2|            iSize = 0;
 1763|      2|        }
 1764|      0|        else {   /* Incompressible */
 1765|      0|            oSize = iSize - 127;
 1766|      0|            iSize = ((oSize+1)/2);
 1767|      0|            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 (1767:17): [True: 0, False: 0]
  ------------------
 1768|      0|            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 (1768:17): [True: 0, False: 0]
  ------------------
 1769|      0|            ip += 1;
 1770|      0|            for (n=0; n<oSize; n+=2) {
  ------------------
  |  Branch (1770:23): [True: 0, False: 0]
  ------------------
 1771|      0|                huffWeight[n]   = ip[n/2] >> 4;
 1772|      0|                huffWeight[n+1] = ip[n/2] & 15;
 1773|      0|    }   }   }
 1774|      0|    else  {   /* header compressed with FSEv05 (normal case) */
 1775|      0|        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 (1775:13): [True: 0, False: 0]
  ------------------
 1776|      0|        oSize = FSEv05_decompress(huffWeight, hwSize-1, ip+1, iSize);   /* max (hwSize-1) values decoded, as last one is implied */
 1777|      0|        if (FSEv05_isError(oSize)) return oSize;
  ------------------
  |  Branch (1777:13): [True: 0, False: 0]
  ------------------
 1778|      0|    }
 1779|       |
 1780|       |    /* collect weight stats */
 1781|      2|    memset(rankStats, 0, (HUFv05_ABSOLUTEMAX_TABLELOG + 1) * sizeof(U32));
  ------------------
  |  | 1711|      2|#define HUFv05_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv05_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
 1782|      2|    weightTotal = 0;
 1783|     68|    for (n=0; n<oSize; n++) {
  ------------------
  |  Branch (1783:15): [True: 66, False: 2]
  ------------------
 1784|     66|        if (huffWeight[n] >= HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1711|     66|#define HUFv05_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv05_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                      if (huffWeight[n] >= HUFv05_ABSOLUTEMAX_TABLELOG) 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 (1784:13): [True: 0, False: 66]
  ------------------
 1785|     66|        rankStats[huffWeight[n]]++;
 1786|     66|        weightTotal += (1 << huffWeight[n]) >> 1;
 1787|     66|    }
 1788|      2|    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 (1788:9): [True: 0, False: 2]
  ------------------
 1789|       |
 1790|       |    /* get last non-null symbol weight (implied, total must be 2^n) */
 1791|      2|    tableLog = BITv05_highbit32(weightTotal) + 1;
 1792|      2|    if (tableLog > HUFv05_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1711|      2|#define HUFv05_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv05_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                  if (tableLog > HUFv05_ABSOLUTEMAX_TABLELOG) 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 (1792:9): [True: 0, False: 2]
  ------------------
 1793|      2|    {   /* determine last weight */
 1794|      2|        U32 total = 1 << tableLog;
 1795|      2|        U32 rest = total - weightTotal;
 1796|      2|        U32 verif = 1 << BITv05_highbit32(rest);
 1797|      2|        U32 lastWeight = BITv05_highbit32(rest) + 1;
 1798|      2|        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 (1798:13): [True: 0, False: 2]
  ------------------
 1799|      2|        huffWeight[oSize] = (BYTE)lastWeight;
 1800|      2|        rankStats[lastWeight]++;
 1801|      2|    }
 1802|       |
 1803|       |    /* check tree construction validity */
 1804|      2|    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 (1804:9): [True: 0, False: 2]
  |  Branch (1804:31): [True: 0, False: 2]
  ------------------
 1805|       |
 1806|       |    /* results */
 1807|      2|    *nbSymbolsPtr = (U32)(oSize+1);
 1808|      2|    *tableLogPtr = tableLog;
 1809|      2|    return iSize+1;
 1810|      2|}
zstd_v05.c:BITv05_initDStream:
  735|      1|{
  736|      1|    if (srcSize < 1) { 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 (736:9): [True: 0, False: 1]
  ------------------
  737|       |
  738|      1|    if (srcSize >=  sizeof(size_t)) {  /* normal case */
  ------------------
  |  Branch (738:9): [True: 0, False: 1]
  ------------------
  739|      0|        U32 contain32;
  740|      0|        bitD->start = (const char*)srcBuffer;
  741|      0|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(size_t);
  742|      0|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  743|      0|        contain32 = ((const BYTE*)srcBuffer)[srcSize-1];
  744|      0|        if (contain32 == 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 (744:13): [True: 0, False: 0]
  ------------------
  745|      0|        bitD->bitsConsumed = 8 - BITv05_highbit32(contain32);
  746|      1|    } else {
  747|      1|        U32 contain32;
  748|      1|        bitD->start = (const char*)srcBuffer;
  749|      1|        bitD->ptr   = bitD->start;
  750|      1|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  751|      1|        switch(srcSize)
  752|      1|        {
  753|      0|            case 7: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[6]) << (sizeof(size_t)*8 - 16);/* fall-through */
  ------------------
  |  Branch (753:13): [True: 0, False: 1]
  ------------------
  754|      0|            case 6: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[5]) << (sizeof(size_t)*8 - 24);/* fall-through */
  ------------------
  |  Branch (754:13): [True: 0, False: 1]
  ------------------
  755|      0|            case 5: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[4]) << (sizeof(size_t)*8 - 32);/* fall-through */
  ------------------
  |  Branch (755:13): [True: 0, False: 1]
  ------------------
  756|      0|            case 4: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[3]) << 24; /* fall-through */
  ------------------
  |  Branch (756:13): [True: 0, False: 1]
  ------------------
  757|      0|            case 3: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[2]) << 16; /* fall-through */
  ------------------
  |  Branch (757:13): [True: 0, False: 1]
  ------------------
  758|      0|            case 2: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[1]) <<  8; /* fall-through */
  ------------------
  |  Branch (758:13): [True: 0, False: 1]
  ------------------
  759|      1|            default: break;
  ------------------
  |  Branch (759:13): [True: 1, False: 0]
  ------------------
  760|      1|        }
  761|      1|        contain32 = ((const BYTE*)srcBuffer)[srcSize-1];
  762|      1|        if (contain32 == 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 (762:13): [True: 0, False: 1]
  ------------------
  763|      1|        bitD->bitsConsumed = 8 - BITv05_highbit32(contain32);
  764|      1|        bitD->bitsConsumed += (U32)(sizeof(size_t) - srcSize)*8;
  765|      1|    }
  766|       |
  767|      1|    return srcSize;
  768|      1|}
zstd_v05.c:HUFv05_decodeStreamX2:
 1882|      1|{
 1883|      1|    BYTE* const pStart = p;
 1884|       |
 1885|       |    /* up to 4 symbols at a time */
 1886|      1|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p <= pEnd-4)) {
  ------------------
  |  Branch (1886:12): [True: 0, False: 1]
  |  Branch (1886:76): [True: 0, False: 0]
  ------------------
 1887|      0|        HUFv05_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1888|      0|        HUFv05_DECODE_SYMBOLX2_1(p, bitDPtr);
  ------------------
  |  | 1874|      0|    if (MEM_64bits() || (HUFv05_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1712|      0|#define HUFv05_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv05_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (1874:9): [True: 0, False: 0]
  |  |  |  Branch (1874:25): [True: 0, Folded]
  |  |  ------------------
  |  | 1875|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1889|      0|        HUFv05_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1878|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (1878:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1879|      0|        HUFv05_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 1890|      0|        HUFv05_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1891|      0|    }
 1892|       |
 1893|       |    /* closer to the end */
 1894|      1|    while ((BITv05_reloadDStream(bitDPtr) == BITv05_DStream_unfinished) && (p < pEnd))
  ------------------
  |  Branch (1894:12): [True: 0, False: 1]
  |  Branch (1894:76): [True: 0, False: 0]
  ------------------
 1895|      0|        HUFv05_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1871|      0|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1896|       |
 1897|       |    /* no more data to retrieve from bitstream, hence no need to reload */
 1898|      5|    while (p < pEnd)
  ------------------
  |  Branch (1898:12): [True: 4, False: 1]
  ------------------
 1899|      4|        HUFv05_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1871|      4|    *ptr++ = HUFv05_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 1900|       |
 1901|      1|    return pEnd-pStart;
 1902|      1|}
zstd_v05.c:BITv05_endOfDStream:
  838|      1|{
  839|      1|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (839:13): [True: 1, False: 0]
  |  Branch (839:49): [True: 1, False: 0]
  ------------------
  840|      1|}
zstd_v05.c:BITv05_reloadDStream:
  806|      2|{
  807|      2|    if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))  /* should never happen */
  ------------------
  |  Branch (807:9): [True: 0, False: 2]
  ------------------
  808|      0|        return BITv05_DStream_overflow;
  809|       |
  810|      2|    if (bitD->ptr >= bitD->start + sizeof(bitD->bitContainer)) {
  ------------------
  |  Branch (810:9): [True: 0, False: 2]
  ------------------
  811|      0|        bitD->ptr -= bitD->bitsConsumed >> 3;
  812|      0|        bitD->bitsConsumed &= 7;
  813|      0|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  814|      0|        return BITv05_DStream_unfinished;
  815|      0|    }
  816|      2|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (816:9): [True: 2, False: 0]
  ------------------
  817|      2|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BITv05_DStream_endOfBuffer;
  ------------------
  |  Branch (817:13): [True: 2, False: 0]
  ------------------
  818|      0|        return BITv05_DStream_completed;
  819|      2|    }
  820|      0|    {
  821|      0|        U32 nbBytes = bitD->bitsConsumed >> 3;
  822|      0|        BITv05_DStream_status result = BITv05_DStream_unfinished;
  823|      0|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (823:13): [True: 0, False: 0]
  ------------------
  824|      0|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  825|      0|            result = BITv05_DStream_endOfBuffer;
  826|      0|        }
  827|      0|        bitD->ptr -= nbBytes;
  828|      0|        bitD->bitsConsumed -= nbBytes*8;
  829|      0|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD) */
  830|      0|        return result;
  831|      2|    }
  832|      2|}
zstd_v05.c:HUFv05_decodeSymbolX2:
 1863|      4|{
 1864|      4|        const size_t val = BITv05_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
 1865|      4|        const BYTE c = dt[val].byte;
 1866|      4|        BITv05_skipBits(Dstream, dt[val].nbBits);
 1867|      4|        return c;
 1868|      4|}
zstd_v05.c:ZSTDv05_checkContinuity:
 3330|      4|{
 3331|      4|    if (dst != dctx->previousDstEnd) {   /* not contiguous */
  ------------------
  |  Branch (3331:9): [True: 4, False: 0]
  ------------------
 3332|      4|        dctx->dictEnd = dctx->previousDstEnd;
 3333|      4|        dctx->vBase = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3334|      4|        dctx->base = dst;
 3335|      4|        dctx->previousDstEnd = dst;
 3336|      4|    }
 3337|      4|}
zstd_v05.c:ZSTDv05_decompressBlock_internal:
 3343|      4|{   /* blockType == blockCompressed */
 3344|      4|    const BYTE* ip = (const BYTE*)src;
 3345|      4|    size_t litCSize;
 3346|       |
 3347|      4|    if (srcSize >= BLOCKSIZE) return ERROR(srcSize_wrong);
  ------------------
  |  |  396|      4|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|      4|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
                  if (srcSize >= BLOCKSIZE) 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 (3347:9): [True: 0, False: 4]
  ------------------
 3348|       |
 3349|       |    /* Decode literals sub-block */
 3350|      4|    litCSize = ZSTDv05_decodeLiteralsBlock(dctx, src, srcSize);
 3351|      4|    if (ZSTDv05_isError(litCSize)) return litCSize;
  ------------------
  |  Branch (3351:9): [True: 2, False: 2]
  ------------------
 3352|      2|    ip += litCSize;
 3353|      2|    srcSize -= litCSize;
 3354|       |
 3355|      2|    return ZSTDv05_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 3356|      4|}
zstd_v05.c:ZSTDv05_decodeLiteralsBlock:
 2812|      4|{
 2813|      4|    const BYTE* const istart = (const BYTE*) src;
 2814|       |
 2815|       |    /* any compressed block with literals segment must be at least this size */
 2816|      4|    if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |  439|      4|#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */)   /* for a non-null block */
  |  |  ------------------
  |  |  |  |  438|      4|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  |  |  ------------------
  ------------------
                  if (srcSize < MIN_CBLOCK_SIZE) 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 (2816:9): [True: 0, False: 4]
  ------------------
 2817|       |
 2818|      4|    switch(istart[0]>> 6)
 2819|      4|    {
 2820|      3|    case IS_HUFv05:
  ------------------
  |  |  409|      3|#define IS_HUFv05 0
  ------------------
  |  Branch (2820:5): [True: 3, False: 1]
  ------------------
 2821|      3|        {
 2822|      3|            size_t litSize, litCSize, singleStream=0;
 2823|      3|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2824|      3|            if (srcSize < 5) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
  ------------------
  |  |   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 (2824:17): [True: 0, False: 3]
  ------------------
 2825|      3|            switch(lhSize)
 2826|      3|            {
 2827|      2|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (2827:13): [True: 1, False: 2]
  |  Branch (2827:21): [True: 1, False: 2]
  |  Branch (2827:29): [True: 0, False: 3]
  ------------------
 2828|       |                /* 2 - 2 - 10 - 10 */
 2829|      2|                lhSize=3;
 2830|      2|                singleStream = istart[0] & 16;
 2831|      2|                litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 2832|      2|                litCSize = ((istart[1] &  3) << 8) + istart[2];
 2833|      2|                break;
 2834|      0|            case 2:
  ------------------
  |  Branch (2834:13): [True: 0, False: 3]
  ------------------
 2835|       |                /* 2 - 2 - 14 - 14 */
 2836|      0|                lhSize=4;
 2837|      0|                litSize  = ((istart[0] & 15) << 10) + (istart[1] << 2) + (istart[2] >> 6);
 2838|      0|                litCSize = ((istart[2] & 63) <<  8) + istart[3];
 2839|      0|                break;
 2840|      1|            case 3:
  ------------------
  |  Branch (2840:13): [True: 1, False: 2]
  ------------------
 2841|       |                /* 2 - 2 - 18 - 18 */
 2842|      1|                lhSize=5;
 2843|      1|                litSize  = ((istart[0] & 15) << 14) + (istart[1] << 6) + (istart[2] >> 2);
 2844|      1|                litCSize = ((istart[2] &  3) << 16) + (istart[3] << 8) + istart[4];
 2845|      1|                break;
 2846|      3|            }
 2847|      3|            if (litSize > BLOCKSIZE) return ERROR(corruption_detected);
  ------------------
  |  |  396|      3|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|      3|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
                          if (litSize > BLOCKSIZE) 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 (2847:17): [True: 0, False: 3]
  ------------------
 2848|      3|            if (litCSize + lhSize > srcSize) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2848:17): [True: 1, False: 2]
  ------------------
 2849|       |
 2850|      2|            if (HUFv05_isError(singleStream ?
  ------------------
  |  Branch (2850:17): [True: 1, False: 1]
  |  Branch (2850:32): [True: 1, False: 1]
  ------------------
 2851|      1|                            HUFv05_decompress1X2(dctx->litBuffer, litSize, istart+lhSize, litCSize) :
 2852|      2|                            HUFv05_decompress   (dctx->litBuffer, litSize, istart+lhSize, litCSize) ))
 2853|      1|                return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2854|       |
 2855|      1|            dctx->litPtr = dctx->litBuffer;
 2856|      1|            dctx->litSize = litSize;
 2857|      1|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|      1|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2858|      1|            return litCSize + lhSize;
 2859|      2|        }
 2860|      0|    case IS_PCH:
  ------------------
  |  |  410|      0|#define IS_PCH 1
  ------------------
  |  Branch (2860:5): [True: 0, False: 4]
  ------------------
 2861|      0|        {
 2862|      0|            size_t errorCode;
 2863|      0|            size_t litSize, litCSize;
 2864|      0|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2865|      0|            if (lhSize != 1)  /* only case supported for now : small litSize, single stream */
  ------------------
  |  Branch (2865:17): [True: 0, False: 0]
  ------------------
 2866|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2867|      0|            if (!dctx->flagStaticTables)
  ------------------
  |  Branch (2867:17): [True: 0, False: 0]
  ------------------
 2868|      0|                return ERROR(dictionary_corrupted);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2869|       |
 2870|       |            /* 2 - 2 - 10 - 10 */
 2871|      0|            lhSize=3;
 2872|      0|            litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 2873|      0|            litCSize = ((istart[1] &  3) << 8) + istart[2];
 2874|      0|            if (litCSize + lhSize > srcSize) 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 (2874:17): [True: 0, False: 0]
  ------------------
 2875|       |
 2876|      0|            errorCode = HUFv05_decompress1X4_usingDTable(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->hufTableX4);
 2877|      0|            if (HUFv05_isError(errorCode)) 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 (2877:17): [True: 0, False: 0]
  ------------------
 2878|       |
 2879|      0|            dctx->litPtr = dctx->litBuffer;
 2880|      0|            dctx->litSize = litSize;
 2881|      0|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2882|      0|            return litCSize + lhSize;
 2883|      0|        }
 2884|      0|    case IS_RAW:
  ------------------
  |  |  411|      0|#define IS_RAW 2
  ------------------
  |  Branch (2884:5): [True: 0, False: 4]
  ------------------
 2885|      0|        {
 2886|      0|            size_t litSize;
 2887|      0|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2888|      0|            switch(lhSize)
 2889|      0|            {
 2890|      0|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (2890:13): [True: 0, False: 0]
  |  Branch (2890:21): [True: 0, False: 0]
  |  Branch (2890:29): [True: 0, False: 0]
  ------------------
 2891|      0|                lhSize=1;
 2892|      0|                litSize = istart[0] & 31;
 2893|      0|                break;
 2894|      0|            case 2:
  ------------------
  |  Branch (2894:13): [True: 0, False: 0]
  ------------------
 2895|      0|                litSize = ((istart[0] & 15) << 8) + istart[1];
 2896|      0|                break;
 2897|      0|            case 3:
  ------------------
  |  Branch (2897:13): [True: 0, False: 0]
  ------------------
 2898|      0|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 2899|      0|                break;
 2900|      0|            }
 2901|       |
 2902|      0|            if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  |  441|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
  |  Branch (2902:17): [True: 0, False: 0]
  ------------------
 2903|      0|                if (litSize+lhSize > srcSize) 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 (2903:21): [True: 0, False: 0]
  ------------------
 2904|      0|                memcpy(dctx->litBuffer, istart+lhSize, litSize);
 2905|      0|                dctx->litPtr = dctx->litBuffer;
 2906|      0|                dctx->litSize = litSize;
 2907|      0|                memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2908|      0|                return lhSize+litSize;
 2909|      0|            }
 2910|       |            /* direct reference into compressed stream */
 2911|      0|            dctx->litPtr = istart+lhSize;
 2912|      0|            dctx->litSize = litSize;
 2913|      0|            return lhSize+litSize;
 2914|      0|        }
 2915|      1|    case IS_RLE:
  ------------------
  |  |  412|      1|#define IS_RLE 3
  ------------------
  |  Branch (2915:5): [True: 1, False: 3]
  ------------------
 2916|      1|        {
 2917|      1|            size_t litSize;
 2918|      1|            U32 lhSize = ((istart[0]) >> 4) & 3;
 2919|      1|            switch(lhSize)
 2920|      1|            {
 2921|      0|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (2921:13): [True: 0, False: 1]
  |  Branch (2921:21): [True: 0, False: 1]
  |  Branch (2921:29): [True: 0, False: 1]
  ------------------
 2922|      0|                lhSize = 1;
 2923|      0|                litSize = istart[0] & 31;
 2924|      0|                break;
 2925|      0|            case 2:
  ------------------
  |  Branch (2925:13): [True: 0, False: 1]
  ------------------
 2926|      0|                litSize = ((istart[0] & 15) << 8) + istart[1];
 2927|      0|                break;
 2928|      1|            case 3:
  ------------------
  |  Branch (2928:13): [True: 1, False: 0]
  ------------------
 2929|      1|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 2930|      1|                if (srcSize<4) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need lhSize+1 = 4 */
  ------------------
  |  |   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 (2930:21): [True: 0, False: 1]
  ------------------
 2931|      1|                break;
 2932|      1|            }
 2933|      1|            if (litSize > BLOCKSIZE) return ERROR(corruption_detected);
  ------------------
  |  |  396|      1|#define BLOCKSIZE (128 KB)                 /* define, for static allocation */
  |  |  ------------------
  |  |  |  |  392|      1|#define KB *(1 <<10)
  |  |  ------------------
  ------------------
                          if (litSize > BLOCKSIZE) 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 (2933:17): [True: 0, False: 1]
  ------------------
 2934|      1|            memset(dctx->litBuffer, istart[lhSize], litSize + WILDCOPY_OVERLENGTH);
  ------------------
  |  |  441|      1|#define WILDCOPY_OVERLENGTH 8
  ------------------
 2935|      1|            dctx->litPtr = dctx->litBuffer;
 2936|      1|            dctx->litSize = litSize;
 2937|      1|            return lhSize+1;
 2938|      1|        }
 2939|      0|    default:
  ------------------
  |  Branch (2939:5): [True: 0, False: 4]
  ------------------
 2940|      0|        return ERROR(corruption_detected);   /* 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2941|      4|    }
 2942|      4|}
zstd_v05.c:ZSTDv05_decompressSequences:
 3260|      2|{
 3261|      2|    const BYTE* ip = (const BYTE*)seqStart;
 3262|      2|    const BYTE* const iend = ip + seqSize;
 3263|      2|    BYTE* const ostart = (BYTE*)dst;
 3264|      2|    BYTE* op = ostart;
 3265|      2|    BYTE* const oend = ostart + maxDstSize;
 3266|      2|    size_t errorCode, dumpsLength=0;
 3267|      2|    const BYTE* litPtr = dctx->litPtr;
 3268|      2|    const BYTE* const litEnd = litPtr + dctx->litSize;
 3269|      2|    int nbSeq=0;
 3270|      2|    const BYTE* dumps = NULL;
 3271|      2|    unsigned* DTableLL = dctx->LLTable;
 3272|      2|    unsigned* DTableML = dctx->MLTable;
 3273|      2|    unsigned* DTableOffb = dctx->OffTable;
 3274|      2|    const BYTE* const base = (const BYTE*) (dctx->base);
 3275|      2|    const BYTE* const vBase = (const BYTE*) (dctx->vBase);
 3276|      2|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 3277|       |
 3278|       |    /* Build Decoding Tables */
 3279|      2|    errorCode = ZSTDv05_decodeSeqHeaders(&nbSeq, &dumps, &dumpsLength,
 3280|      2|                                      DTableLL, DTableML, DTableOffb,
 3281|      2|                                      ip, seqSize, dctx->flagStaticTables);
 3282|      2|    if (ZSTDv05_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (3282:9): [True: 1, False: 1]
  ------------------
 3283|      1|    ip += errorCode;
 3284|       |
 3285|       |    /* Regen sequences */
 3286|      1|    if (nbSeq) {
  ------------------
  |  Branch (3286:9): [True: 0, False: 1]
  ------------------
 3287|      0|        seq_t sequence;
 3288|      0|        seqState_t seqState;
 3289|       |
 3290|      0|        memset(&sequence, 0, sizeof(sequence));
 3291|      0|        sequence.offset = REPCODE_STARTVALUE;
  ------------------
  |  |  415|      0|#define REPCODE_STARTVALUE 1
  ------------------
 3292|      0|        seqState.dumps = dumps;
 3293|      0|        seqState.dumpsEnd = dumps + dumpsLength;
 3294|      0|        seqState.prevOffset = REPCODE_STARTVALUE;
  ------------------
  |  |  415|      0|#define REPCODE_STARTVALUE 1
  ------------------
 3295|      0|        errorCode = BITv05_initDStream(&(seqState.DStream), ip, iend-ip);
 3296|      0|        if (ERR_isError(errorCode)) 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 (3296:13): [True: 0, False: 0]
  ------------------
 3297|      0|        FSEv05_initDState(&(seqState.stateLL), &(seqState.DStream), DTableLL);
 3298|      0|        FSEv05_initDState(&(seqState.stateOffb), &(seqState.DStream), DTableOffb);
 3299|      0|        FSEv05_initDState(&(seqState.stateML), &(seqState.DStream), DTableML);
 3300|       |
 3301|      0|        for ( ; (BITv05_reloadDStream(&(seqState.DStream)) <= BITv05_DStream_completed) && nbSeq ; ) {
  ------------------
  |  Branch (3301:17): [True: 0, False: 0]
  |  Branch (3301:92): [True: 0, False: 0]
  ------------------
 3302|      0|            size_t oneSeqSize;
 3303|      0|            nbSeq--;
 3304|      0|            ZSTDv05_decodeSequence(&sequence, &seqState);
 3305|      0|            oneSeqSize = ZSTDv05_execSequence(op, oend, sequence, &litPtr, litEnd, base, vBase, dictEnd);
 3306|      0|            if (ZSTDv05_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  Branch (3306:17): [True: 0, False: 0]
  ------------------
 3307|      0|            op += oneSeqSize;
 3308|      0|        }
 3309|       |
 3310|       |        /* check if reached exact end */
 3311|      0|        if (nbSeq) 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 (3311:13): [True: 0, False: 0]
  ------------------
 3312|      0|    }
 3313|       |
 3314|       |    /* last literal segment */
 3315|      1|    {
 3316|      1|        size_t lastLLSize = litEnd - litPtr;
 3317|      1|        if (litPtr > litEnd) return ERROR(corruption_detected);   /* too many literals already used */
  ------------------
  |  |   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 (3317:13): [True: 0, False: 1]
  ------------------
 3318|      1|        if (op+lastLLSize > oend) 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 (3318:13): [True: 0, False: 1]
  ------------------
 3319|      1|        if (lastLLSize > 0) {
  ------------------
  |  Branch (3319:13): [True: 1, False: 0]
  ------------------
 3320|      1|            memcpy(op, litPtr, lastLLSize);
 3321|      1|            op += lastLLSize;
 3322|      1|        }
 3323|      1|    }
 3324|       |
 3325|      0|    return op-ostart;
 3326|      1|}
zstd_v05.c:ZSTDv05_decodeSeqHeaders:
 2948|      2|{
 2949|      2|    const BYTE* const istart = (const BYTE*)src;
 2950|      2|    const BYTE* ip = istart;
 2951|      2|    const BYTE* const iend = istart + srcSize;
 2952|      2|    U32 LLtype, Offtype, MLtype;
 2953|      2|    unsigned LLlog, Offlog, MLlog;
 2954|      2|    size_t dumpsLength;
 2955|       |
 2956|       |    /* check */
 2957|      2|    if (srcSize < MIN_SEQUENCES_SIZE)
  ------------------
  |  |  438|      2|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  ------------------
  |  Branch (2957:9): [True: 1, False: 1]
  ------------------
 2958|      1|        return ERROR(srcSize_wrong);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2959|       |
 2960|       |    /* SeqHead */
 2961|      1|    *nbSeq = *ip++;
 2962|      1|    if (*nbSeq==0) return 1;
  ------------------
  |  Branch (2962:9): [True: 1, False: 0]
  ------------------
 2963|      0|    if (*nbSeq >= 128) {
  ------------------
  |  Branch (2963:9): [True: 0, False: 0]
  ------------------
 2964|      0|        if (ip >= iend) 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 (2964:13): [True: 0, False: 0]
  ------------------
 2965|      0|        *nbSeq = ((nbSeq[0]-128)<<8) + *ip++;
 2966|      0|    }
 2967|       |
 2968|      0|    if (ip >= iend) 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 (2968:9): [True: 0, False: 0]
  ------------------
 2969|      0|    LLtype  = *ip >> 6;
 2970|      0|    Offtype = (*ip >> 4) & 3;
 2971|      0|    MLtype  = (*ip >> 2) & 3;
 2972|      0|    if (*ip & 2) {
  ------------------
  |  Branch (2972:9): [True: 0, False: 0]
  ------------------
 2973|      0|        if (ip+3 > iend) 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 (2973:13): [True: 0, False: 0]
  ------------------
 2974|      0|        dumpsLength  = ip[2];
 2975|      0|        dumpsLength += ip[1] << 8;
 2976|      0|        ip += 3;
 2977|      0|    } else {
 2978|      0|        if (ip+2 > iend) 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 (2978:13): [True: 0, False: 0]
  ------------------
 2979|      0|        dumpsLength  = ip[1];
 2980|      0|        dumpsLength += (ip[0] & 1) << 8;
 2981|      0|        ip += 2;
 2982|      0|    }
 2983|      0|    *dumpsPtr = ip;
 2984|      0|    ip += dumpsLength;
 2985|      0|    *dumpsLengthPtr = dumpsLength;
 2986|       |
 2987|       |    /* check */
 2988|      0|    if (ip > iend-3) return ERROR(srcSize_wrong); /* min : all 3 are "raw", hence no header, but at least xxLog bits per type */
  ------------------
  |  |   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 (2988:9): [True: 0, False: 0]
  ------------------
 2989|       |
 2990|       |    /* sequences */
 2991|      0|    {
 2992|      0|        S16 norm[MaxML+1];    /* assumption : MaxML >= MaxLL >= MaxOff */
 2993|      0|        size_t headerSize;
 2994|       |
 2995|       |        /* Build DTables */
 2996|      0|        switch(LLtype)
 2997|      0|        {
 2998|      0|        case FSEv05_ENCODING_RLE :
  ------------------
  |  |  431|      0|#define FSEv05_ENCODING_RLE     1
  ------------------
  |  Branch (2998:9): [True: 0, False: 0]
  ------------------
 2999|      0|            LLlog = 0;
 3000|      0|            FSEv05_buildDTable_rle(DTableLL, *ip++);
 3001|      0|            break;
 3002|      0|        case FSEv05_ENCODING_RAW :
  ------------------
  |  |  430|      0|#define FSEv05_ENCODING_RAW     0
  ------------------
  |  Branch (3002:9): [True: 0, False: 0]
  ------------------
 3003|      0|            LLlog = LLbits;
  ------------------
  |  |  419|      0|#define LLbits   6
  ------------------
 3004|      0|            FSEv05_buildDTable_raw(DTableLL, LLbits);
  ------------------
  |  |  419|      0|#define LLbits   6
  ------------------
 3005|      0|            break;
 3006|      0|        case FSEv05_ENCODING_STATIC:
  ------------------
  |  |  432|      0|#define FSEv05_ENCODING_STATIC  2
  ------------------
  |  Branch (3006:9): [True: 0, False: 0]
  ------------------
 3007|      0|            if (!flagStaticTable) 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 (3007:17): [True: 0, False: 0]
  ------------------
 3008|      0|            break;
 3009|      0|        case FSEv05_ENCODING_DYNAMIC :
  ------------------
  |  |  433|      0|#define FSEv05_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3009:9): [True: 0, False: 0]
  ------------------
 3010|      0|        default :   /* impossible */
  ------------------
  |  Branch (3010:9): [True: 0, False: 0]
  ------------------
 3011|      0|            {   unsigned max = MaxLL;
  ------------------
  |  |  423|      0|#define MaxLL  ((1<<LLbits) - 1)
  |  |  ------------------
  |  |  |  |  419|      0|#define LLbits   6
  |  |  ------------------
  ------------------
 3012|      0|                headerSize = FSEv05_readNCount(norm, &max, &LLlog, ip, iend-ip);
 3013|      0|                if (FSEv05_isError(headerSize)) 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 (3013:21): [True: 0, False: 0]
  ------------------
 3014|      0|                if (LLlog > LLFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |  426|      0|#define LLFSEv05Log   10
  ------------------
                              if (LLlog > LLFSEv05Log) 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 (3014:21): [True: 0, False: 0]
  ------------------
 3015|      0|                ip += headerSize;
 3016|      0|                FSEv05_buildDTable(DTableLL, norm, max, LLlog);
 3017|      0|        }   }
 3018|       |
 3019|      0|        switch(Offtype)
 3020|      0|        {
 3021|      0|        case FSEv05_ENCODING_RLE :
  ------------------
  |  |  431|      0|#define FSEv05_ENCODING_RLE     1
  ------------------
  |  Branch (3021:9): [True: 0, False: 0]
  ------------------
 3022|      0|            Offlog = 0;
 3023|      0|            if (ip > iend-2) return ERROR(srcSize_wrong);   /* min : "raw", hence no header, but at least xxLog bits */
  ------------------
  |  |   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 (3023:17): [True: 0, False: 0]
  ------------------
 3024|      0|            FSEv05_buildDTable_rle(DTableOffb, *ip++ & MaxOff); /* if *ip > MaxOff, data is corrupted */
  ------------------
  |  |  424|      0|#define MaxOff ((1<<Offbits)- 1)
  |  |  ------------------
  |  |  |  |  420|      0|#define Offbits  5
  |  |  ------------------
  ------------------
 3025|      0|            break;
 3026|      0|        case FSEv05_ENCODING_RAW :
  ------------------
  |  |  430|      0|#define FSEv05_ENCODING_RAW     0
  ------------------
  |  Branch (3026:9): [True: 0, False: 0]
  ------------------
 3027|      0|            Offlog = Offbits;
  ------------------
  |  |  420|      0|#define Offbits  5
  ------------------
 3028|      0|            FSEv05_buildDTable_raw(DTableOffb, Offbits);
  ------------------
  |  |  420|      0|#define Offbits  5
  ------------------
 3029|      0|            break;
 3030|      0|        case FSEv05_ENCODING_STATIC:
  ------------------
  |  |  432|      0|#define FSEv05_ENCODING_STATIC  2
  ------------------
  |  Branch (3030:9): [True: 0, False: 0]
  ------------------
 3031|      0|            if (!flagStaticTable) 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 (3031:17): [True: 0, False: 0]
  ------------------
 3032|      0|            break;
 3033|      0|        case FSEv05_ENCODING_DYNAMIC :
  ------------------
  |  |  433|      0|#define FSEv05_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3033:9): [True: 0, False: 0]
  ------------------
 3034|      0|        default :   /* impossible */
  ------------------
  |  Branch (3034:9): [True: 0, False: 0]
  ------------------
 3035|      0|            {   unsigned max = MaxOff;
  ------------------
  |  |  424|      0|#define MaxOff ((1<<Offbits)- 1)
  |  |  ------------------
  |  |  |  |  420|      0|#define Offbits  5
  |  |  ------------------
  ------------------
 3036|      0|                headerSize = FSEv05_readNCount(norm, &max, &Offlog, ip, iend-ip);
 3037|      0|                if (FSEv05_isError(headerSize)) 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 (3037:21): [True: 0, False: 0]
  ------------------
 3038|      0|                if (Offlog > OffFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |  427|      0|#define OffFSEv05Log   9
  ------------------
                              if (Offlog > OffFSEv05Log) 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 (3038:21): [True: 0, False: 0]
  ------------------
 3039|      0|                ip += headerSize;
 3040|      0|                FSEv05_buildDTable(DTableOffb, norm, max, Offlog);
 3041|      0|        }   }
 3042|       |
 3043|      0|        switch(MLtype)
 3044|      0|        {
 3045|      0|        case FSEv05_ENCODING_RLE :
  ------------------
  |  |  431|      0|#define FSEv05_ENCODING_RLE     1
  ------------------
  |  Branch (3045:9): [True: 0, False: 0]
  ------------------
 3046|      0|            MLlog = 0;
 3047|      0|            if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
  ------------------
  |  |   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 (3047:17): [True: 0, False: 0]
  ------------------
 3048|      0|            FSEv05_buildDTable_rle(DTableML, *ip++);
 3049|      0|            break;
 3050|      0|        case FSEv05_ENCODING_RAW :
  ------------------
  |  |  430|      0|#define FSEv05_ENCODING_RAW     0
  ------------------
  |  Branch (3050:9): [True: 0, False: 0]
  ------------------
 3051|      0|            MLlog = MLbits;
  ------------------
  |  |  418|      0|#define MLbits   7
  ------------------
 3052|      0|            FSEv05_buildDTable_raw(DTableML, MLbits);
  ------------------
  |  |  418|      0|#define MLbits   7
  ------------------
 3053|      0|            break;
 3054|      0|        case FSEv05_ENCODING_STATIC:
  ------------------
  |  |  432|      0|#define FSEv05_ENCODING_STATIC  2
  ------------------
  |  Branch (3054:9): [True: 0, False: 0]
  ------------------
 3055|      0|            if (!flagStaticTable) 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 (3055:17): [True: 0, False: 0]
  ------------------
 3056|      0|            break;
 3057|      0|        case FSEv05_ENCODING_DYNAMIC :
  ------------------
  |  |  433|      0|#define FSEv05_ENCODING_DYNAMIC 3
  ------------------
  |  Branch (3057:9): [True: 0, False: 0]
  ------------------
 3058|      0|        default :   /* impossible */
  ------------------
  |  Branch (3058:9): [True: 0, False: 0]
  ------------------
 3059|      0|            {   unsigned max = MaxML;
  ------------------
  |  |  422|      0|#define MaxML  ((1<<MLbits) - 1)
  |  |  ------------------
  |  |  |  |  418|      0|#define MLbits   7
  |  |  ------------------
  ------------------
 3060|      0|                headerSize = FSEv05_readNCount(norm, &max, &MLlog, ip, iend-ip);
 3061|      0|                if (FSEv05_isError(headerSize)) 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 (3061:21): [True: 0, False: 0]
  ------------------
 3062|      0|                if (MLlog > MLFSEv05Log) return ERROR(corruption_detected);
  ------------------
  |  |  425|      0|#define MLFSEv05Log   10
  ------------------
                              if (MLlog > MLFSEv05Log) 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 (3062:21): [True: 0, False: 0]
  ------------------
 3063|      0|                ip += headerSize;
 3064|      0|                FSEv05_buildDTable(DTableML, norm, max, MLlog);
 3065|      0|    }   }   }
 3066|       |
 3067|      0|    return ip-istart;
 3068|      0|}
zstd_v05.c:ZSTDv05_decompress_continueDCtx:
 3373|      4|{
 3374|      4|    const BYTE* ip = (const BYTE*)src;
 3375|      4|    const BYTE* iend = ip + srcSize;
 3376|      4|    BYTE* const ostart = (BYTE*)dst;
 3377|      4|    BYTE* op = ostart;
 3378|      4|    BYTE* const oend = ostart + maxDstSize;
 3379|      4|    size_t remainingSize = srcSize;
 3380|      4|    blockProperties_t blockProperties;
 3381|      4|    memset(&blockProperties, 0, sizeof(blockProperties));
 3382|       |
 3383|       |    /* Frame Header */
 3384|      4|    {   size_t frameHeaderSize;
 3385|      4|        if (srcSize < ZSTDv05_frameHeaderSize_min+ZSTDv05_blockHeaderSize) 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 (3385:13): [True: 0, False: 4]
  ------------------
 3386|      4|        frameHeaderSize = ZSTDv05_decodeFrameHeader_Part1(dctx, src, ZSTDv05_frameHeaderSize_min);
 3387|      4|        if (ZSTDv05_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  Branch (3387:13): [True: 0, False: 4]
  ------------------
 3388|      4|        if (srcSize < frameHeaderSize+ZSTDv05_blockHeaderSize) 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 (3388:13): [True: 0, False: 4]
  ------------------
 3389|      4|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3390|      4|        frameHeaderSize = ZSTDv05_decodeFrameHeader_Part2(dctx, src, frameHeaderSize);
 3391|      4|        if (ZSTDv05_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  Branch (3391:13): [True: 0, False: 4]
  ------------------
 3392|      4|    }
 3393|       |
 3394|       |    /* Loop on each block */
 3395|      5|    while (1)
  ------------------
  |  Branch (3395:12): [True: 5, Folded]
  ------------------
 3396|      5|    {
 3397|      5|        size_t decodedSize=0;
 3398|      5|        size_t cBlockSize = ZSTDv05_getcBlockSize(ip, iend-ip, &blockProperties);
 3399|      5|        if (ZSTDv05_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  Branch (3399:13): [True: 0, False: 5]
  ------------------
 3400|       |
 3401|      5|        ip += ZSTDv05_blockHeaderSize;
 3402|      5|        remainingSize -= ZSTDv05_blockHeaderSize;
 3403|      5|        if (cBlockSize > remainingSize) 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 (3403:13): [True: 0, False: 5]
  ------------------
 3404|       |
 3405|      5|        switch(blockProperties.blockType)
 3406|      5|        {
 3407|      4|        case bt_compressed:
  ------------------
  |  Branch (3407:9): [True: 4, False: 1]
  ------------------
 3408|      4|            decodedSize = ZSTDv05_decompressBlock_internal(dctx, op, oend-op, ip, cBlockSize);
 3409|      4|            break;
 3410|      0|        case bt_raw :
  ------------------
  |  Branch (3410:9): [True: 0, False: 5]
  ------------------
 3411|      0|            decodedSize = ZSTDv05_copyRawBlock(op, oend-op, ip, cBlockSize);
 3412|      0|            break;
 3413|      0|        case bt_rle :
  ------------------
  |  Branch (3413:9): [True: 0, False: 5]
  ------------------
 3414|      0|            return ERROR(GENERIC);   /* not yet supported */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3415|      0|            break;
 3416|      1|        case bt_end :
  ------------------
  |  Branch (3416:9): [True: 1, False: 4]
  ------------------
 3417|       |            /* end of frame */
 3418|      1|            if (remainingSize) 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 (3418:17): [True: 0, False: 1]
  ------------------
 3419|      1|            break;
 3420|      1|        default:
  ------------------
  |  Branch (3420:9): [True: 0, False: 5]
  ------------------
 3421|      0|            return ERROR(GENERIC);   /* 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3422|      5|        }
 3423|      5|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3423:13): [True: 1, False: 4]
  ------------------
 3424|       |
 3425|      4|        if (ZSTDv05_isError(decodedSize)) return decodedSize;
  ------------------
  |  Branch (3425:13): [True: 3, False: 1]
  ------------------
 3426|      1|        op += decodedSize;
 3427|      1|        ip += cBlockSize;
 3428|      1|        remainingSize -= cBlockSize;
 3429|      1|    }
 3430|       |
 3431|      1|    return op-ostart;
 3432|      4|}
zstd_v05.c:ZSTD_errorFrameSizeInfoLegacy:
 3479|      1|{
 3480|      1|    *cSize = ret;
 3481|      1|    *dBound = ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  |  443|      1|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
 3482|      1|}
zstd_v05.c:ZSTDv05_getcBlockSize:
 2779|     15|{
 2780|     15|    const BYTE* const in = (const BYTE*)src;
 2781|     15|    BYTE headerFlags;
 2782|     15|    U32 cSize;
 2783|       |
 2784|     15|    if (srcSize < 3)
  ------------------
  |  Branch (2784:9): [True: 0, False: 15]
  ------------------
 2785|      0|        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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2786|       |
 2787|     15|    headerFlags = *in;
 2788|     15|    cSize = in[2] + (in[1]<<8) + ((in[0] & 7)<<16);
 2789|       |
 2790|     15|    bpPtr->blockType = (blockType_t)(headerFlags >> 6);
 2791|     15|    bpPtr->origSize = (bpPtr->blockType == bt_rle) ? cSize : 0;
  ------------------
  |  Branch (2791:23): [True: 1, False: 14]
  ------------------
 2792|       |
 2793|     15|    if (bpPtr->blockType == bt_end) return 0;
  ------------------
  |  Branch (2793:9): [True: 5, False: 10]
  ------------------
 2794|     10|    if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (2794:9): [True: 1, False: 9]
  ------------------
 2795|      9|    return cSize;
 2796|     10|}
zstd_v05.c:ZSTDv05_decodeFrameHeader_Part1:
 2740|      4|{
 2741|      4|    U32 magicNumber;
 2742|      4|    if (srcSize != ZSTDv05_frameHeaderSize_min)
  ------------------
  |  Branch (2742:9): [True: 0, False: 4]
  ------------------
 2743|      0|        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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2744|      4|    magicNumber = MEM_readLE32(src);
 2745|      4|    if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |  153|      4|#define ZSTDv05_MAGICNUMBER 0xFD2FB525   /* v0.5 */
  ------------------
                  if (magicNumber != ZSTDv05_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |   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 (2745:9): [True: 0, False: 4]
  ------------------
 2746|      4|    zc->headerSize = ZSTDv05_frameHeaderSize_min;
 2747|      4|    return zc->headerSize;
 2748|      4|}
zstd_v05.c:ZSTDv05_decodeFrameHeader_Part2:
 2768|      4|{
 2769|      4|    size_t result;
 2770|      4|    if (srcSize != zc->headerSize)
  ------------------
  |  Branch (2770:9): [True: 0, False: 4]
  ------------------
 2771|      0|        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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2772|      4|    result = ZSTDv05_getFrameParams(&(zc->params), src, srcSize);
 2773|      4|    if ((MEM_32bits()) && (zc->params.windowLog > 25)) return ERROR(frameParameter_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 (2773:9): [True: 0, False: 4]
  |  Branch (2773:27): [True: 0, False: 0]
  ------------------
 2774|      4|    return result;
 2775|      4|}

FSEv06_decompress:
 1594|      1|{
 1595|      1|    const BYTE* const istart = (const BYTE*)cSrc;
 1596|      1|    const BYTE* ip = istart;
 1597|      1|    short counting[FSEv06_MAX_SYMBOL_VALUE+1];
 1598|      1|    DTable_max_t dt;   /* Static analyzer seems unable to understand this table will be properly initialized later */
 1599|      1|    unsigned tableLog;
 1600|      1|    unsigned maxSymbolValue = FSEv06_MAX_SYMBOL_VALUE;
  ------------------
  |  | 1117|      1|#define FSEv06_MAX_SYMBOL_VALUE 255
  ------------------
 1601|       |
 1602|      1|    if (cSrcSize<2) return ERROR(srcSize_wrong);   /* too small input size */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1602:9): [True: 1, False: 0]
  ------------------
 1603|       |
 1604|       |    /* normal FSE decoding mode */
 1605|      0|    {   size_t const NCountLength = FSEv06_readNCount (counting, &maxSymbolValue, &tableLog, istart, cSrcSize);
 1606|      0|        if (FSEv06_isError(NCountLength)) return NCountLength;
  ------------------
  |  | 1357|      0|#define FSEv06_isError ERR_isError
  ------------------
  |  Branch (1606:13): [True: 0, False: 0]
  ------------------
 1607|      0|        if (NCountLength >= cSrcSize) return ERROR(srcSize_wrong);   /* too small input 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 (1607:13): [True: 0, False: 0]
  ------------------
 1608|      0|        ip += NCountLength;
 1609|      0|        cSrcSize -= NCountLength;
 1610|      0|    }
 1611|       |
 1612|      0|    { size_t const errorCode = FSEv06_buildDTable (dt, counting, maxSymbolValue, tableLog);
 1613|      0|      if (FSEv06_isError(errorCode)) return errorCode; }
  ------------------
  |  | 1357|      0|#define FSEv06_isError ERR_isError
  ------------------
  |  Branch (1613:11): [True: 0, False: 0]
  ------------------
 1614|       |
 1615|      0|    return FSEv06_decompress_usingDTable (dst, maxDstSize, ip, cSrcSize, dt);   /* always return, even if it is an error code */
 1616|      0|}
HUFv06_readDTableX2:
 1949|      2|{
 1950|      2|    BYTE huffWeight[HUFv06_MAX_SYMBOL_VALUE + 1];
 1951|      2|    U32 rankVal[HUFv06_ABSOLUTEMAX_TABLELOG + 1];   /* large enough for values from 0 to 16 */
 1952|      2|    U32 tableLog = 0;
 1953|      2|    size_t iSize;
 1954|      2|    U32 nbSymbols = 0;
 1955|      2|    U32 n;
 1956|      2|    U32 nextRankStart;
 1957|      2|    void* const dtPtr = DTable + 1;
 1958|      2|    HUFv06_DEltX2* const dt = (HUFv06_DEltX2*)dtPtr;
 1959|       |
 1960|      2|    HUFv06_STATIC_ASSERT(sizeof(HUFv06_DEltX2) == sizeof(U16));   /* if compilation fails here, assertion is false */
  ------------------
  |  | 1929|      2|#define HUFv06_STATIC_ASSERT(c) { enum { HUFv06_static_assert = 1/(int)(!!(c)) }; }   /* use only *after* variable declarations */
  ------------------
 1961|       |    /* memset(huffWeight, 0, sizeof(huffWeight)); */   /* is not necessary, even though some analyzer complain ... */
 1962|       |
 1963|      2|    iSize = HUFv06_readStats(huffWeight, HUFv06_MAX_SYMBOL_VALUE + 1, rankVal, &nbSymbols, &tableLog, src, srcSize);
  ------------------
  |  | 1786|      2|#define HUFv06_MAX_SYMBOL_VALUE 255
  ------------------
 1964|      2|    if (HUFv06_isError(iSize)) return iSize;
  ------------------
  |  Branch (1964:9): [True: 1, False: 1]
  ------------------
 1965|       |
 1966|       |    /* check result */
 1967|      1|    if (tableLog > DTable[0]) return ERROR(tableLog_tooLarge);   /* DTable is too small */
  ------------------
  |  |   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 (1967:9): [True: 0, False: 1]
  ------------------
 1968|      1|    DTable[0] = (U16)tableLog;   /* maybe should separate sizeof allocated DTable, from used size of DTable, in case of re-use */
 1969|       |
 1970|       |    /* Prepare ranks */
 1971|      1|    nextRankStart = 0;
 1972|      7|    for (n=1; n<tableLog+1; n++) {
  ------------------
  |  Branch (1972:15): [True: 6, False: 1]
  ------------------
 1973|      6|        U32 current = nextRankStart;
 1974|      6|        nextRankStart += (rankVal[n] << (n-1));
 1975|      6|        rankVal[n] = current;
 1976|      6|    }
 1977|       |
 1978|       |    /* fill DTable */
 1979|     34|    for (n=0; n<nbSymbols; n++) {
  ------------------
  |  Branch (1979:15): [True: 33, False: 1]
  ------------------
 1980|     33|        const U32 w = huffWeight[n];
 1981|     33|        const U32 length = (1 << w) >> 1;
 1982|     33|        U32 i;
 1983|     33|        HUFv06_DEltX2 D;
 1984|     33|        D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w);
 1985|     97|        for (i = rankVal[w]; i < rankVal[w] + length; i++)
  ------------------
  |  Branch (1985:30): [True: 64, False: 33]
  ------------------
 1986|     64|            dt[i] = D;
 1987|     33|        rankVal[w] += length;
 1988|     33|    }
 1989|       |
 1990|      1|    return iSize;
 1991|      1|}
HUFv06_decompress1X2_usingDTable:
 2040|      1|{
 2041|      1|    BYTE* op = (BYTE*)dst;
 2042|      1|    BYTE* const oend = op + dstSize;
 2043|      1|    const U32 dtLog = DTable[0];
 2044|      1|    const void* dtPtr = DTable;
 2045|      1|    const HUFv06_DEltX2* const dt = ((const HUFv06_DEltX2*)dtPtr)+1;
 2046|      1|    BITv06_DStream_t bitD;
 2047|       |
 2048|      1|    { size_t const errorCode = BITv06_initDStream(&bitD, cSrc, cSrcSize);
 2049|      1|      if (HUFv06_isError(errorCode)) return errorCode; }
  ------------------
  |  Branch (2049:11): [True: 0, False: 1]
  ------------------
 2050|       |
 2051|      1|    HUFv06_decodeStreamX2(op, &bitD, oend, dt, dtLog);
 2052|       |
 2053|       |    /* check */
 2054|      1|    if (!BITv06_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2054:9): [True: 1, False: 0]
  ------------------
 2055|       |
 2056|      0|    return dstSize;
 2057|      1|}
HUFv06_decompress1X2:
 2060|      2|{
 2061|      2|    HUFv06_CREATE_STATIC_DTABLEX2(DTable, HUFv06_MAX_TABLELOG);
  ------------------
  |  | 1743|      2|        unsigned short DTable[HUFv06_DTABLE_SIZE(maxTableLog)] = { maxTableLog }
  ------------------
 2062|      2|    const BYTE* ip = (const BYTE*) cSrc;
 2063|       |
 2064|      2|    size_t const errorCode = HUFv06_readDTableX2 (DTable, cSrc, cSrcSize);
 2065|      2|    if (HUFv06_isError(errorCode)) return errorCode;
  ------------------
  |  Branch (2065:9): [True: 1, False: 1]
  ------------------
 2066|      1|    if (errorCode >= 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 (2066:9): [True: 0, False: 1]
  ------------------
 2067|      1|    ip += errorCode;
 2068|      1|    cSrcSize -= errorCode;
 2069|       |
 2070|      1|    return HUFv06_decompress1X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable);
 2071|      1|}
ZSTDv06_decompressBegin:
 2774|     16|{
 2775|     16|    dctx->expected = ZSTDv06_frameHeaderSize_min;
 2776|     16|    dctx->stage = ZSTDds_getFrameHeaderSize;
 2777|     16|    dctx->previousDstEnd = NULL;
 2778|     16|    dctx->base = NULL;
 2779|     16|    dctx->vBase = NULL;
 2780|     16|    dctx->dictEnd = NULL;
 2781|     16|    dctx->hufTableX4[0] = ZSTD_HUFFDTABLE_CAPACITY_LOG;
  ------------------
  |  |  426|     16|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 2782|     16|    dctx->flagRepeatTable = 0;
 2783|     16|    return 0;
 2784|     16|}
ZSTDv06_createDCtx:
 2787|      8|{
 2788|      8|    ZSTDv06_DCtx* dctx = (ZSTDv06_DCtx*)malloc(sizeof(ZSTDv06_DCtx));
 2789|      8|    if (dctx==NULL) return NULL;
  ------------------
  |  Branch (2789:9): [True: 0, False: 8]
  ------------------
 2790|      8|    ZSTDv06_decompressBegin(dctx);
 2791|      8|    return dctx;
 2792|      8|}
ZSTDv06_freeDCtx:
 2795|      8|{
 2796|      8|    free(dctx);
 2797|      8|    return 0;   /* reserved as a potential error code in the future */
 2798|      8|}
ZSTDv06_getFrameParams:
 2925|     13|{
 2926|     13|    const BYTE* ip = (const BYTE*)src;
 2927|       |
 2928|     13|    if (srcSize < ZSTDv06_frameHeaderSize_min) return ZSTDv06_frameHeaderSize_min;
  ------------------
  |  Branch (2928:9): [True: 0, False: 13]
  ------------------
 2929|     13|    if (MEM_readLE32(src) != ZSTDv06_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |  164|     13|#define ZSTDv06_MAGICNUMBER 0xFD2FB526   /* v0.6 */
  ------------------
                  if (MEM_readLE32(src) != ZSTDv06_MAGICNUMBER) return ERROR(prefix_unknown);
  ------------------
  |  |   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 (2929:9): [True: 0, False: 13]
  ------------------
 2930|       |
 2931|       |    /* ensure there is enough `srcSize` to fully read/decode frame header */
 2932|     13|    { size_t const fhsize = ZSTDv06_frameHeaderSize(src, srcSize);
 2933|     13|      if (srcSize < fhsize) return fhsize; }
  ------------------
  |  Branch (2933:11): [True: 0, False: 13]
  ------------------
 2934|       |
 2935|     13|    memset(fparamsPtr, 0, sizeof(*fparamsPtr));
 2936|     13|    {   BYTE const frameDesc = ip[4];
 2937|     13|        fparamsPtr->windowLog = (frameDesc & 0xF) + ZSTDv06_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  |  416|     13|#define ZSTDv06_WINDOWLOG_ABSOLUTEMIN 12
  ------------------
 2938|     13|        if ((frameDesc & 0x20) != 0) return ERROR(frameParameter_unsupported);   /* reserved 1 bit */
  ------------------
  |  |   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 (2938:13): [True: 0, False: 13]
  ------------------
 2939|     13|        switch(frameDesc >> 6)  /* fcsId */
 2940|     13|        {
 2941|      0|            default:   /* impossible */
  ------------------
  |  Branch (2941:13): [True: 0, False: 13]
  ------------------
 2942|      6|            case 0 : fparamsPtr->frameContentSize = 0; break;
  ------------------
  |  Branch (2942:13): [True: 6, False: 7]
  ------------------
 2943|      0|            case 1 : fparamsPtr->frameContentSize = ip[5]; break;
  ------------------
  |  Branch (2943:13): [True: 0, False: 13]
  ------------------
 2944|      1|            case 2 : fparamsPtr->frameContentSize = MEM_readLE16(ip+5)+256; break;
  ------------------
  |  Branch (2944:13): [True: 1, False: 12]
  ------------------
 2945|      6|            case 3 : fparamsPtr->frameContentSize = MEM_readLE64(ip+5); break;
  ------------------
  |  Branch (2945:13): [True: 6, False: 7]
  ------------------
 2946|     13|    }   }
 2947|     13|    return 0;
 2948|     13|}
ZSTDv06_decompress_usingDict:
 3581|      8|{
 3582|      8|    ZSTDv06_decompressBegin_usingDict(dctx, dict, dictSize);
 3583|      8|    ZSTDv06_checkContinuity(dctx, dst);
 3584|      8|    return ZSTDv06_decompressFrame(dctx, dst, dstCapacity, src, srcSize);
 3585|      8|}
ZSTDv06_findFrameSizeInfoLegacy:
 3618|      9|{
 3619|      9|    const BYTE* ip = (const BYTE*)src;
 3620|      9|    size_t remainingSize = srcSize;
 3621|      9|    size_t nbBlocks = 0;
 3622|      9|    blockProperties_t blockProperties = { bt_compressed, 0 };
 3623|       |
 3624|       |    /* Frame Header */
 3625|      9|    {   size_t const frameHeaderSize = ZSTDv06_frameHeaderSize(src, srcSize);
 3626|      9|        if (ZSTDv06_isError(frameHeaderSize)) {
  ------------------
  |  | 2731|      9|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3626:13): [True: 0, False: 9]
  ------------------
 3627|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, frameHeaderSize);
 3628|      0|            return;
 3629|      0|        }
 3630|      9|        if (MEM_readLE32(src) != ZSTDv06_MAGICNUMBER) {
  ------------------
  |  |  164|      9|#define ZSTDv06_MAGICNUMBER 0xFD2FB526   /* v0.6 */
  ------------------
  |  Branch (3630:13): [True: 0, False: 9]
  ------------------
 3631|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(prefix_unknown));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3632|      0|            return;
 3633|      0|        }
 3634|      9|        if (srcSize < frameHeaderSize+ZSTDv06_blockHeaderSize) {
  ------------------
  |  Branch (3634:13): [True: 0, False: 9]
  ------------------
 3635|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3636|      0|            return;
 3637|      0|        }
 3638|      9|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3639|      9|    }
 3640|       |
 3641|       |    /* Loop on each block */
 3642|     13|    while (1) {
  ------------------
  |  Branch (3642:12): [True: 13, Folded]
  ------------------
 3643|     13|        size_t const cBlockSize = ZSTDv06_getcBlockSize(ip, remainingSize, &blockProperties);
 3644|     13|        if (ZSTDv06_isError(cBlockSize)) {
  ------------------
  |  | 2731|     13|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3644:13): [True: 0, False: 13]
  ------------------
 3645|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, cBlockSize);
 3646|      0|            return;
 3647|      0|        }
 3648|       |
 3649|     13|        ip += ZSTDv06_blockHeaderSize;
 3650|     13|        remainingSize -= ZSTDv06_blockHeaderSize;
 3651|     13|        if (cBlockSize > remainingSize) {
  ------------------
  |  Branch (3651:13): [True: 1, False: 12]
  ------------------
 3652|      1|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3653|      1|            return;
 3654|      1|        }
 3655|       |
 3656|     12|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3656:13): [True: 8, False: 4]
  ------------------
 3657|       |
 3658|      4|        ip += cBlockSize;
 3659|      4|        remainingSize -= cBlockSize;
 3660|      4|        nbBlocks++;
 3661|      4|    }
 3662|       |
 3663|      8|    *cSize = ip - (const BYTE*)src;
 3664|      8|    *dBound = nbBlocks * ZSTDv06_BLOCKSIZE_MAX;
  ------------------
  |  |  344|      8|#define ZSTDv06_BLOCKSIZE_MAX (128 * 1024)   /* define, for static allocation */
  ------------------
 3665|      8|}
ZSTDv06_decompressBegin_usingDict:
 3827|      8|{
 3828|      8|    { size_t const errorCode = ZSTDv06_decompressBegin(dctx);
 3829|      8|      if (ZSTDv06_isError(errorCode)) return errorCode; }
  ------------------
  |  | 2731|      8|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3829:11): [True: 0, False: 8]
  ------------------
 3830|       |
 3831|      8|    if (dict && dictSize) {
  ------------------
  |  Branch (3831:9): [True: 8, False: 0]
  |  Branch (3831:17): [True: 0, False: 8]
  ------------------
 3832|      0|        size_t const errorCode = ZSTDv06_decompress_insertDictionary(dctx, dict, dictSize);
 3833|      0|        if (ZSTDv06_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2731|      0|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
                      if (ZSTDv06_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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 (3833:13): [True: 0, False: 0]
  ------------------
 3834|      0|    }
 3835|       |
 3836|      8|    return 0;
 3837|      8|}
zstd_v06.c:MEM_readLE32:
  190|     22|{
  191|     22|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (191:9): [True: 22, False: 0]
  ------------------
  192|     22|        return MEM_read32(memPtr);
  193|      0|    else
  194|      0|        return MEM_swap32(MEM_read32(memPtr));
  195|     22|}
zstd_v06.c:MEM_isLittleEndian:
  108|     29|{
  109|     29|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  110|     29|    return one.c[0];
  111|     29|}
zstd_v06.c:MEM_read32:
  119|     22|{
  120|     22|    U32 val; memcpy(&val, memPtr, sizeof(val)); return val;
  121|     22|}
zstd_v06.c:BITv06_highbit32:
  802|      4|{
  803|       |#   if defined(_MSC_VER)   /* Visual */
  804|       |    unsigned long r;
  805|       |    return _BitScanReverse(&r, val) ? (unsigned)r : 0;
  806|       |#   elif defined(__GNUC__) && (__GNUC__ >= 3)   /* Use GCC Intrinsic */
  807|       |    return __builtin_clz (val) ^ 31;
  808|       |#   else   /* Software version */
  809|       |    static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 };
  810|       |    U32 v = val;
  811|       |    unsigned r;
  812|       |    v |= v >> 1;
  813|       |    v |= v >> 2;
  814|       |    v |= v >> 4;
  815|       |    v |= v >> 8;
  816|       |    v |= v >> 16;
  817|       |    r = DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27];
  818|       |    return r;
  819|       |#   endif
  820|      4|}
zstd_v06.c:BITv06_skipBits:
  883|    896|{
  884|    896|    bitD->bitsConsumed += nbBits;
  885|    896|}
zstd_v06.c:BITv06_lookBitsFast:
  877|    896|{
  878|    896|    U32 const bitMask = sizeof(bitD->bitContainer)*8 - 1;
  879|    896|    return (bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> (((bitMask+1)-nbBits) & bitMask);
  880|    896|}
zstd_v06.c:HUFv06_readStats:
 1801|      2|{
 1802|      2|    U32 weightTotal;
 1803|      2|    const BYTE* ip = (const BYTE*) src;
 1804|      2|    size_t iSize;
 1805|      2|    size_t oSize;
 1806|       |
 1807|      2|    if (!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 (1807:9): [True: 0, False: 2]
  ------------------
 1808|      2|    iSize = ip[0];
 1809|       |    /* memset(huffWeight, 0, hwSize); */   /* is not necessary, even though some analyzer complain ... */
 1810|       |
 1811|      2|    if (iSize >= 128)  { /* special header */
  ------------------
  |  Branch (1811:9): [True: 1, False: 1]
  ------------------
 1812|      1|        if (iSize >= (242)) {  /* RLE */
  ------------------
  |  Branch (1812:13): [True: 1, False: 0]
  ------------------
 1813|      1|            static U32 l[14] = { 1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64, 127, 128 };
 1814|      1|            oSize = l[iSize-242];
 1815|      1|            memset(huffWeight, 1, hwSize);
 1816|      1|            iSize = 0;
 1817|      1|        }
 1818|      0|        else {   /* Incompressible */
 1819|      0|            oSize = iSize - 127;
 1820|      0|            iSize = ((oSize+1)/2);
 1821|      0|            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 (1821:17): [True: 0, False: 0]
  ------------------
 1822|      0|            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 (1822:17): [True: 0, False: 0]
  ------------------
 1823|      0|            ip += 1;
 1824|      0|            {   U32 n;
 1825|      0|                for (n=0; n<oSize; n+=2) {
  ------------------
  |  Branch (1825:27): [True: 0, False: 0]
  ------------------
 1826|      0|                    huffWeight[n]   = ip[n/2] >> 4;
 1827|      0|                    huffWeight[n+1] = ip[n/2] & 15;
 1828|      0|    }   }   }   }
 1829|      1|    else  {   /* header compressed with FSE (normal case) */
 1830|      1|        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 (1830:13): [True: 0, False: 1]
  ------------------
 1831|      1|        oSize = FSEv06_decompress(huffWeight, hwSize-1, ip+1, iSize);   /* max (hwSize-1) values decoded, as last one is implied */
 1832|      1|        if (FSEv06_isError(oSize)) return oSize;
  ------------------
  |  | 1357|      1|#define FSEv06_isError ERR_isError
  ------------------
  |  Branch (1832:13): [True: 1, False: 0]
  ------------------
 1833|      1|    }
 1834|       |
 1835|       |    /* collect weight stats */
 1836|      1|    memset(rankStats, 0, (HUFv06_ABSOLUTEMAX_TABLELOG + 1) * sizeof(U32));
  ------------------
  |  | 1783|      1|#define HUFv06_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv06_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
 1837|      1|    weightTotal = 0;
 1838|     33|    {   U32 n; for (n=0; n<oSize; n++) {
  ------------------
  |  Branch (1838:26): [True: 32, False: 1]
  ------------------
 1839|     32|            if (huffWeight[n] >= HUFv06_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1783|     32|#define HUFv06_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv06_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                          if (huffWeight[n] >= HUFv06_ABSOLUTEMAX_TABLELOG) 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 (1839:17): [True: 0, False: 32]
  ------------------
 1840|     32|            rankStats[huffWeight[n]]++;
 1841|     32|            weightTotal += (1 << huffWeight[n]) >> 1;
 1842|     32|    }   }
 1843|      1|    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 (1843:9): [True: 0, False: 1]
  ------------------
 1844|       |
 1845|       |    /* get last non-null symbol weight (implied, total must be 2^n) */
 1846|      1|    {   U32 const tableLog = BITv06_highbit32(weightTotal) + 1;
 1847|      1|        if (tableLog > HUFv06_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected);
  ------------------
  |  | 1783|      1|#define HUFv06_ABSOLUTEMAX_TABLELOG  16   /* absolute limit of HUFv06_MAX_TABLELOG. Beyond that value, code does not work */
  ------------------
                      if (tableLog > HUFv06_ABSOLUTEMAX_TABLELOG) 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 (1847:13): [True: 0, False: 1]
  ------------------
 1848|      1|        *tableLogPtr = tableLog;
 1849|       |        /* determine last weight */
 1850|      1|        {   U32 const total = 1 << tableLog;
 1851|      1|            U32 const rest = total - weightTotal;
 1852|      1|            U32 const verif = 1 << BITv06_highbit32(rest);
 1853|      1|            U32 const lastWeight = BITv06_highbit32(rest) + 1;
 1854|      1|            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 (1854:17): [True: 0, False: 1]
  ------------------
 1855|      1|            huffWeight[oSize] = (BYTE)lastWeight;
 1856|      1|            rankStats[lastWeight]++;
 1857|      1|    }   }
 1858|       |
 1859|       |    /* check tree construction validity */
 1860|      1|    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 (1860:9): [True: 0, False: 1]
  |  Branch (1860:31): [True: 0, False: 1]
  ------------------
 1861|       |
 1862|       |    /* results */
 1863|      1|    *nbSymbolsPtr = (U32)(oSize+1);
 1864|      1|    return iSize+1;
 1865|      1|}
zstd_v06.c:HUFv06_isError:
 1199|      5|static unsigned HUFv06_isError(size_t code) { return ERR_isError(code); }
zstd_v06.c:BITv06_initDStream:
  834|      1|{
  835|      1|    if (srcSize < 1) { 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 (835:9): [True: 0, False: 1]
  ------------------
  836|       |
  837|      1|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (837:9): [True: 0, False: 1]
  ------------------
  838|      0|        bitD->start = (const char*)srcBuffer;
  839|      0|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  840|      0|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  841|      0|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  842|      0|          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 (842:15): [True: 0, False: 0]
  ------------------
  843|      0|          bitD->bitsConsumed = 8 - BITv06_highbit32(lastByte); }
  844|      1|    } else {
  845|      1|        bitD->start = (const char*)srcBuffer;
  846|      1|        bitD->ptr   = bitD->start;
  847|      1|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  848|      1|        switch(srcSize)
  849|      1|        {
  850|      0|            case 7: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);/* fall-through */
  ------------------
  |  Branch (850:13): [True: 0, False: 1]
  ------------------
  851|      0|            case 6: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);/* fall-through */
  ------------------
  |  Branch (851:13): [True: 0, False: 1]
  ------------------
  852|      0|            case 5: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);/* fall-through */
  ------------------
  |  Branch (852:13): [True: 0, False: 1]
  ------------------
  853|      0|            case 4: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[3]) << 24; /* fall-through */
  ------------------
  |  Branch (853:13): [True: 0, False: 1]
  ------------------
  854|      0|            case 3: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[2]) << 16; /* fall-through */
  ------------------
  |  Branch (854:13): [True: 0, False: 1]
  ------------------
  855|      0|            case 2: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[1]) <<  8; /* fall-through */
  ------------------
  |  Branch (855:13): [True: 0, False: 1]
  ------------------
  856|      1|            default: break;
  ------------------
  |  Branch (856:13): [True: 1, False: 0]
  ------------------
  857|      1|        }
  858|      1|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  859|      1|          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 (859:15): [True: 0, False: 1]
  ------------------
  860|      1|          bitD->bitsConsumed = 8 - BITv06_highbit32(lastByte); }
  861|      0|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  862|      1|    }
  863|       |
  864|      1|    return srcSize;
  865|      1|}
zstd_v06.c:MEM_32bits:
  104|      8|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_v06.c:HUFv06_decodeStreamX2:
 2014|      1|{
 2015|      1|    BYTE* const pStart = p;
 2016|       |
 2017|       |    /* up to 4 symbols at a time */
 2018|      1|    while ((BITv06_reloadDStream(bitDPtr) == BITv06_DStream_unfinished) && (p <= pEnd-4)) {
  ------------------
  |  Branch (2018:12): [True: 0, False: 1]
  |  Branch (2018:76): [True: 0, False: 0]
  ------------------
 2019|      0|        HUFv06_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 2010|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 2011|      0|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|      0|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2020|      0|        HUFv06_DECODE_SYMBOLX2_1(p, bitDPtr);
  ------------------
  |  | 2006|      0|    if (MEM_64bits() || (HUFv06_MAX_TABLELOG<=12)) \
  |  |  ------------------
  |  |  |  | 1784|      0|#define HUFv06_MAX_TABLELOG  12           /* max configured tableLog (for static allocation); can be modified up to HUFv06_ABSOLUTEMAX_TABLELOG */
  |  |  ------------------
  |  |  |  Branch (2006:9): [True: 0, False: 0]
  |  |  |  Branch (2006:25): [True: 0, Folded]
  |  |  ------------------
  |  | 2007|      0|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|      0|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2021|      0|        HUFv06_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 2010|      0|    if (MEM_64bits()) \
  |  |  ------------------
  |  |  |  Branch (2010:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 2011|      0|        HUFv06_DECODE_SYMBOLX2_0(ptr, DStreamPtr)
  |  |  ------------------
  |  |  |  | 2003|      0|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  |  |  ------------------
  ------------------
 2022|      0|        HUFv06_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 2003|      0|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2023|      0|    }
 2024|       |
 2025|       |    /* closer to the end */
 2026|      1|    while ((BITv06_reloadDStream(bitDPtr) == BITv06_DStream_unfinished) && (p < pEnd))
  ------------------
  |  Branch (2026:12): [True: 0, False: 1]
  |  Branch (2026:76): [True: 0, False: 0]
  ------------------
 2027|      0|        HUFv06_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 2003|      0|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2028|       |
 2029|       |    /* no more data to retrieve from bitstream, hence no need to reload */
 2030|    897|    while (p < pEnd)
  ------------------
  |  Branch (2030:12): [True: 896, False: 1]
  ------------------
 2031|    896|        HUFv06_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 2003|    896|    *ptr++ = HUFv06_decodeSymbolX2(DStreamPtr, dt, dtLog)
  ------------------
 2032|       |
 2033|      1|    return pEnd-pStart;
 2034|      1|}
zstd_v06.c:BITv06_endOfDStream:
  935|      1|{
  936|      1|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (936:13): [True: 1, False: 0]
  |  Branch (936:49): [True: 0, False: 1]
  ------------------
  937|      1|}
zstd_v06.c:MEM_readLE16:
  169|      1|{
  170|      1|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (170:9): [True: 1, False: 0]
  ------------------
  171|      1|        return MEM_read16(memPtr);
  172|      0|    else {
  173|      0|        const BYTE* p = (const BYTE*)memPtr;
  174|      0|        return (U16)(p[0] + (p[1]<<8));
  175|      0|    }
  176|      1|}
zstd_v06.c:MEM_read16:
  114|      1|{
  115|      1|    U16 val; memcpy(&val, memPtr, sizeof(val)); return val;
  116|      1|}
zstd_v06.c:BITv06_reloadDStream:
  904|      2|{
  905|      2|    if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))  /* should never happen */
  ------------------
  |  Branch (905:9): [True: 0, False: 2]
  ------------------
  906|      0|        return BITv06_DStream_overflow;
  907|       |
  908|      2|    if (bitD->ptr >= bitD->start + sizeof(bitD->bitContainer)) {
  ------------------
  |  Branch (908:9): [True: 0, False: 2]
  ------------------
  909|      0|        bitD->ptr -= bitD->bitsConsumed >> 3;
  910|      0|        bitD->bitsConsumed &= 7;
  911|      0|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  912|      0|        return BITv06_DStream_unfinished;
  913|      0|    }
  914|      2|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (914:9): [True: 2, False: 0]
  ------------------
  915|      2|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BITv06_DStream_endOfBuffer;
  ------------------
  |  Branch (915:13): [True: 2, False: 0]
  ------------------
  916|      0|        return BITv06_DStream_completed;
  917|      2|    }
  918|      0|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  919|      0|        BITv06_DStream_status result = BITv06_DStream_unfinished;
  920|      0|        if (bitD->ptr - nbBytes < bitD->start) {
  ------------------
  |  Branch (920:13): [True: 0, False: 0]
  ------------------
  921|      0|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  922|      0|            result = BITv06_DStream_endOfBuffer;
  923|      0|        }
  924|      0|        bitD->ptr -= nbBytes;
  925|      0|        bitD->bitsConsumed -= nbBytes*8;
  926|      0|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD) */
  927|      0|        return result;
  928|      2|    }
  929|      2|}
zstd_v06.c:HUFv06_decodeSymbolX2:
 1995|    896|{
 1996|    896|    const size_t val = BITv06_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
 1997|    896|    const BYTE c = dt[val].byte;
 1998|    896|    BITv06_skipBits(Dstream, dt[val].nbBits);
 1999|    896|    return c;
 2000|    896|}
zstd_v06.c:ZSTDv06_frameHeaderSize:
 2912|     30|{
 2913|     30|    if (srcSize < ZSTDv06_frameHeaderSize_min) 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 (2913:9): [True: 0, False: 30]
  ------------------
 2914|     30|    { U32 const fcsId = (((const BYTE*)src)[4]) >> 6;
 2915|     30|      return ZSTDv06_frameHeaderSize_min + ZSTDv06_fcs_fieldSize[fcsId]; }
 2916|     30|}
zstd_v06.c:MEM_readLE64:
  199|      6|{
  200|      6|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (200:9): [True: 6, False: 0]
  ------------------
  201|      6|        return MEM_read64(memPtr);
  202|      0|    else
  203|      0|        return MEM_swap64(MEM_read64(memPtr));
  204|      6|}
zstd_v06.c:MEM_read64:
  124|      6|{
  125|      6|    U64 val; memcpy(&val, memPtr, sizeof(val)); return val;
  126|      6|}
zstd_v06.c:ZSTDv06_checkContinuity:
 3465|      8|{
 3466|      8|    if (dst != dctx->previousDstEnd) {   /* not contiguous */
  ------------------
  |  Branch (3466:9): [True: 8, False: 0]
  ------------------
 3467|      8|        dctx->dictEnd = dctx->previousDstEnd;
 3468|      8|        dctx->vBase = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3469|      8|        dctx->base = dst;
 3470|      8|        dctx->previousDstEnd = dst;
 3471|      8|    }
 3472|      8|}
zstd_v06.c:ZSTDv06_decompressBlock_internal:
 3478|      3|{   /* blockType == blockCompressed */
 3479|      3|    const BYTE* ip = (const BYTE*)src;
 3480|       |
 3481|      3|    if (srcSize >= ZSTDv06_BLOCKSIZE_MAX) return ERROR(srcSize_wrong);
  ------------------
  |  |  344|      3|#define ZSTDv06_BLOCKSIZE_MAX (128 * 1024)   /* define, for static allocation */
  ------------------
                  if (srcSize >= ZSTDv06_BLOCKSIZE_MAX) 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 (3481:9): [True: 0, False: 3]
  ------------------
 3482|       |
 3483|       |    /* Decode literals sub-block */
 3484|      3|    {   size_t const litCSize = ZSTDv06_decodeLiteralsBlock(dctx, src, srcSize);
 3485|      3|        if (ZSTDv06_isError(litCSize)) return litCSize;
  ------------------
  |  | 2731|      3|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3485:13): [True: 3, False: 0]
  ------------------
 3486|      0|        ip += litCSize;
 3487|      0|        srcSize -= litCSize;
 3488|      0|    }
 3489|      0|    return ZSTDv06_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 3490|      3|}
zstd_v06.c:ZSTDv06_decodeLiteralsBlock:
 3000|      3|{
 3001|      3|    const BYTE* const istart = (const BYTE*) src;
 3002|       |
 3003|       |    /* any compressed block with literals segment must be at least this size */
 3004|      3|    if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |  424|      3|#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */)   /* for a non-null block */
  |  |  ------------------
  |  |  |  |  423|      3|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  |  |  ------------------
  ------------------
                  if (srcSize < MIN_CBLOCK_SIZE) 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 (3004:9): [True: 0, False: 3]
  ------------------
 3005|       |
 3006|      3|    switch(istart[0]>> 6)
 3007|      3|    {
 3008|      2|    case IS_HUF:
  ------------------
  |  |  428|      2|#define IS_HUF 0
  ------------------
  |  Branch (3008:5): [True: 2, False: 1]
  ------------------
 3009|      2|        {   size_t litSize, litCSize, singleStream=0;
 3010|      2|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3011|      2|            if (srcSize < 5) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for lhSize, + cSize (+nbSeq) */
  ------------------
  |  |   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 (3011:17): [True: 0, False: 2]
  ------------------
 3012|      2|            switch(lhSize)
 3013|      2|            {
 3014|      2|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3014:13): [True: 0, False: 2]
  |  Branch (3014:21): [True: 2, False: 0]
  |  Branch (3014:29): [True: 0, False: 2]
  ------------------
 3015|       |                /* 2 - 2 - 10 - 10 */
 3016|      2|                lhSize=3;
 3017|      2|                singleStream = istart[0] & 16;
 3018|      2|                litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 3019|      2|                litCSize = ((istart[1] &  3) << 8) + istart[2];
 3020|      2|                break;
 3021|      0|            case 2:
  ------------------
  |  Branch (3021:13): [True: 0, False: 2]
  ------------------
 3022|       |                /* 2 - 2 - 14 - 14 */
 3023|      0|                lhSize=4;
 3024|      0|                litSize  = ((istart[0] & 15) << 10) + (istart[1] << 2) + (istart[2] >> 6);
 3025|      0|                litCSize = ((istart[2] & 63) <<  8) + istart[3];
 3026|      0|                break;
 3027|      0|            case 3:
  ------------------
  |  Branch (3027:13): [True: 0, False: 2]
  ------------------
 3028|       |                /* 2 - 2 - 18 - 18 */
 3029|      0|                lhSize=5;
 3030|      0|                litSize  = ((istart[0] & 15) << 14) + (istart[1] << 6) + (istart[2] >> 2);
 3031|      0|                litCSize = ((istart[2] &  3) << 16) + (istart[3] << 8) + istart[4];
 3032|      0|                break;
 3033|      2|            }
 3034|      2|            if (litSize > ZSTDv06_BLOCKSIZE_MAX) return ERROR(corruption_detected);
  ------------------
  |  |  344|      2|#define ZSTDv06_BLOCKSIZE_MAX (128 * 1024)   /* define, for static allocation */
  ------------------
                          if (litSize > ZSTDv06_BLOCKSIZE_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 (3034:17): [True: 0, False: 2]
  ------------------
 3035|      2|            if (litCSize + lhSize > srcSize) 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 (3035:17): [True: 0, False: 2]
  ------------------
 3036|       |
 3037|      2|            if (HUFv06_isError(singleStream ?
  ------------------
  |  | 2733|      2|#define HUFv06_isError  ERR_isError
  ------------------
  |  Branch (3037:17): [True: 2, False: 0]
  |  Branch (3037:32): [True: 2, False: 0]
  ------------------
 3038|      2|                            HUFv06_decompress1X2(dctx->litBuffer, litSize, istart+lhSize, litCSize) :
 3039|      2|                            HUFv06_decompress   (dctx->litBuffer, litSize, istart+lhSize, litCSize) ))
 3040|      2|                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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3041|       |
 3042|      0|            dctx->litPtr = dctx->litBuffer;
 3043|      0|            dctx->litSize = litSize;
 3044|      0|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  487|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3045|      0|            return litCSize + lhSize;
 3046|      2|        }
 3047|      0|    case IS_PCH:
  ------------------
  |  |  429|      0|#define IS_PCH 1
  ------------------
  |  Branch (3047:5): [True: 0, False: 3]
  ------------------
 3048|      0|        {   size_t litSize, litCSize;
 3049|      0|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3050|      0|            if (lhSize != 1)  /* only case supported for now : small litSize, single stream */
  ------------------
  |  Branch (3050:17): [True: 0, False: 0]
  ------------------
 3051|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3052|      0|            if (!dctx->flagRepeatTable)
  ------------------
  |  Branch (3052:17): [True: 0, False: 0]
  ------------------
 3053|      0|                return ERROR(dictionary_corrupted);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3054|       |
 3055|       |            /* 2 - 2 - 10 - 10 */
 3056|      0|            lhSize=3;
 3057|      0|            litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 3058|      0|            litCSize = ((istart[1] &  3) << 8) + istart[2];
 3059|      0|            if (litCSize + lhSize > srcSize) 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 (3059:17): [True: 0, False: 0]
  ------------------
 3060|       |
 3061|      0|            {   size_t const errorCode = HUFv06_decompress1X4_usingDTable(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->hufTableX4);
 3062|      0|                if (HUFv06_isError(errorCode)) return ERROR(corruption_detected);
  ------------------
  |  | 2733|      0|#define HUFv06_isError  ERR_isError
  ------------------
                              if (HUFv06_isError(errorCode)) 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 (3062:21): [True: 0, False: 0]
  ------------------
 3063|      0|            }
 3064|      0|            dctx->litPtr = dctx->litBuffer;
 3065|      0|            dctx->litSize = litSize;
 3066|      0|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  487|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3067|      0|            return litCSize + lhSize;
 3068|      0|        }
 3069|      0|    case IS_RAW:
  ------------------
  |  |  430|      0|#define IS_RAW 2
  ------------------
  |  Branch (3069:5): [True: 0, False: 3]
  ------------------
 3070|      0|        {   size_t litSize;
 3071|      0|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3072|      0|            switch(lhSize)
 3073|      0|            {
 3074|      0|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3074:13): [True: 0, False: 0]
  |  Branch (3074:21): [True: 0, False: 0]
  |  Branch (3074:29): [True: 0, False: 0]
  ------------------
 3075|      0|                lhSize=1;
 3076|      0|                litSize = istart[0] & 31;
 3077|      0|                break;
 3078|      0|            case 2:
  ------------------
  |  Branch (3078:13): [True: 0, False: 0]
  ------------------
 3079|      0|                litSize = ((istart[0] & 15) << 8) + istart[1];
 3080|      0|                break;
 3081|      0|            case 3:
  ------------------
  |  Branch (3081:13): [True: 0, False: 0]
  ------------------
 3082|      0|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 3083|      0|                break;
 3084|      0|            }
 3085|       |
 3086|      0|            if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  |  487|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
  |  Branch (3086:17): [True: 0, False: 0]
  ------------------
 3087|      0|                if (litSize+lhSize > srcSize) 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 (3087:21): [True: 0, False: 0]
  ------------------
 3088|      0|                memcpy(dctx->litBuffer, istart+lhSize, litSize);
 3089|      0|                dctx->litPtr = dctx->litBuffer;
 3090|      0|                dctx->litSize = litSize;
 3091|      0|                memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |  487|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3092|      0|                return lhSize+litSize;
 3093|      0|            }
 3094|       |            /* direct reference into compressed stream */
 3095|      0|            dctx->litPtr = istart+lhSize;
 3096|      0|            dctx->litSize = litSize;
 3097|      0|            return lhSize+litSize;
 3098|      0|        }
 3099|      1|    case IS_RLE:
  ------------------
  |  |  431|      1|#define IS_RLE 3
  ------------------
  |  Branch (3099:5): [True: 1, False: 2]
  ------------------
 3100|      1|        {   size_t litSize;
 3101|      1|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3102|      1|            switch(lhSize)
 3103|      1|            {
 3104|      0|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3104:13): [True: 0, False: 1]
  |  Branch (3104:21): [True: 0, False: 1]
  |  Branch (3104:29): [True: 0, False: 1]
  ------------------
 3105|      0|                lhSize = 1;
 3106|      0|                litSize = istart[0] & 31;
 3107|      0|                break;
 3108|      0|            case 2:
  ------------------
  |  Branch (3108:13): [True: 0, False: 1]
  ------------------
 3109|      0|                litSize = ((istart[0] & 15) << 8) + istart[1];
 3110|      0|                break;
 3111|      1|            case 3:
  ------------------
  |  Branch (3111:13): [True: 1, False: 0]
  ------------------
 3112|      1|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 3113|      1|                if (srcSize<4) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need lhSize+1 = 4 */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3113:21): [True: 1, False: 0]
  ------------------
 3114|      0|                break;
 3115|      1|            }
 3116|      0|            if (litSize > ZSTDv06_BLOCKSIZE_MAX) return ERROR(corruption_detected);
  ------------------
  |  |  344|      0|#define ZSTDv06_BLOCKSIZE_MAX (128 * 1024)   /* define, for static allocation */
  ------------------
                          if (litSize > ZSTDv06_BLOCKSIZE_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 (3116:17): [True: 0, False: 0]
  ------------------
 3117|      0|            memset(dctx->litBuffer, istart[lhSize], litSize + WILDCOPY_OVERLENGTH);
  ------------------
  |  |  487|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3118|      0|            dctx->litPtr = dctx->litBuffer;
 3119|      0|            dctx->litSize = litSize;
 3120|      0|            return lhSize+1;
 3121|      0|        }
 3122|      0|    default:
  ------------------
  |  Branch (3122:5): [True: 0, False: 3]
  ------------------
 3123|      0|        return ERROR(corruption_detected);   /* 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3124|      3|    }
 3125|      3|}
zstd_v06.c:ZSTDv06_decompressFrame:
 3507|      8|{
 3508|      8|    const BYTE* ip = (const BYTE*)src;
 3509|      8|    const BYTE* const iend = ip + srcSize;
 3510|      8|    BYTE* const ostart = (BYTE*)dst;
 3511|      8|    BYTE* op = ostart;
 3512|      8|    BYTE* const oend = ostart + dstCapacity;
 3513|      8|    size_t remainingSize = srcSize;
 3514|      8|    blockProperties_t blockProperties = { bt_compressed, 0 };
 3515|       |
 3516|       |    /* check */
 3517|      8|    if (srcSize < ZSTDv06_frameHeaderSize_min+ZSTDv06_blockHeaderSize) 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 (3517:9): [True: 0, False: 8]
  ------------------
 3518|       |
 3519|       |    /* Frame Header */
 3520|      8|    {   size_t const frameHeaderSize = ZSTDv06_frameHeaderSize(src, ZSTDv06_frameHeaderSize_min);
 3521|      8|        if (ZSTDv06_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  | 2731|      8|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3521:13): [True: 0, False: 8]
  ------------------
 3522|      8|        if (srcSize < frameHeaderSize+ZSTDv06_blockHeaderSize) 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 (3522:13): [True: 0, False: 8]
  ------------------
 3523|      8|        if (ZSTDv06_decodeFrameHeader(dctx, src, frameHeaderSize)) 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 (3523:13): [True: 0, False: 8]
  ------------------
 3524|      8|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3525|      8|    }
 3526|       |
 3527|       |    /* Loop on each block */
 3528|      8|    while (1) {
  ------------------
  |  Branch (3528:12): [True: 8, Folded]
  ------------------
 3529|      8|        size_t decodedSize=0;
 3530|      8|        size_t const cBlockSize = ZSTDv06_getcBlockSize(ip, iend-ip, &blockProperties);
 3531|      8|        if (ZSTDv06_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  | 2731|      8|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3531:13): [True: 0, False: 8]
  ------------------
 3532|       |
 3533|      8|        ip += ZSTDv06_blockHeaderSize;
 3534|      8|        remainingSize -= ZSTDv06_blockHeaderSize;
 3535|      8|        if (cBlockSize > remainingSize) 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 (3535:13): [True: 0, False: 8]
  ------------------
 3536|       |
 3537|      8|        switch(blockProperties.blockType)
 3538|      8|        {
 3539|      3|        case bt_compressed:
  ------------------
  |  Branch (3539:9): [True: 3, False: 5]
  ------------------
 3540|      3|            decodedSize = ZSTDv06_decompressBlock_internal(dctx, op, oend-op, ip, cBlockSize);
 3541|      3|            break;
 3542|      0|        case bt_raw :
  ------------------
  |  Branch (3542:9): [True: 0, False: 8]
  ------------------
 3543|      0|            decodedSize = ZSTDv06_copyRawBlock(op, oend-op, ip, cBlockSize);
 3544|      0|            break;
 3545|      0|        case bt_rle :
  ------------------
  |  Branch (3545:9): [True: 0, False: 8]
  ------------------
 3546|      0|            return ERROR(GENERIC);   /* not yet supported */
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3547|      0|            break;
 3548|      5|        case bt_end :
  ------------------
  |  Branch (3548:9): [True: 5, False: 3]
  ------------------
 3549|       |            /* end of frame */
 3550|      5|            if (remainingSize) 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 (3550:17): [True: 0, False: 5]
  ------------------
 3551|      5|            break;
 3552|      5|        default:
  ------------------
  |  Branch (3552:9): [True: 0, False: 8]
  ------------------
 3553|      0|            return ERROR(GENERIC);   /* 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3554|      8|        }
 3555|      8|        if (cBlockSize == 0) break;   /* bt_end */
  ------------------
  |  Branch (3555:13): [True: 5, False: 3]
  ------------------
 3556|       |
 3557|      3|        if (ZSTDv06_isError(decodedSize)) return decodedSize;
  ------------------
  |  | 2731|      3|#define ZSTDv06_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3557:13): [True: 3, False: 0]
  ------------------
 3558|      0|        op += decodedSize;
 3559|      0|        ip += cBlockSize;
 3560|      0|        remainingSize -= cBlockSize;
 3561|      0|    }
 3562|       |
 3563|      5|    return op-ostart;
 3564|      8|}
zstd_v06.c:ZSTD_errorFrameSizeInfoLegacy:
 3612|      1|{
 3613|      1|    *cSize = ret;
 3614|      1|    *dBound = ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  |  454|      1|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
 3615|      1|}
zstd_v06.c:ZSTDv06_getcBlockSize:
 2971|     21|{
 2972|     21|    const BYTE* const in = (const BYTE*)src;
 2973|     21|    U32 cSize;
 2974|       |
 2975|     21|    if (srcSize < ZSTDv06_blockHeaderSize) 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 (2975:9): [True: 0, False: 21]
  ------------------
 2976|       |
 2977|     21|    bpPtr->blockType = (blockType_t)((*in) >> 6);
 2978|     21|    cSize = in[2] + (in[1]<<8) + ((in[0] & 7)<<16);
 2979|     21|    bpPtr->origSize = (bpPtr->blockType == bt_rle) ? cSize : 0;
  ------------------
  |  Branch (2979:23): [True: 1, False: 20]
  ------------------
 2980|       |
 2981|     21|    if (bpPtr->blockType == bt_end) return 0;
  ------------------
  |  Branch (2981:9): [True: 13, False: 8]
  ------------------
 2982|      8|    if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (2982:9): [True: 1, False: 7]
  ------------------
 2983|      7|    return cSize;
 2984|      8|}
zstd_v06.c:ZSTDv06_decodeFrameHeader:
 2955|      8|{
 2956|      8|    size_t const result = ZSTDv06_getFrameParams(&(zc->fParams), src, srcSize);
 2957|      8|    if ((MEM_32bits()) && (zc->fParams.windowLog > 25)) return ERROR(frameParameter_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 (2957:9): [True: 0, False: 8]
  |  Branch (2957:27): [True: 0, False: 0]
  ------------------
 2958|      8|    return result;
 2959|      8|}

ZSTDv07_decompressBegin:
 2908|     18|{
 2909|     18|    dctx->expected = ZSTDv07_frameHeaderSize_min;
 2910|     18|    dctx->stage = ZSTDds_getFrameHeaderSize;
 2911|     18|    dctx->previousDstEnd = NULL;
 2912|     18|    dctx->base = NULL;
 2913|     18|    dctx->vBase = NULL;
 2914|     18|    dctx->dictEnd = NULL;
 2915|     18|    dctx->hufTable[0] = (HUFv07_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);
  ------------------
  |  | 2665|     18|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
 2916|     18|    dctx->litEntropy = dctx->fseEntropy = 0;
 2917|     18|    dctx->dictID = 0;
 2918|     72|    { int i; for (i=0; i<ZSTDv07_REP_NUM; i++) dctx->rep[i] = repStartValue[i]; }
  ------------------
  |  | 2638|     72|#define ZSTDv07_REP_NUM    3
  ------------------
  |  Branch (2918:24): [True: 54, False: 18]
  ------------------
 2919|     18|    return 0;
 2920|     18|}
ZSTDv07_createDCtx_advanced:
 2923|      9|{
 2924|      9|    ZSTDv07_DCtx* dctx;
 2925|       |
 2926|      9|    if (!customMem.customAlloc && !customMem.customFree)
  ------------------
  |  Branch (2926:9): [True: 0, False: 9]
  |  Branch (2926:35): [True: 0, False: 0]
  ------------------
 2927|      0|        customMem = defaultCustomMem;
 2928|       |
 2929|      9|    if (!customMem.customAlloc || !customMem.customFree)
  ------------------
  |  Branch (2929:9): [True: 0, False: 9]
  |  Branch (2929:35): [True: 0, False: 9]
  ------------------
 2930|      0|        return NULL;
 2931|       |
 2932|      9|    dctx = (ZSTDv07_DCtx*) customMem.customAlloc(customMem.opaque, sizeof(ZSTDv07_DCtx));
 2933|      9|    if (!dctx) return NULL;
  ------------------
  |  Branch (2933:9): [True: 0, False: 9]
  ------------------
 2934|      9|    memcpy(&dctx->customMem, &customMem, sizeof(ZSTDv07_customMem));
 2935|      9|    ZSTDv07_decompressBegin(dctx);
 2936|      9|    return dctx;
 2937|      9|}
ZSTDv07_createDCtx:
 2940|      9|{
 2941|      9|    return ZSTDv07_createDCtx_advanced(defaultCustomMem);
 2942|      9|}
ZSTDv07_freeDCtx:
 2945|      9|{
 2946|      9|    if (dctx==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (2946:9): [True: 0, False: 9]
  ------------------
 2947|      9|    dctx->customMem.customFree(dctx->customMem.opaque, dctx);
 2948|      9|    return 0;   /* reserved as a potential error code in the future */
 2949|      9|}
ZSTDv07_getFrameParams:
 3096|     12|{
 3097|     12|    const BYTE* ip = (const BYTE*)src;
 3098|       |
 3099|     12|    if (srcSize < ZSTDv07_frameHeaderSize_min) return ZSTDv07_frameHeaderSize_min;
  ------------------
  |  Branch (3099:9): [True: 0, False: 12]
  ------------------
 3100|     12|    memset(fparamsPtr, 0, sizeof(*fparamsPtr));
 3101|     12|    if (MEM_readLE32(src) != ZSTDv07_MAGICNUMBER) {
  ------------------
  |  |  180|     12|#define ZSTDv07_MAGICNUMBER            0xFD2FB527   /* v0.7 */
  ------------------
  |  Branch (3101:9): [True: 0, False: 12]
  ------------------
 3102|      0|        if ((MEM_readLE32(src) & 0xFFFFFFF0U) == ZSTDv07_MAGIC_SKIPPABLE_START) {
  ------------------
  |  |   41|      0|#define ZSTDv07_MAGIC_SKIPPABLE_START  0x184D2A50U
  ------------------
  |  Branch (3102:13): [True: 0, False: 0]
  ------------------
 3103|      0|            if (srcSize < ZSTDv07_skippableHeaderSize) return ZSTDv07_skippableHeaderSize; /* magic number + skippable frame length */
  ------------------
  |  Branch (3103:17): [True: 0, False: 0]
  ------------------
 3104|      0|            fparamsPtr->frameContentSize = MEM_readLE32((const char *)src + 4);
 3105|      0|            fparamsPtr->windowSize = 0; /* windowSize==0 means a frame is skippable */
 3106|      0|            return 0;
 3107|      0|        }
 3108|      0|        return ERROR(prefix_unknown);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3109|      0|    }
 3110|       |
 3111|       |    /* ensure there is enough `srcSize` to fully read/decode frame header */
 3112|     12|    { size_t const fhsize = ZSTDv07_frameHeaderSize(src, srcSize);
 3113|     12|      if (srcSize < fhsize) return fhsize; }
  ------------------
  |  Branch (3113:11): [True: 0, False: 12]
  ------------------
 3114|       |
 3115|     12|    {   BYTE const fhdByte = ip[4];
 3116|     12|        size_t pos = 5;
 3117|     12|        U32 const dictIDSizeCode = fhdByte&3;
 3118|     12|        U32 const checksumFlag = (fhdByte>>2)&1;
 3119|     12|        U32 const directMode = (fhdByte>>5)&1;
 3120|     12|        U32 const fcsID = fhdByte>>6;
 3121|     12|        U32 const windowSizeMax = 1U << ZSTDv07_WINDOWLOG_MAX;
  ------------------
  |  |   45|     12|#define ZSTDv07_WINDOWLOG_MAX    ((U32)(MEM_32bits() ? ZSTDv07_WINDOWLOG_MAX_32 : ZSTDv07_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  |   43|      0|#define ZSTDv07_WINDOWLOG_MAX_32  25
  |  |  ------------------
  |  |               #define ZSTDv07_WINDOWLOG_MAX    ((U32)(MEM_32bits() ? ZSTDv07_WINDOWLOG_MAX_32 : ZSTDv07_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  |   44|     12|#define ZSTDv07_WINDOWLOG_MAX_64  27
  |  |  ------------------
  |  |  |  Branch (45:41): [True: 0, False: 12]
  |  |  ------------------
  ------------------
 3122|     12|        U32 windowSize = 0;
 3123|     12|        U32 dictID = 0;
 3124|     12|        U64 frameContentSize = 0;
 3125|     12|        if ((fhdByte & 0x08) != 0)   /* reserved bits, which must be zero */
  ------------------
  |  Branch (3125:13): [True: 0, False: 12]
  ------------------
 3126|      0|            return ERROR(frameParameter_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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3127|     12|        if (!directMode) {
  ------------------
  |  Branch (3127:13): [True: 5, False: 7]
  ------------------
 3128|      5|            BYTE const wlByte = ip[pos++];
 3129|      5|            U32 const windowLog = (wlByte >> 3) + ZSTDv07_WINDOWLOG_ABSOLUTEMIN;
  ------------------
  |  | 2654|      5|#define ZSTDv07_WINDOWLOG_ABSOLUTEMIN 10
  ------------------
 3130|      5|            if (windowLog > ZSTDv07_WINDOWLOG_MAX)
  ------------------
  |  |   45|      5|#define ZSTDv07_WINDOWLOG_MAX    ((U32)(MEM_32bits() ? ZSTDv07_WINDOWLOG_MAX_32 : ZSTDv07_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  |   43|      0|#define ZSTDv07_WINDOWLOG_MAX_32  25
  |  |  ------------------
  |  |               #define ZSTDv07_WINDOWLOG_MAX    ((U32)(MEM_32bits() ? ZSTDv07_WINDOWLOG_MAX_32 : ZSTDv07_WINDOWLOG_MAX_64))
  |  |  ------------------
  |  |  |  |   44|      5|#define ZSTDv07_WINDOWLOG_MAX_64  27
  |  |  ------------------
  |  |  |  Branch (45:41): [True: 0, False: 5]
  |  |  ------------------
  ------------------
  |  Branch (3130:17): [True: 1, False: 4]
  ------------------
 3131|      1|                return ERROR(frameParameter_unsupported);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3132|      4|            windowSize = (1U << windowLog);
 3133|      4|            windowSize += (windowSize >> 3) * (wlByte&7);
 3134|      4|        }
 3135|       |
 3136|     11|        switch(dictIDSizeCode)
 3137|     11|        {
 3138|      0|            default:   /* impossible */
  ------------------
  |  Branch (3138:13): [True: 0, False: 11]
  ------------------
 3139|      8|            case 0 : break;
  ------------------
  |  Branch (3139:13): [True: 8, False: 3]
  ------------------
 3140|      0|            case 1 : dictID = ip[pos]; pos++; break;
  ------------------
  |  Branch (3140:13): [True: 0, False: 11]
  ------------------
 3141|      0|            case 2 : dictID = MEM_readLE16(ip+pos); pos+=2; break;
  ------------------
  |  Branch (3141:13): [True: 0, False: 11]
  ------------------
 3142|      3|            case 3 : dictID = MEM_readLE32(ip+pos); pos+=4; break;
  ------------------
  |  Branch (3142:13): [True: 3, False: 8]
  ------------------
 3143|     11|        }
 3144|     11|        switch(fcsID)
 3145|     11|        {
 3146|      0|            default:   /* impossible */
  ------------------
  |  Branch (3146:13): [True: 0, False: 11]
  ------------------
 3147|      2|            case 0 : if (directMode) frameContentSize = ip[pos]; break;
  ------------------
  |  Branch (3147:13): [True: 2, False: 9]
  |  Branch (3147:26): [True: 2, False: 0]
  ------------------
 3148|      1|            case 1 : frameContentSize = MEM_readLE16(ip+pos)+256; break;
  ------------------
  |  Branch (3148:13): [True: 1, False: 10]
  ------------------
 3149|      5|            case 2 : frameContentSize = MEM_readLE32(ip+pos); break;
  ------------------
  |  Branch (3149:13): [True: 5, False: 6]
  ------------------
 3150|      3|            case 3 : frameContentSize = MEM_readLE64(ip+pos); break;
  ------------------
  |  Branch (3150:13): [True: 3, False: 8]
  ------------------
 3151|     11|        }
 3152|     11|        if (!windowSize) windowSize = (U32)frameContentSize;
  ------------------
  |  Branch (3152:13): [True: 7, False: 4]
  ------------------
 3153|     11|        if (windowSize > windowSizeMax)
  ------------------
  |  Branch (3153:13): [True: 2, False: 9]
  ------------------
 3154|      2|            return ERROR(frameParameter_unsupported);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3155|      9|        fparamsPtr->frameContentSize = frameContentSize;
 3156|      9|        fparamsPtr->windowSize = windowSize;
 3157|      9|        fparamsPtr->dictID = dictID;
 3158|      9|        fparamsPtr->checksumFlag = checksumFlag;
 3159|      9|    }
 3160|      0|    return 0;
 3161|     11|}
ZSTDv07_decompress_usingDict:
 3824|      9|{
 3825|      9|    ZSTDv07_decompressBegin_usingDict(dctx, dict, dictSize);
 3826|      9|    ZSTDv07_checkContinuity(dctx, dst);
 3827|      9|    return ZSTDv07_decompressFrame(dctx, dst, dstCapacity, src, srcSize);
 3828|      9|}
ZSTDv07_findFrameSizeInfoLegacy:
 3861|     11|{
 3862|     11|    const BYTE* ip = (const BYTE*)src;
 3863|     11|    size_t remainingSize = srcSize;
 3864|     11|    size_t nbBlocks = 0;
 3865|       |
 3866|       |    /* check */
 3867|     11|    if (srcSize < ZSTDv07_frameHeaderSize_min+ZSTDv07_blockHeaderSize) {
  ------------------
  |  Branch (3867:9): [True: 0, False: 11]
  ------------------
 3868|      0|        ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3869|      0|        return;
 3870|      0|    }
 3871|       |
 3872|       |    /* Frame Header */
 3873|     11|    {   size_t const frameHeaderSize = ZSTDv07_frameHeaderSize(src, srcSize);
 3874|     11|        if (ZSTDv07_isError(frameHeaderSize)) {
  ------------------
  |  | 2856|     11|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3874:13): [True: 0, False: 11]
  ------------------
 3875|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, frameHeaderSize);
 3876|      0|            return;
 3877|      0|        }
 3878|     11|        if (MEM_readLE32(src) != ZSTDv07_MAGICNUMBER) {
  ------------------
  |  |  180|     11|#define ZSTDv07_MAGICNUMBER            0xFD2FB527   /* v0.7 */
  ------------------
  |  Branch (3878:13): [True: 0, False: 11]
  ------------------
 3879|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(prefix_unknown));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3880|      0|            return;
 3881|      0|        }
 3882|     11|        if (srcSize < frameHeaderSize+ZSTDv07_blockHeaderSize) {
  ------------------
  |  Branch (3882:13): [True: 1, False: 10]
  ------------------
 3883|      1|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3884|      1|            return;
 3885|      1|        }
 3886|     10|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3887|     10|    }
 3888|       |
 3889|       |    /* Loop on each block */
 3890|     11|    while (1) {
  ------------------
  |  Branch (3890:12): [True: 11, Folded]
  ------------------
 3891|     11|        blockProperties_t blockProperties;
 3892|     11|        size_t const cBlockSize = ZSTDv07_getcBlockSize(ip, remainingSize, &blockProperties);
 3893|     11|        if (ZSTDv07_isError(cBlockSize)) {
  ------------------
  |  | 2856|     11|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3893:13): [True: 0, False: 11]
  ------------------
 3894|      0|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, cBlockSize);
 3895|      0|            return;
 3896|      0|        }
 3897|       |
 3898|     11|        ip += ZSTDv07_blockHeaderSize;
 3899|     11|        remainingSize -= ZSTDv07_blockHeaderSize;
 3900|       |
 3901|     11|        if (blockProperties.blockType == bt_end) break;
  ------------------
  |  Branch (3901:13): [True: 9, False: 2]
  ------------------
 3902|       |
 3903|      2|        if (cBlockSize > remainingSize) {
  ------------------
  |  Branch (3903:13): [True: 1, False: 1]
  ------------------
 3904|      1|            ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong));
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3905|      1|            return;
 3906|      1|        }
 3907|       |
 3908|      1|        ip += cBlockSize;
 3909|      1|        remainingSize -= cBlockSize;
 3910|      1|        nbBlocks++;
 3911|      1|    }
 3912|       |
 3913|      9|    *cSize = ip - (const BYTE*)src;
 3914|      9|    *dBound = nbBlocks * ZSTDv07_BLOCKSIZE_ABSOLUTEMAX;
  ------------------
  |  |  175|      9|#define ZSTDv07_BLOCKSIZE_ABSOLUTEMAX (128 * 1024)   /* define, for static allocation */
  ------------------
 3915|      9|}
ZSTDv07_decompressBegin_usingDict:
 4115|      9|{
 4116|      9|    { size_t const errorCode = ZSTDv07_decompressBegin(dctx);
 4117|      9|      if (ZSTDv07_isError(errorCode)) return errorCode; }
  ------------------
  |  | 2856|      9|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (4117:11): [True: 0, False: 9]
  ------------------
 4118|       |
 4119|      9|    if (dict && dictSize) {
  ------------------
  |  Branch (4119:9): [True: 9, False: 0]
  |  Branch (4119:17): [True: 0, False: 9]
  ------------------
 4120|      0|        size_t const errorCode = ZSTDv07_decompress_insertDictionary(dctx, dict, dictSize);
 4121|      0|        if (ZSTDv07_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  | 2856|      0|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
                      if (ZSTDv07_isError(errorCode)) return ERROR(dictionary_corrupted);
  ------------------
  |  |   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 (4121:13): [True: 0, False: 0]
  ------------------
 4122|      0|    }
 4123|       |
 4124|      9|    return 0;
 4125|      9|}
zstd_v07.c:MEM_readLE32:
  350|     31|{
  351|     31|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (351:9): [True: 31, False: 0]
  ------------------
  352|     31|        return MEM_read32(memPtr);
  353|      0|    else
  354|      0|        return MEM_swap32(MEM_read32(memPtr));
  355|     31|}
zstd_v07.c:MEM_isLittleEndian:
  268|     35|{
  269|     35|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental  */
  270|     35|    return one.c[0];
  271|     35|}
zstd_v07.c:MEM_read32:
  279|     31|{
  280|     31|    U32 val; memcpy(&val, memPtr, sizeof(val)); return val;
  281|     31|}
zstd_v07.c:ZSTDv07_defaultAllocFunction:
 2577|      9|{
 2578|      9|    void* address = malloc(size);
 2579|      9|    (void)opaque;
 2580|       |    /* printf("alloc %p, %d opaque=%p \n", address, (int)size, opaque); */
 2581|      9|    return address;
 2582|      9|}
zstd_v07.c:ZSTDv07_defaultFreeFunction:
 2585|      9|{
 2586|      9|    (void)opaque;
 2587|       |    /* if (address) printf("free %p opaque=%p \n", address, opaque); */
 2588|      9|    free(address);
 2589|      9|}
zstd_v07.c:ZSTDv07_frameHeaderSize:
 3078|     32|{
 3079|     32|    if (srcSize < ZSTDv07_frameHeaderSize_min) 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 (3079:9): [True: 0, False: 32]
  ------------------
 3080|     32|    {   BYTE const fhd = ((const BYTE*)src)[4];
 3081|     32|        U32 const dictID= fhd & 3;
 3082|     32|        U32 const directMode = (fhd >> 5) & 1;
 3083|     32|        U32 const fcsId = fhd >> 6;
 3084|     32|        return ZSTDv07_frameHeaderSize_min + !directMode + ZSTDv07_did_fieldSize[dictID] + ZSTDv07_fcs_fieldSize[fcsId]
 3085|     32|                + (directMode && !ZSTDv07_fcs_fieldSize[fcsId]);
  ------------------
  |  Branch (3085:20): [True: 21, False: 11]
  |  Branch (3085:34): [True: 7, False: 14]
  ------------------
 3086|     32|    }
 3087|     32|}
zstd_v07.c:MEM_32bits:
  264|     17|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_v07.c:MEM_readLE16:
  329|      1|{
  330|      1|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (330:9): [True: 1, False: 0]
  ------------------
  331|      1|        return MEM_read16(memPtr);
  332|      0|    else {
  333|      0|        const BYTE* p = (const BYTE*)memPtr;
  334|      0|        return (U16)(p[0] + (p[1]<<8));
  335|      0|    }
  336|      1|}
zstd_v07.c:MEM_read16:
  274|      1|{
  275|      1|    U16 val; memcpy(&val, memPtr, sizeof(val)); return val;
  276|      1|}
zstd_v07.c:MEM_readLE64:
  359|      3|{
  360|      3|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (360:9): [True: 3, False: 0]
  ------------------
  361|      3|        return MEM_read64(memPtr);
  362|      0|    else
  363|      0|        return MEM_swap64(MEM_read64(memPtr));
  364|      3|}
zstd_v07.c:MEM_read64:
  284|      3|{
  285|      3|    U64 val; memcpy(&val, memPtr, sizeof(val)); return val;
  286|      3|}
zstd_v07.c:ZSTDv07_checkContinuity:
 3678|      9|{
 3679|      9|    if (dst != dctx->previousDstEnd) {   /* not contiguous */
  ------------------
  |  Branch (3679:9): [True: 9, False: 0]
  ------------------
 3680|      9|        dctx->dictEnd = dctx->previousDstEnd;
 3681|      9|        dctx->vBase = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->base));
 3682|      9|        dctx->base = dst;
 3683|      9|        dctx->previousDstEnd = dst;
 3684|      9|    }
 3685|      9|}
zstd_v07.c:ZSTDv07_decompressBlock_internal:
 3691|      1|{   /* blockType == blockCompressed */
 3692|      1|    const BYTE* ip = (const BYTE*)src;
 3693|       |
 3694|      1|    if (srcSize >= ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) return ERROR(srcSize_wrong);
  ------------------
  |  |  175|      1|#define ZSTDv07_BLOCKSIZE_ABSOLUTEMAX (128 * 1024)   /* define, for static allocation */
  ------------------
                  if (srcSize >= ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) 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 (3694:9): [True: 0, False: 1]
  ------------------
 3695|       |
 3696|       |    /* Decode literals sub-block */
 3697|      1|    {   size_t const litCSize = ZSTDv07_decodeLiteralsBlock(dctx, src, srcSize);
 3698|      1|        if (ZSTDv07_isError(litCSize)) return litCSize;
  ------------------
  |  | 2856|      1|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3698:13): [True: 1, False: 0]
  ------------------
 3699|      0|        ip += litCSize;
 3700|      0|        srcSize -= litCSize;
 3701|      0|    }
 3702|      0|    return ZSTDv07_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 3703|      1|}
zstd_v07.c:ZSTDv07_decodeLiteralsBlock:
 3231|      1|{
 3232|      1|    const BYTE* const istart = (const BYTE*) src;
 3233|       |
 3234|      1|    if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  | 2663|      1|#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */)   /* for a non-null block */
  |  |  ------------------
  |  |  |  | 2662|      1|#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */
  |  |  ------------------
  ------------------
                  if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3234:9): [True: 1, False: 0]
  ------------------
 3235|       |
 3236|      0|    switch((litBlockType_t)(istart[0]>> 6))
 3237|      0|    {
 3238|      0|    case lbt_huffman:
  ------------------
  |  Branch (3238:5): [True: 0, False: 0]
  ------------------
 3239|      0|        {   size_t litSize, litCSize, singleStream=0;
 3240|      0|            U32 lhSize = (istart[0] >> 4) & 3;
 3241|      0|            if (srcSize < 5) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for lhSize, + cSize (+nbSeq) */
  ------------------
  |  |   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 (3241:17): [True: 0, False: 0]
  ------------------
 3242|      0|            switch(lhSize)
 3243|      0|            {
 3244|      0|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3244:13): [True: 0, False: 0]
  |  Branch (3244:21): [True: 0, False: 0]
  |  Branch (3244:29): [True: 0, False: 0]
  ------------------
 3245|       |                /* 2 - 2 - 10 - 10 */
 3246|      0|                lhSize=3;
 3247|      0|                singleStream = istart[0] & 16;
 3248|      0|                litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 3249|      0|                litCSize = ((istart[1] &  3) << 8) + istart[2];
 3250|      0|                break;
 3251|      0|            case 2:
  ------------------
  |  Branch (3251:13): [True: 0, False: 0]
  ------------------
 3252|       |                /* 2 - 2 - 14 - 14 */
 3253|      0|                lhSize=4;
 3254|      0|                litSize  = ((istart[0] & 15) << 10) + (istart[1] << 2) + (istart[2] >> 6);
 3255|      0|                litCSize = ((istart[2] & 63) <<  8) + istart[3];
 3256|      0|                break;
 3257|      0|            case 3:
  ------------------
  |  Branch (3257:13): [True: 0, False: 0]
  ------------------
 3258|       |                /* 2 - 2 - 18 - 18 */
 3259|      0|                lhSize=5;
 3260|      0|                litSize  = ((istart[0] & 15) << 14) + (istart[1] << 6) + (istart[2] >> 2);
 3261|      0|                litCSize = ((istart[2] &  3) << 16) + (istart[3] << 8) + istart[4];
 3262|      0|                break;
 3263|      0|            }
 3264|      0|            if (litSize > ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) return ERROR(corruption_detected);
  ------------------
  |  |  175|      0|#define ZSTDv07_BLOCKSIZE_ABSOLUTEMAX (128 * 1024)   /* define, for static allocation */
  ------------------
                          if (litSize > ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) 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 (3264:17): [True: 0, False: 0]
  ------------------
 3265|      0|            if (litCSize + lhSize > srcSize) 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 (3265:17): [True: 0, False: 0]
  ------------------
 3266|       |
 3267|      0|            if (HUFv07_isError(singleStream ?
  ------------------
  |  | 2858|      0|#define HUFv07_isError  ERR_isError
  ------------------
  |  Branch (3267:17): [True: 0, False: 0]
  |  Branch (3267:32): [True: 0, False: 0]
  ------------------
 3268|      0|                            HUFv07_decompress1X2_DCtx(dctx->hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize) :
 3269|      0|                            HUFv07_decompress4X_hufOnly (dctx->hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize) ))
 3270|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3271|       |
 3272|      0|            dctx->litPtr = dctx->litBuffer;
 3273|      0|            dctx->litSize = litSize;
 3274|      0|            dctx->litEntropy = 1;
 3275|      0|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  | 2721|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3276|      0|            return litCSize + lhSize;
 3277|      0|        }
 3278|      0|    case lbt_repeat:
  ------------------
  |  Branch (3278:5): [True: 0, False: 0]
  ------------------
 3279|      0|        {   size_t litSize, litCSize;
 3280|      0|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3281|      0|            if (lhSize != 1)  /* only case supported for now : small litSize, single stream */
  ------------------
  |  Branch (3281:17): [True: 0, False: 0]
  ------------------
 3282|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3283|      0|            if (dctx->litEntropy==0)
  ------------------
  |  Branch (3283:17): [True: 0, False: 0]
  ------------------
 3284|      0|                return ERROR(dictionary_corrupted);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3285|       |
 3286|       |            /* 2 - 2 - 10 - 10 */
 3287|      0|            lhSize=3;
 3288|      0|            litSize  = ((istart[0] & 15) << 6) + (istart[1] >> 2);
 3289|      0|            litCSize = ((istart[1] &  3) << 8) + istart[2];
 3290|      0|            if (litCSize + lhSize > srcSize) 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 (3290:17): [True: 0, False: 0]
  ------------------
 3291|       |
 3292|      0|            {   size_t const errorCode = HUFv07_decompress1X4_usingDTable(dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->hufTable);
 3293|      0|                if (HUFv07_isError(errorCode)) return ERROR(corruption_detected);
  ------------------
  |  | 2858|      0|#define HUFv07_isError  ERR_isError
  ------------------
                              if (HUFv07_isError(errorCode)) 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 (3293:21): [True: 0, False: 0]
  ------------------
 3294|      0|            }
 3295|      0|            dctx->litPtr = dctx->litBuffer;
 3296|      0|            dctx->litSize = litSize;
 3297|      0|            memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  | 2721|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3298|      0|            return litCSize + lhSize;
 3299|      0|        }
 3300|      0|    case lbt_raw:
  ------------------
  |  Branch (3300:5): [True: 0, False: 0]
  ------------------
 3301|      0|        {   size_t litSize;
 3302|      0|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3303|      0|            switch(lhSize)
 3304|      0|            {
 3305|      0|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3305:13): [True: 0, False: 0]
  |  Branch (3305:21): [True: 0, False: 0]
  |  Branch (3305:29): [True: 0, False: 0]
  ------------------
 3306|      0|                lhSize=1;
 3307|      0|                litSize = istart[0] & 31;
 3308|      0|                break;
 3309|      0|            case 2:
  ------------------
  |  Branch (3309:13): [True: 0, False: 0]
  ------------------
 3310|      0|                litSize = ((istart[0] & 15) << 8) + istart[1];
 3311|      0|                break;
 3312|      0|            case 3:
  ------------------
  |  Branch (3312:13): [True: 0, False: 0]
  ------------------
 3313|      0|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 3314|      0|                break;
 3315|      0|            }
 3316|       |
 3317|      0|            if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  | 2721|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
  |  Branch (3317:17): [True: 0, False: 0]
  ------------------
 3318|      0|                if (litSize+lhSize > srcSize) 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 (3318:21): [True: 0, False: 0]
  ------------------
 3319|      0|                memcpy(dctx->litBuffer, istart+lhSize, litSize);
 3320|      0|                dctx->litPtr = dctx->litBuffer;
 3321|      0|                dctx->litSize = litSize;
 3322|      0|                memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  | 2721|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3323|      0|                return lhSize+litSize;
 3324|      0|            }
 3325|       |            /* direct reference into compressed stream */
 3326|      0|            dctx->litPtr = istart+lhSize;
 3327|      0|            dctx->litSize = litSize;
 3328|      0|            return lhSize+litSize;
 3329|      0|        }
 3330|      0|    case lbt_rle:
  ------------------
  |  Branch (3330:5): [True: 0, False: 0]
  ------------------
 3331|      0|        {   size_t litSize;
 3332|      0|            U32 lhSize = ((istart[0]) >> 4) & 3;
 3333|      0|            switch(lhSize)
 3334|      0|            {
 3335|      0|            case 0: case 1: default:   /* note : default is impossible, since lhSize into [0..3] */
  ------------------
  |  Branch (3335:13): [True: 0, False: 0]
  |  Branch (3335:21): [True: 0, False: 0]
  |  Branch (3335:29): [True: 0, False: 0]
  ------------------
 3336|      0|                lhSize = 1;
 3337|      0|                litSize = istart[0] & 31;
 3338|      0|                break;
 3339|      0|            case 2:
  ------------------
  |  Branch (3339:13): [True: 0, False: 0]
  ------------------
 3340|      0|                litSize = ((istart[0] & 15) << 8) + istart[1];
 3341|      0|                break;
 3342|      0|            case 3:
  ------------------
  |  Branch (3342:13): [True: 0, False: 0]
  ------------------
 3343|      0|                litSize = ((istart[0] & 15) << 16) + (istart[1] << 8) + istart[2];
 3344|      0|                if (srcSize<4) return ERROR(corruption_detected);   /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need lhSize+1 = 4 */
  ------------------
  |  |   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 (3344:21): [True: 0, False: 0]
  ------------------
 3345|      0|                break;
 3346|      0|            }
 3347|      0|            if (litSize > ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) return ERROR(corruption_detected);
  ------------------
  |  |  175|      0|#define ZSTDv07_BLOCKSIZE_ABSOLUTEMAX (128 * 1024)   /* define, for static allocation */
  ------------------
                          if (litSize > ZSTDv07_BLOCKSIZE_ABSOLUTEMAX) 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 (3347:17): [True: 0, False: 0]
  ------------------
 3348|      0|            memset(dctx->litBuffer, istart[lhSize], litSize + WILDCOPY_OVERLENGTH);
  ------------------
  |  | 2721|      0|#define WILDCOPY_OVERLENGTH 8
  ------------------
 3349|      0|            dctx->litPtr = dctx->litBuffer;
 3350|      0|            dctx->litSize = litSize;
 3351|      0|            return lhSize+1;
 3352|      0|        }
 3353|      0|    default:
  ------------------
  |  Branch (3353:5): [True: 0, False: 0]
  ------------------
 3354|      0|        return ERROR(corruption_detected);   /* 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3355|      0|    }
 3356|      0|}
zstd_v07.c:ZSTDv07_decompressFrame:
 3743|      9|{
 3744|      9|    const BYTE* ip = (const BYTE*)src;
 3745|      9|    const BYTE* const iend = ip + srcSize;
 3746|      9|    BYTE* const ostart = (BYTE*)dst;
 3747|      9|    BYTE* const oend = ostart + dstCapacity;
 3748|      9|    BYTE* op = ostart;
 3749|      9|    size_t remainingSize = srcSize;
 3750|       |
 3751|       |    /* check */
 3752|      9|    if (srcSize < ZSTDv07_frameHeaderSize_min+ZSTDv07_blockHeaderSize) 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 (3752:9): [True: 0, False: 9]
  ------------------
 3753|       |
 3754|       |    /* Frame Header */
 3755|      9|    {   size_t const frameHeaderSize = ZSTDv07_frameHeaderSize(src, ZSTDv07_frameHeaderSize_min);
 3756|      9|        if (ZSTDv07_isError(frameHeaderSize)) return frameHeaderSize;
  ------------------
  |  | 2856|      9|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3756:13): [True: 0, False: 9]
  ------------------
 3757|      9|        if (srcSize < frameHeaderSize+ZSTDv07_blockHeaderSize) 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 (3757:13): [True: 0, False: 9]
  ------------------
 3758|      9|        if (ZSTDv07_decodeFrameHeader(dctx, src, frameHeaderSize)) return ERROR(corruption_detected);
  ------------------
  |  |   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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3758:13): [True: 5, False: 4]
  ------------------
 3759|      4|        ip += frameHeaderSize; remainingSize -= frameHeaderSize;
 3760|      4|    }
 3761|       |
 3762|       |    /* Loop on each block */
 3763|      4|    while (1) {
  ------------------
  |  Branch (3763:12): [True: 4, Folded]
  ------------------
 3764|      4|        size_t decodedSize;
 3765|      4|        blockProperties_t blockProperties;
 3766|      4|        size_t const cBlockSize = ZSTDv07_getcBlockSize(ip, iend-ip, &blockProperties);
 3767|      4|        if (ZSTDv07_isError(cBlockSize)) return cBlockSize;
  ------------------
  |  | 2856|      4|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3767:13): [True: 0, False: 4]
  ------------------
 3768|       |
 3769|      4|        ip += ZSTDv07_blockHeaderSize;
 3770|      4|        remainingSize -= ZSTDv07_blockHeaderSize;
 3771|      4|        if (cBlockSize > remainingSize) 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 (3771:13): [True: 0, False: 4]
  ------------------
 3772|       |
 3773|      4|        switch(blockProperties.blockType)
 3774|      4|        {
 3775|      1|        case bt_compressed:
  ------------------
  |  Branch (3775:9): [True: 1, False: 3]
  ------------------
 3776|      1|            decodedSize = ZSTDv07_decompressBlock_internal(dctx, op, oend-op, ip, cBlockSize);
 3777|      1|            break;
 3778|      0|        case bt_raw :
  ------------------
  |  Branch (3778:9): [True: 0, False: 4]
  ------------------
 3779|      0|            decodedSize = ZSTDv07_copyRawBlock(op, oend-op, ip, cBlockSize);
 3780|      0|            break;
 3781|      0|        case bt_rle :
  ------------------
  |  Branch (3781:9): [True: 0, False: 4]
  ------------------
 3782|      0|            decodedSize = ZSTDv07_generateNxBytes(op, oend-op, *ip, blockProperties.origSize);
 3783|      0|            break;
 3784|      3|        case bt_end :
  ------------------
  |  Branch (3784:9): [True: 3, False: 1]
  ------------------
 3785|       |            /* end of frame */
 3786|      3|            if (remainingSize) 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 (3786:17): [True: 0, False: 3]
  ------------------
 3787|      3|            decodedSize = 0;
 3788|      3|            break;
 3789|      0|        default:
  ------------------
  |  Branch (3789:9): [True: 0, False: 4]
  ------------------
 3790|      0|            return ERROR(GENERIC);   /* 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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3791|      4|        }
 3792|      4|        if (blockProperties.blockType == bt_end) break;   /* bt_end */
  ------------------
  |  Branch (3792:13): [True: 3, False: 1]
  ------------------
 3793|       |
 3794|      1|        if (ZSTDv07_isError(decodedSize)) return decodedSize;
  ------------------
  |  | 2856|      1|#define ZSTDv07_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (3794:13): [True: 1, False: 0]
  ------------------
 3795|      0|        if (dctx->fParams.checksumFlag) XXH64_update(&dctx->xxhState, op, decodedSize);
  ------------------
  |  |  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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3795:13): [True: 0, False: 0]
  ------------------
 3796|      0|        op += decodedSize;
 3797|      0|        ip += cBlockSize;
 3798|      0|        remainingSize -= cBlockSize;
 3799|      0|    }
 3800|       |
 3801|      3|    return op-ostart;
 3802|      4|}
zstd_v07.c:ZSTD_errorFrameSizeInfoLegacy:
 3855|      2|{
 3856|      2|    *cSize = ret;
 3857|      2|    *dBound = ZSTD_CONTENTSIZE_ERROR;
  ------------------
  |  | 2688|      2|#define ZSTD_CONTENTSIZE_ERROR   (0ULL - 2)
  ------------------
 3858|      2|}
zstd_v07.c:ZSTDv07_getcBlockSize:
 3201|     15|{
 3202|     15|    const BYTE* const in = (const BYTE*)src;
 3203|     15|    U32 cSize;
 3204|       |
 3205|     15|    if (srcSize < ZSTDv07_blockHeaderSize) 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 (3205:9): [True: 0, False: 15]
  ------------------
 3206|       |
 3207|     15|    bpPtr->blockType = (blockType_t)((*in) >> 6);
 3208|     15|    cSize = in[2] + (in[1]<<8) + ((in[0] & 7)<<16);
 3209|     15|    bpPtr->origSize = (bpPtr->blockType == bt_rle) ? cSize : 0;
  ------------------
  |  Branch (3209:23): [True: 0, False: 15]
  ------------------
 3210|       |
 3211|     15|    if (bpPtr->blockType == bt_end) return 0;
  ------------------
  |  Branch (3211:9): [True: 12, False: 3]
  ------------------
 3212|      3|    if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (3212:9): [True: 0, False: 3]
  ------------------
 3213|      3|    return cSize;
 3214|      3|}
zstd_v07.c:ZSTDv07_decodeFrameHeader:
 3184|      9|{
 3185|      9|    size_t const result = ZSTDv07_getFrameParams(&(dctx->fParams), src, srcSize);
 3186|      9|    if (dctx->fParams.dictID && (dctx->dictID != dctx->fParams.dictID)) return ERROR(dictionary_wrong);
  ------------------
  |  |   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 (3186:9): [True: 2, False: 7]
  |  Branch (3186:33): [True: 2, False: 0]
  ------------------
 3187|      7|    if (dctx->fParams.checksumFlag) XXH64_reset(&dctx->xxhState, 0);
  ------------------
  |  |  459|      3|#  define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset)
  |  |  ------------------
  |  |  |  |  443|      3|#  define XXH_NAME2(A,B) XXH_CAT(A,B)
  |  |  |  |  ------------------
  |  |  |  |  |  |  442|      3|#  define XXH_CAT(A,B) A##B
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3187:9): [True: 3, False: 4]
  ------------------
 3188|      7|    return result;
 3189|      9|}

b2nd_serialize_meta:
   43|     87|                        uint8_t **smeta) {
   44|     87|  if (dtype == NULL) {
  ------------------
  |  Branch (44:7): [True: 0, False: 87]
  ------------------
   45|      0|    dtype = B2ND_DEFAULT_DTYPE;
  ------------------
  |  |   61|      0|#define B2ND_DEFAULT_DTYPE "|u1"
  ------------------
   46|      0|  }
   47|       |  // dtype checks
   48|     87|  if (dtype_format < 0) {
  ------------------
  |  Branch (48:7): [True: 0, False: 87]
  ------------------
   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|     87|  size_t dtype_len0 = strlen(dtype);
   53|     87|  if (dtype_len0 > INT32_MAX) {
  ------------------
  |  Branch (53:7): [True: 0, False: 87]
  ------------------
   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|     87|  const int32_t dtype_len = (int32_t) dtype_len0;
   58|       |  // Allocate space for b2nd metalayer
   59|     87|  int32_t max_smeta_len = (int32_t) (1 + 1 + 1 + (1 + ndim * (1 + sizeof(int64_t))) +
   60|     87|                                     (1 + ndim * (1 + sizeof(int32_t))) + (1 + ndim * (1 + sizeof(int32_t))) +
   61|     87|                                     1 + 1 + sizeof(int32_t) + dtype_len);
   62|     87|  *smeta = malloc((size_t) max_smeta_len);
   63|     87|  BLOSC_ERROR_NULL(*smeta, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
   64|     87|  uint8_t *pmeta = *smeta;
   65|       |
   66|       |  // Build an array with 7 entries (version, ndim, shape, chunkshape, blockshape, dtype_format, dtype)
   67|     87|  *pmeta++ = 0x90 + 7;
   68|       |
   69|       |  // version entry
   70|     87|  *pmeta++ = B2ND_METALAYER_VERSION;  // positive fixnum (7-bit positive integer)
  ------------------
  |  |   47|     87|#define B2ND_METALAYER_VERSION 0
  ------------------
   71|       |
   72|       |  // ndim entry
   73|     87|  *pmeta++ = (uint8_t) ndim;  // positive fixnum (7-bit positive integer)
   74|       |
   75|       |  // shape entry
   76|     87|  *pmeta++ = (uint8_t) (0x90) + ndim;  // fix array with ndim elements
   77|    385|  for (uint8_t i = 0; i < ndim; i++) {
  ------------------
  |  Branch (77:23): [True: 298, False: 87]
  ------------------
   78|    298|    *pmeta++ = 0xd3;  // int64
   79|    298|    swap_store(pmeta, shape + i, sizeof(int64_t));
   80|    298|    pmeta += sizeof(int64_t);
   81|    298|  }
   82|       |
   83|       |  // chunkshape entry
   84|     87|  *pmeta++ = (uint8_t) (0x90) + ndim;  // fix array with ndim elements
   85|    385|  for (uint8_t i = 0; i < ndim; i++) {
  ------------------
  |  Branch (85:23): [True: 298, False: 87]
  ------------------
   86|    298|    *pmeta++ = 0xd2;  // int32
   87|    298|    swap_store(pmeta, chunkshape + i, sizeof(int32_t));
   88|    298|    pmeta += sizeof(int32_t);
   89|    298|  }
   90|       |
   91|       |  // blockshape entry
   92|     87|  *pmeta++ = (uint8_t) (0x90) + ndim;  // fix array with ndim elements
   93|    385|  for (uint8_t i = 0; i < ndim; i++) {
  ------------------
  |  Branch (93:23): [True: 298, False: 87]
  ------------------
   94|    298|    *pmeta++ = 0xd2;  // int32
   95|    298|    swap_store(pmeta, blockshape + i, sizeof(int32_t));
   96|    298|    pmeta += sizeof(int32_t);
   97|    298|  }
   98|       |
   99|       |  // dtype entry
  100|     87|  *pmeta++ = dtype_format;  // positive fixint (7-bit positive integer)
  101|     87|  *pmeta++ = (uint8_t) (0xdb);  // str with up to 2^31 elements
  102|     87|  swap_store(pmeta, &dtype_len, sizeof(int32_t));
  103|     87|  pmeta += sizeof(int32_t);
  104|     87|  memcpy(pmeta, dtype, dtype_len);
  105|     87|  pmeta += dtype_len;
  106|       |
  107|     87|  int32_t slen = (int32_t) (pmeta - *smeta);
  108|     87|  if (max_smeta_len != slen) {
  ------------------
  |  Branch (108:7): [True: 0, False: 87]
  ------------------
  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|     87|  return (int)slen;
  114|     87|}
b2nd_deserialize_meta:
  118|  2.48k|                          int32_t *chunkshape, int32_t *blockshape, char **dtype, int8_t *dtype_format) {
  119|  2.48k|  return b2nd_deserialize_meta_inline(smeta, smeta_len, ndim, shape, chunkshape, blockshape, dtype, dtype_format);
  120|  2.48k|}
update_shape:
  302|    172|                 const int32_t *chunkshape, const int32_t *blockshape) {
  303|    172|  BLOSC_ERROR(update_shape_struct(array, ndim, shape, chunkshape, blockshape));
  ------------------
  |  |  111|    172|    do {                                            \
  |  |  112|    172|        int rc_ = (rc);                             \
  |  |  113|    172|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 172]
  |  |  ------------------
  |  |  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|    172|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 172]
  |  |  ------------------
  ------------------
  304|    172|  return publish_shape_meta(array);
  305|    172|}
array_without_schunk:
  380|    172|int array_without_schunk(b2nd_context_t *ctx, b2nd_array_t **array) {
  381|       |  /* Create a b2nd_array_t buffer */
  382|    172|  (*array) = (b2nd_array_t *) malloc(sizeof(b2nd_array_t));
  383|    172|  BLOSC_ERROR_NULL(*array, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    172|    do {                                            \
  |  |  105|    172|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 172]
  |  |  ------------------
  |  |  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|    172|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 172]
  |  |  ------------------
  ------------------
  384|       |
  385|    172|  (*array)->sc = NULL;
  386|    172|  (*array)->last_tick = 0;
  387|       |
  388|    172|  (*array)->ndim = ctx->ndim;
  389|    172|  int64_t *shape = ctx->shape;
  390|    172|  int32_t *chunkshape = ctx->chunkshape;
  391|    172|  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|    172|  int rc = update_shape(*array, ctx->ndim, shape, chunkshape, blockshape);
  396|    172|  if (rc < 0) {
  ------------------
  |  Branch (396:7): [True: 0, False: 172]
  ------------------
  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|    172|  if (ctx->dtype != NULL) {
  ------------------
  |  Branch (402:7): [True: 172, False: 0]
  ------------------
  403|    172|    (*array)->dtype = malloc(strlen(ctx->dtype) + 1);
  404|    172|    strcpy((*array)->dtype, ctx->dtype);
  405|    172|  } else {
  406|      0|    (*array)->dtype = NULL;
  407|      0|  }
  408|       |
  409|    172|  (*array)->dtype_format = ctx->dtype_format;
  410|       |
  411|       |  // The partition cache (empty initially)
  412|    172|  (*array)->chunk_cache.data = NULL;
  413|    172|  (*array)->chunk_cache.nchunk = -1;  // means no valid cache yet
  414|       |
  415|    172|  return BLOSC2_ERROR_SUCCESS;
  416|    172|}
array_new:
  419|     87|int array_new(b2nd_context_t *ctx, int special_value, b2nd_array_t **array) {
  420|     87|  BLOSC_ERROR(array_without_schunk(ctx, array));
  ------------------
  |  |  111|     87|    do {                                            \
  |  |  112|     87|        int rc_ = (rc);                             \
  |  |  113|     87|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  421|       |
  422|     87|  int rc = BLOSC2_ERROR_FAILURE;
  423|     87|  blosc2_schunk *sc = blosc2_schunk_new(ctx->b2_storage);
  424|     87|  if (sc == NULL) {
  ------------------
  |  Branch (424:7): [True: 0, False: 87]
  ------------------
  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|     87|  (*array)->sc = sc;
  430|       |  // Set the chunksize for the schunk, as it cannot be derived from storage
  431|     87|  if (sc->typesize <= 0) {
  ------------------
  |  Branch (431:7): [True: 0, False: 87]
  ------------------
  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|     87|  if ((*array)->extchunknitems < 0) {
  ------------------
  |  Branch (436:7): [True: 0, False: 87]
  ------------------
  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|     87|  if ((uint64_t)(*array)->extchunknitems > (uint64_t)SIZE_MAX) {
  ------------------
  |  Branch (441:7): [True: 0, False: 87]
  ------------------
  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|     87|  size_t chunkbytes_size = 0;
  447|     87|  if (!blosc2_checked_mul_size((size_t)(*array)->extchunknitems, (size_t)sc->typesize, &chunkbytes_size)) {
  ------------------
  |  Branch (447:7): [True: 0, False: 87]
  ------------------
  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|     87|  if (chunkbytes_size > BLOSC2_MAX_BUFFERSIZE || chunkbytes_size > INT32_MAX) {
  ------------------
  |  Branch (452:7): [True: 0, False: 87]
  |  Branch (452:50): [True: 0, False: 87]
  ------------------
  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|     87|  int32_t chunksize = (int32_t)chunkbytes_size;
  458|     87|  sc->chunksize = chunksize;
  459|       |
  460|       |  // Serialize the dimension info
  461|     87|  if (sc->nmetalayers >= BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1895|     87|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (461:7): [True: 0, False: 87]
  ------------------
  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|     87|  uint8_t *smeta = NULL;
  466|     87|  int32_t smeta_len = b2nd_serialize_meta(ctx->ndim,
  467|     87|                                          (*array)->shape,
  468|     87|                                          (*array)->chunkshape,
  469|     87|                                          (*array)->blockshape,
  470|     87|                                          (*array)->dtype,
  471|     87|                                          (*array)->dtype_format,
  472|     87|                                          &smeta);
  473|     87|  if (smeta_len < 0) {
  ------------------
  |  Branch (473:7): [True: 0, False: 87]
  ------------------
  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|     87|  int meta_rc = blosc2_meta_add(sc, "b2nd", smeta, smeta_len);
  480|     87|  free(smeta);
  481|     87|  if (meta_rc < 0) {
  ------------------
  |  Branch (481:7): [True: 0, False: 87]
  ------------------
  482|      0|    goto failed;
  483|      0|  }
  484|       |
  485|     87|  for (int i = 0; i < ctx->nmetalayers; ++i) {
  ------------------
  |  Branch (485:19): [True: 0, False: 87]
  ------------------
  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|     87|  if ((*array)->nitems != 0) {
  ------------------
  |  Branch (495:7): [True: 87, False: 0]
  ------------------
  496|     87|    int64_t nchunks = (*array)->extnitems / (*array)->chunknitems;
  497|     87|    int64_t nitems = nchunks * (*array)->extchunknitems;
  498|     87|    if (blosc2_schunk_fill_special(sc, nitems, special_value, chunksize) < 0) {
  ------------------
  |  Branch (498:9): [True: 0, False: 87]
  ------------------
  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|     87|  }
  503|       |
  504|     87|  return BLOSC2_ERROR_SUCCESS;
  505|       |
  506|      0|  failed:
  507|      0|  b2nd_free(*array);
  508|       |  *array = NULL;
  509|      0|  return rc;
  510|     87|}
b2nd_empty:
  523|     87|int b2nd_empty(b2nd_context_t *ctx, b2nd_array_t **array) {
  524|     87|  BLOSC_ERROR_NULL(ctx, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  525|     87|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  526|       |
  527|       |  // Fill with zeros to avoid variable cratios
  528|     87|  BLOSC_ERROR(array_new(ctx, BLOSC2_SPECIAL_ZERO, array));
  ------------------
  |  |  111|     87|    do {                                            \
  |  |  112|     87|        int rc_ = (rc);                             \
  |  |  113|     87|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  529|       |
  530|     87|  return BLOSC2_ERROR_SUCCESS;
  531|     87|}
b2nd_from_schunk:
  643|     85|int b2nd_from_schunk(blosc2_schunk *schunk, b2nd_array_t **array) {
  644|     85|  BLOSC_ERROR_NULL(schunk, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     85|    do {                                            \
  |  |  105|     85|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 85]
  |  |  ------------------
  |  |  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|     85|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 85]
  |  |  ------------------
  ------------------
  645|     85|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     85|    do {                                            \
  |  |  105|     85|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 85]
  |  |  ------------------
  |  |  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|     85|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 85]
  |  |  ------------------
  ------------------
  646|       |
  647|     85|  if (schunk == NULL) {
  ------------------
  |  Branch (647:7): [True: 0, False: 85]
  ------------------
  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|     85|  blosc2_cparams *cparams;
  653|     85|  if (blosc2_schunk_get_cparams(schunk, &cparams) < 0) {
  ------------------
  |  Branch (653:7): [True: 0, False: 85]
  ------------------
  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|     85|  free(cparams);
  658|       |
  659|     85|  b2nd_context_t params = {0};
  660|     85|  params.b2_storage = schunk->storage;
  661|       |
  662|       |  // Deserialize the b2nd metalayer
  663|     85|  uint8_t *smeta;
  664|     85|  int32_t smeta_len;
  665|     85|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (665:7): [True: 0, False: 85]
  ------------------
  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|     85|  int rc_meta = b2nd_deserialize_meta(smeta, smeta_len, &params.ndim, params.shape,
  672|     85|                                      params.chunkshape, params.blockshape, &params.dtype,
  673|     85|                                      &params.dtype_format);
  674|     85|  free(smeta);
  675|     85|  BLOSC_ERROR(rc_meta);
  ------------------
  |  |  111|     85|    do {                                            \
  |  |  112|     85|        int rc_ = (rc);                             \
  |  |  113|     85|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 85]
  |  |  ------------------
  |  |  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|     85|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 85]
  |  |  ------------------
  ------------------
  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|    377|  for (int i = 0; i < params.ndim; ++i) {
  ------------------
  |  Branch (687:19): [True: 292, False: 85]
  ------------------
  688|    292|    if (params.shape[i] != 0 &&
  ------------------
  |  Branch (688:9): [True: 292, False: 0]
  ------------------
  689|    292|        (params.chunkshape[i] == 0 || params.blockshape[i] == 0)) {
  ------------------
  |  Branch (689:10): [True: 0, False: 292]
  |  Branch (689:39): [True: 0, False: 292]
  ------------------
  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|    292|  }
  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|     85|  int rc = array_without_schunk(&params, array);
  700|     85|  free(params.dtype);
  701|     85|  BLOSC_ERROR(rc);
  ------------------
  |  |  111|     85|    do {                                            \
  |  |  112|     85|        int rc_ = (rc);                             \
  |  |  113|     85|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 85]
  |  |  ------------------
  |  |  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|     85|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 85]
  |  |  ------------------
  ------------------
  702|       |
  703|     85|  rc = check_schunk_matches_meta(schunk, *array);
  704|     85|  if (rc < 0) {
  ------------------
  |  Branch (704:7): [True: 0, False: 85]
  ------------------
  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|     85|  (*array)->sc = schunk;
  712|     85|  (*array)->last_tick = schunk->change_tick;
  713|       |
  714|     85|  if ((*array) == NULL) {
  ------------------
  |  Branch (714:7): [True: 0, False: 85]
  ------------------
  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|     85|  return BLOSC2_ERROR_SUCCESS;
  720|     85|}
b2nd_to_cframe:
  724|     85|                   bool *needs_free) {
  725|     85|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     85|    do {                                            \
  |  |  105|     85|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 85]
  |  |  ------------------
  |  |  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|     85|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 85]
  |  |  ------------------
  ------------------
  726|     85|  BLOSC_ERROR_NULL(cframe, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     85|    do {                                            \
  |  |  105|     85|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 85]
  |  |  ------------------
  |  |  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|     85|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 85]
  |  |  ------------------
  ------------------
  727|     85|  BLOSC_ERROR_NULL(cframe_len, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     85|    do {                                            \
  |  |  105|     85|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 85]
  |  |  ------------------
  |  |  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|     85|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 85]
  |  |  ------------------
  ------------------
  728|     85|  BLOSC_ERROR_NULL(needs_free, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     85|    do {                                            \
  |  |  105|     85|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 85]
  |  |  ------------------
  |  |  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|     85|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 85]
  |  |  ------------------
  ------------------
  729|       |
  730|     85|  *cframe_len = blosc2_schunk_to_buffer(array->sc, cframe, needs_free);
  731|     85|  if (*cframe_len <= 0) {
  ------------------
  |  Branch (731:7): [True: 0, False: 85]
  ------------------
  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|     85|  return BLOSC2_ERROR_SUCCESS;
  736|     85|}
b2nd_from_cframe:
  739|    241|int b2nd_from_cframe(uint8_t *cframe, int64_t cframe_len, bool copy, b2nd_array_t **array) {
  740|    241|  BLOSC_ERROR_NULL(cframe, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    241|    do {                                            \
  |  |  105|    241|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 241]
  |  |  ------------------
  |  |  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|    241|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 241]
  |  |  ------------------
  ------------------
  741|    241|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    241|    do {                                            \
  |  |  105|    241|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 241]
  |  |  ------------------
  |  |  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|    241|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 241]
  |  |  ------------------
  ------------------
  742|       |
  743|    241|  blosc2_schunk *sc = blosc2_schunk_from_buffer(cframe, cframe_len, copy);
  744|    241|  if (sc == NULL) {
  ------------------
  |  Branch (744:7): [True: 156, False: 85]
  ------------------
  745|    156|    BLOSC_TRACE_ERROR("Blosc error");
  ------------------
  |  |   93|    156|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    156|    do {                                            \
  |  |  |  |   98|    156|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    156|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 156, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    156|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  746|    156|    return BLOSC2_ERROR_FAILURE;
  747|    156|  }
  748|       |  // ...and create a b2nd array out of it
  749|     85|  int rc = b2nd_from_schunk(sc, array);
  750|     85|  if (rc < 0) {
  ------------------
  |  Branch (750:7): [True: 0, False: 85]
  ------------------
  751|      0|    blosc2_schunk_free(sc);
  752|      0|    return rc;
  753|      0|  }
  754|       |
  755|     85|  return BLOSC2_ERROR_SUCCESS;
  756|     85|}
b2nd_free:
  799|    172|int b2nd_free(b2nd_array_t *array) {
  800|    172|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    172|    do {                                            \
  |  |  105|    172|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 172]
  |  |  ------------------
  |  |  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|    172|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 172]
  |  |  ------------------
  ------------------
  801|       |
  802|    172|  if (array) {
  ------------------
  |  Branch (802:7): [True: 172, False: 0]
  ------------------
  803|    172|    if (array->sc != NULL) {
  ------------------
  |  Branch (803:9): [True: 172, False: 0]
  ------------------
  804|    172|      blosc2_schunk_free(array->sc);
  805|    172|    }
  806|    172|    free(array->dtype);
  807|    172|    free(array);
  808|    172|  }
  809|    172|  return BLOSC2_ERROR_SUCCESS;
  810|    172|}
b2nd_from_cbuffer:
  813|     87|int b2nd_from_cbuffer(b2nd_context_t *ctx, b2nd_array_t **array, const void *buffer, int64_t buffersize) {
  814|     87|  BLOSC_ERROR_NULL(ctx, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  815|     87|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  816|     87|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  817|       |
  818|     87|  BLOSC_ERROR(b2nd_empty(ctx, array));
  ------------------
  |  |  111|     87|    do {                                            \
  |  |  112|     87|        int rc_ = (rc);                             \
  |  |  113|     87|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  819|       |
  820|     87|  if (buffersize < (int64_t) (*array)->nitems * (*array)->sc->typesize) {
  ------------------
  |  Branch (820:7): [True: 0, False: 87]
  ------------------
  821|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  822|      0|                        (long long) buffersize, (long long) (*array)->nitems * (*array)->sc->typesize);
  823|      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]
  |  |  ------------------
  ------------------
  824|      0|  }
  825|       |
  826|     87|  if ((*array)->nitems == 0) {
  ------------------
  |  Branch (826:7): [True: 0, False: 87]
  ------------------
  827|      0|    return BLOSC2_ERROR_SUCCESS;
  828|      0|  }
  829|       |
  830|     87|  int64_t start[B2ND_MAX_DIM] = {0};
  831|     87|  int64_t *stop = (*array)->shape;
  832|     87|  int64_t *shape = (*array)->shape;
  833|     87|  BLOSC_ERROR(b2nd_set_slice_cbuffer(buffer, shape, buffersize, start, stop, *array));
  ------------------
  |  |  111|     87|    do {                                            \
  |  |  112|     87|        int rc_ = (rc);                             \
  |  |  113|     87|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 2, False: 85]
  |  |  ------------------
  |  |  114|      2|            char *error_msg = print_error(rc_);     \
  |  |  115|      2|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      2|            return rc_;                             \
  |  |  117|      2|        }                                           \
  |  |  118|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 85]
  |  |  ------------------
  ------------------
  834|       |
  835|     85|  return BLOSC2_ERROR_SUCCESS;
  836|     87|}
b2nd_to_cbuffer:
  840|    170|                    int64_t buffersize) {
  841|    170|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    170|    do {                                            \
  |  |  105|    170|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 170]
  |  |  ------------------
  |  |  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|    170|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 170]
  |  |  ------------------
  ------------------
  842|    170|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    170|    do {                                            \
  |  |  105|    170|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 170]
  |  |  ------------------
  |  |  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|    170|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 170]
  |  |  ------------------
  ------------------
  843|    170|  BLOSC_ERROR(refresh_if_stale((b2nd_array_t *) array));
  ------------------
  |  |  111|    170|    do {                                            \
  |  |  112|    170|        int rc_ = (rc);                             \
  |  |  113|    170|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 170]
  |  |  ------------------
  |  |  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|    170|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 170]
  |  |  ------------------
  ------------------
  844|       |
  845|    170|  if (buffersize < (int64_t) array->nitems * array->sc->typesize) {
  ------------------
  |  Branch (845:7): [True: 0, False: 170]
  ------------------
  846|      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]
  |  |  ------------------
  ------------------
  847|      0|  }
  848|       |
  849|    170|  if (array->nitems == 0) {
  ------------------
  |  Branch (849:7): [True: 0, False: 170]
  ------------------
  850|      0|    return BLOSC2_ERROR_SUCCESS;
  851|      0|  }
  852|       |
  853|    170|  int64_t start[B2ND_MAX_DIM] = {0};
  854|    170|  const int64_t *stop = array->shape;
  855|    170|  BLOSC_ERROR(b2nd_get_slice_cbuffer(array, start, stop, buffer, array->shape, buffersize));
  ------------------
  |  |  111|    170|    do {                                            \
  |  |  112|    170|        int rc_ = (rc);                             \
  |  |  113|    170|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 170]
  |  |  ------------------
  |  |  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|    170|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 170]
  |  |  ------------------
  ------------------
  856|    170|  return BLOSC2_ERROR_SUCCESS;
  857|    170|}
get_set_slice:
 1531|    257|                  prefetch_batch *prefetch) {
 1532|    257|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    257|    do {                                            \
  |  |  105|    257|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 257]
  |  |  ------------------
  |  |  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|    257|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 257]
  |  |  ------------------
  ------------------
 1533|    257|  BLOSC_ERROR_NULL(start, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    257|    do {                                            \
  |  |  105|    257|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 257]
  |  |  ------------------
  |  |  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|    257|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 257]
  |  |  ------------------
  ------------------
 1534|    257|  BLOSC_ERROR_NULL(stop, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    257|    do {                                            \
  |  |  105|    257|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 257]
  |  |  ------------------
  |  |  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|    257|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 257]
  |  |  ------------------
  ------------------
 1535|    257|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    257|    do {                                            \
  |  |  105|    257|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 257]
  |  |  ------------------
  |  |  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|    257|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 257]
  |  |  ------------------
  ------------------
 1536|    257|  if (buffersize < 0) {
  ------------------
  |  Branch (1536:7): [True: 0, False: 257]
  ------------------
 1537|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1538|      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]
  |  |  ------------------
  ------------------
 1539|      0|  }
 1540|       |
 1541|    257|  uint8_t *buffer_b = buffer;
 1542|    257|  int8_t ndim = array->ndim;
 1543|       |
 1544|       |  // 0-dim case
 1545|    257|  if (ndim == 0) {
  ------------------
  |  Branch (1545:7): [True: 0, False: 257]
  ------------------
 1546|      0|    if (set_slice) {
  ------------------
  |  Branch (1546:9): [True: 0, False: 0]
  ------------------
 1547|      0|      int32_t chunk_size = array->sc->typesize + BLOSC2_MAX_OVERHEAD;
 1548|      0|      uint8_t *chunk = malloc(chunk_size);
 1549|      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]
  |  |  ------------------
  ------------------
 1550|      0|      if (blosc2_compress_ctx(array->sc->cctx, buffer_b, array->sc->typesize, chunk, chunk_size) < 0 ||
  ------------------
  |  Branch (1550:11): [True: 0, False: 0]
  ------------------
 1551|      0|          blosc2_schunk_update_chunk(array->sc, 0, chunk, false) < 0) {
  ------------------
  |  Branch (1551:11): [True: 0, False: 0]
  ------------------
 1552|       |        // Neither a failed compression nor a failed update took the chunk
 1553|      0|        free(chunk);
 1554|      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]
  |  |  ------------------
  ------------------
 1555|      0|      }
 1556|       |
 1557|      0|    } else {
 1558|       |      // The item is the whole slice: zero it first (an uninitialized chunk
 1559|       |      // decompresses to nothing), with slice_only nothing else
 1560|      0|      memset(buffer_b, 0, slice_only ? (size_t)array->sc->typesize : (size_t)buffersize);
  ------------------
  |  Branch (1560:27): [True: 0, False: 0]
  ------------------
 1561|      0|      if (blosc2_schunk_decompress_chunk(array->sc, 0, buffer_b, array->sc->typesize) < 0) {
  ------------------
  |  Branch (1561:11): [True: 0, False: 0]
  ------------------
 1562|      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]
  |  |  ------------------
  ------------------
 1563|      0|      }
 1564|      0|    }
 1565|      0|    return BLOSC2_ERROR_SUCCESS;
 1566|      0|  }
 1567|       |
 1568|    257|  if (array->nitems == 0) {
  ------------------
  |  Branch (1568:7): [True: 0, False: 257]
  ------------------
 1569|      0|    if (!set_slice && !slice_only) {
  ------------------
  |  Branch (1569:9): [True: 0, False: 0]
  |  Branch (1569:23): [True: 0, False: 0]
  ------------------
 1570|      0|      memset(buffer_b, 0, (size_t)buffersize);
 1571|      0|    }
 1572|      0|    return BLOSC2_ERROR_SUCCESS;
 1573|      0|  }
 1574|       |
 1575|    257|  int64_t nelems_slice = 1;
 1576|  1.13k|  for (int i = 0; i < array->ndim; ++i) {
  ------------------
  |  Branch (1576:19): [True: 882, False: 257]
  ------------------
 1577|    882|    if (stop[i] - start[i] > shape[i]) {
  ------------------
  |  Branch (1577:9): [True: 0, False: 882]
  ------------------
 1578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1579|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1580|      0|    }
 1581|    882|    nelems_slice *= stop[i] - start[i];
 1582|    882|  }
 1583|    257|  int64_t slice_nbytes = nelems_slice * array->sc->typesize;
 1584|       |  // Compute in 64 bits and range-check: the cast used to bind to extchunknitems
 1585|       |  // alone, truncating it before the multiply and sizing buffers from the
 1586|       |  // wrapped value while offsets kept using the full extent (see #795)
 1587|    257|  int64_t data_nbytes_64 = 0;
 1588|    257|  if (!blosc2_checked_mul_i64_nonneg(array->extchunknitems, array->sc->typesize, &data_nbytes_64) ||
  ------------------
  |  Branch (1588:7): [True: 0, False: 257]
  ------------------
 1589|    257|      data_nbytes_64 > INT32_MAX) {
  ------------------
  |  Branch (1589:7): [True: 0, False: 257]
  ------------------
 1590|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 1590|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1591|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 1592|      0|  }
 1593|    257|  int32_t data_nbytes = (int32_t) data_nbytes_64;
 1594|       |
 1595|    257|  if (buffersize < slice_nbytes) {
  ------------------
  |  Branch (1595:7): [True: 0, False: 257]
  ------------------
 1596|      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]
  |  |  ------------------
  ------------------
 1597|      0|  }
 1598|       |
 1599|    257|  int64_t buffer_strides[B2ND_MAX_DIM];
 1600|    257|  buffer_strides[ndim - 1] = 1;
 1601|    882|  for (int i = ndim - 2; i >= 0; --i) {
  ------------------
  |  Branch (1601:26): [True: 625, False: 257]
  ------------------
 1602|    625|    buffer_strides[i] = buffer_strides[i + 1] * shape[i + 1];
 1603|    625|  }
 1604|       |
 1605|    257|  bool prefault = false;
 1606|    257|  bool slice_zeroed = false;  // all items of the slice are zeros in the buffer already
 1607|    257|  if (!set_slice && slice_only) {
  ------------------
  |  Branch (1607:7): [True: 170, False: 87]
  |  Branch (1607:21): [True: 0, False: 170]
  ------------------
 1608|       |    // Only the slice's box gets written, but a fresh buffer still wants its
 1609|       |    // pages faulted in before several threads decompress into it (see
 1610|       |    // buffer_wants_prefault()).  That maps pages and changes no byte.
 1611|      0|    int64_t last = 0;
 1612|      0|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1612:21): [True: 0, False: 0]
  ------------------
 1613|      0|      last += (stop[i] - start[i] - 1) * buffer_strides[i];
 1614|      0|    }
 1615|      0|    prefault = buffer_wants_prefault(buffer_b, (last + 1) * array->sc->typesize, array->sc->dctx->nthreads);
 1616|      0|  }
 1617|    257|  else if (!set_slice) {
  ------------------
  |  Branch (1617:12): [True: 170, False: 87]
  ------------------
 1618|    170|    bool slice_fills_buffer = true;
 1619|       |    // The get paths below write every item of the slice, so only buffer
 1620|       |    // bytes outside of it need to be pre-initialized to be defined and
 1621|       |    // deterministic.  Skipping the rest saves a pass over the buffer, which
 1622|       |    // for a freshly allocated one is also where all its page faults hit.
 1623|    754|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1623:21): [True: 584, False: 170]
  ------------------
 1624|    584|      if (start[i] < 0 || stop[i] < start[i] || stop[i] > array->shape[i] ||
  ------------------
  |  Branch (1624:11): [True: 0, False: 584]
  |  Branch (1624:27): [True: 0, False: 584]
  |  Branch (1624:49): [True: 0, False: 584]
  ------------------
 1625|    584|          stop[i] - start[i] != shape[i]) {
  ------------------
  |  Branch (1625:11): [True: 0, False: 584]
  ------------------
 1626|      0|        slice_fills_buffer = false;
 1627|      0|        break;
 1628|      0|      }
 1629|    584|    }
 1630|    170|    if (slice_fills_buffer) {
  ------------------
  |  Branch (1630:9): [True: 170, False: 0]
  ------------------
 1631|    170|      memset(buffer_b + slice_nbytes, 0, (size_t)(buffersize - slice_nbytes));
 1632|    170|      prefault = buffer_wants_prefault(buffer_b, slice_nbytes, array->sc->dctx->nthreads);
 1633|    170|    }
 1634|      0|    else {
 1635|      0|      memset(buffer_b, 0, (size_t)buffersize);
 1636|      0|      slice_zeroed = true;
 1637|      0|    }
 1638|    170|  }
 1639|       |
 1640|       |  // Chunk-sized scratch (see scratch_malloc()), allocated lazily: the compact
 1641|       |  // get path below never needs it, and for large chunks just the malloc/free
 1642|       |  // pair costs O(chunksize) in page-table work (it is way above the malloc
 1643|       |  // mmap threshold), which would dominate small reads.
 1644|    257|  uint8_t *data = NULL;
 1645|    257|  size_t data_capacity = 0;
 1646|       |  // Block-sized scratch for the compact get path (lazily allocated too).
 1647|    257|  uint8_t *block_data = NULL;
 1648|    257|  size_t block_data_capacity = 0;
 1649|    257|  int32_t block_nbytes = (int32_t) (array->blocknitems * array->sc->typesize);
 1650|    257|  bool *block_maskout = NULL;
 1651|    257|  int rc = BLOSC2_ERROR_SUCCESS;
 1652|       |
 1653|    257|  int64_t chunks_in_array[B2ND_MAX_DIM] = {0};
 1654|  1.13k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1654:19): [True: 882, False: 257]
  ------------------
 1655|    882|    chunks_in_array[i] = array->extshape[i] / array->chunkshape[i];
 1656|    882|  }
 1657|       |
 1658|    257|  int64_t chunks_in_array_strides[B2ND_MAX_DIM];
 1659|    257|  chunks_in_array_strides[ndim - 1] = 1;
 1660|    882|  for (int i = ndim - 2; i >= 0; --i) {
  ------------------
  |  Branch (1660:26): [True: 625, False: 257]
  ------------------
 1661|    625|    chunks_in_array_strides[i] = chunks_in_array_strides[i + 1] * chunks_in_array[i + 1];
 1662|    625|  }
 1663|       |
 1664|    257|  int64_t blocks_in_chunk[B2ND_MAX_DIM] = {0};
 1665|  1.13k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1665:19): [True: 882, False: 257]
  ------------------
 1666|    882|    blocks_in_chunk[i] = array->extchunkshape[i] / array->blockshape[i];
 1667|    882|  }
 1668|    257|  int32_t nblocks = (int32_t) array->extchunknitems / array->blocknitems;
 1669|    257|  int64_t blockshape[B2ND_MAX_DIM];
 1670|  1.13k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1670:19): [True: 882, False: 257]
  ------------------
 1671|    882|    blockshape[i] = array->blockshape[i];
 1672|    882|  }
 1673|       |
 1674|    257|  bool blocks_in_c_order = chunk_blocks_in_c_order(array);
 1675|    257|  bool has_delta = filters_contain(array->sc->filters, BLOSC_DELTA);
 1676|    257|  blosc2_context *dctx = array->sc->dctx;
 1677|       |  // The scatter get path brings its own postfilter, so it cannot serve
 1678|       |  // handles that have one (e.g. python-blosc2's lazy UDFs).
 1679|    257|  bool can_scatter = !has_delta && dctx->postfilter == NULL;
  ------------------
  |  Branch (1679:22): [True: 233, False: 24]
  |  Branch (1679:36): [True: 233, False: 0]
  ------------------
 1680|       |  // Likewise for the gather set path and prefilters (python-blosc2 installs
 1681|       |  // some for lazy expressions); DELTA encodes against the first block of the
 1682|       |  // compressor input, which the gather does not fill.
 1683|    257|  blosc2_context *cctx = array->sc->cctx;
 1684|    257|  bool can_gather = cctx->prefilter == NULL && !filters_contain(cctx->filters, BLOSC_DELTA);
  ------------------
  |  Branch (1684:21): [True: 257, False: 0]
  |  Branch (1684:48): [True: 233, False: 24]
  ------------------
 1685|       |
 1686|       |  // Compute the number of chunks to update
 1687|    257|  int64_t update_start[B2ND_MAX_DIM];
 1688|    257|  int64_t update_shape[B2ND_MAX_DIM];
 1689|       |
 1690|    257|  int64_t update_nchunks = 1;
 1691|  1.13k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1691:19): [True: 882, False: 257]
  ------------------
 1692|    882|    int64_t pos = 0;
 1693|  1.76k|    while (pos <= start[i]) {
  ------------------
  |  Branch (1693:12): [True: 882, False: 882]
  ------------------
 1694|    882|      pos += array->chunkshape[i];
 1695|    882|    }
 1696|    882|    update_start[i] = pos / array->chunkshape[i] - 1;
 1697|  1.39k|    while (pos < stop[i]) {
  ------------------
  |  Branch (1697:12): [True: 517, False: 882]
  ------------------
 1698|    517|      pos += array->chunkshape[i];
 1699|    517|    }
 1700|    882|    update_shape[i] = pos / array->chunkshape[i] - update_start[i];
 1701|    882|    update_nchunks *= update_shape[i];
 1702|    882|  }
 1703|       |
 1704|    257|  prefetch_batch *own_prefetch = set_slice || prefetch != NULL ? NULL : prefetch_slice(array, start, stop);
  ------------------
  |  Branch (1704:34): [True: 87, False: 170]
  |  Branch (1704:47): [True: 0, False: 170]
  ------------------
 1705|    257|  prefetch = own_prefetch != NULL ? own_prefetch : prefetch;
  ------------------
  |  Branch (1705:14): [True: 0, False: 257]
  ------------------
 1706|       |
 1707|       |  // Chunks of zeros (b2nd_zeros(), sparse data) and uninitialized ones read
 1708|       |  // as zeros without decompression.  Find them from the index first; if they
 1709|       |  // hold a good part of the slice, zero the slice in one pass and skip them
 1710|       |  // (zeroing chunk by chunk writes many short rows: an all-zero 384^3 float16
 1711|       |  // box took 24 ms that way, 1.9 ms in one pass), else zero their boxes only.
 1712|       |  // Not with a postfilter, which may compute the items of special chunks,
 1713|       |  // and not for slices smaller than a block, where decompressing is cheap.
 1714|    257|  int64_t *slice_chunks = NULL;  // the slice's chunks in loop order, then...
 1715|    257|  uint8_t *zero_chunk = NULL;  // ...whether each reads as zeros (same allocation)
 1716|    257|  if (!set_slice && dctx->postfilter == NULL && nelems_slice >= array->blocknitems) {
  ------------------
  |  Branch (1716:7): [True: 170, False: 87]
  |  Branch (1716:21): [True: 170, False: 0]
  |  Branch (1716:49): [True: 170, False: 0]
  ------------------
 1717|    170|    slice_chunks = malloc((size_t) update_nchunks * (sizeof(int64_t) + 1));
 1718|    170|    if (slice_chunks == NULL) {
  ------------------
  |  Branch (1718:9): [True: 0, False: 170]
  ------------------
 1719|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1720|      0|      goto out;
 1721|      0|    }
 1722|    170|    zero_chunk = (uint8_t *) (slice_chunks + update_nchunks);
 1723|  1.37k|    for (int64_t u = 0; u < update_nchunks; ++u) {
  ------------------
  |  Branch (1723:25): [True: 1.20k, False: 170]
  ------------------
 1724|  1.20k|      int64_t idx[B2ND_MAX_DIM] = {0};
 1725|  1.20k|      blosc2_unidim_to_multidim(ndim, update_shape, u, idx);
 1726|  5.77k|      for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1726:23): [True: 4.56k, False: 1.20k]
  ------------------
 1727|  4.56k|        idx[i] += update_start[i];
 1728|  4.56k|      }
 1729|  1.20k|      blosc2_multidim_to_unidim(idx, ndim, chunks_in_array_strides, &slice_chunks[u]);
 1730|  1.20k|    }
 1731|    170|    if (chunks_special(array->sc, slice_chunks, update_nchunks, zero_chunk) < 0) {
  ------------------
  |  Branch (1731:9): [True: 0, False: 170]
  ------------------
 1732|      0|      memset(zero_chunk, 0, (size_t) update_nchunks);  // the normal path reports what is wrong
 1733|      0|    }
 1734|    170|    int64_t zero_nitems = 0;
 1735|  1.37k|    for (int64_t u = 0; u < update_nchunks; ++u) {
  ------------------
  |  Branch (1735:25): [True: 1.20k, False: 170]
  ------------------
 1736|  1.20k|      zero_chunk[u] = zero_chunk[u] == BLOSC2_SPECIAL_ZERO || zero_chunk[u] == BLOSC2_SPECIAL_UNINIT;
  ------------------
  |  Branch (1736:23): [True: 0, False: 1.20k]
  |  Branch (1736:63): [True: 0, False: 1.20k]
  ------------------
 1737|  1.20k|      if (zero_chunk[u]) {
  ------------------
  |  Branch (1737:11): [True: 0, False: 1.20k]
  ------------------
 1738|      0|        int64_t cstart[B2ND_MAX_DIM], cstop[B2ND_MAX_DIM], bstart[B2ND_MAX_DIM], bstop[B2ND_MAX_DIM];
 1739|      0|        chunk_box(array, slice_chunks[u], start, stop, cstart, cstop);
 1740|      0|        zero_nitems += chunk_slice_box(ndim, cstart, cstop, start, stop, bstart, bstop);
 1741|      0|      }
 1742|  1.20k|    }
 1743|    170|    if (!slice_zeroed && 4 * zero_nitems >= nelems_slice) {
  ------------------
  |  Branch (1743:9): [True: 170, False: 0]
  |  Branch (1743:26): [True: 0, False: 170]
  ------------------
 1744|       |      // The slice's box of the buffer (the whole buffer unless slice_only; one memset() then)
 1745|      0|      int64_t zstart[B2ND_MAX_DIM] = {0};
 1746|      0|      int64_t zstop[B2ND_MAX_DIM];
 1747|      0|      for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1747:23): [True: 0, False: 0]
  ------------------
 1748|      0|        zstop[i] = stop[i] - start[i];
 1749|      0|      }
 1750|      0|      b2nd_zero_box(ndim, array->sc->typesize, buffer_b, shape, zstart, zstop);
 1751|      0|      slice_zeroed = true;
 1752|      0|    }
 1753|    170|  }
 1754|       |
 1755|  2.06k|  for (int64_t update_nchunk = 0; update_nchunk < update_nchunks; ++update_nchunk) {
  ------------------
  |  Branch (1755:35): [True: 1.81k, False: 255]
  ------------------
 1756|  1.81k|    int64_t nchunk_ndim[B2ND_MAX_DIM] = {0};
 1757|  1.81k|    blosc2_unidim_to_multidim(ndim, update_shape, update_nchunk, nchunk_ndim);
 1758|  8.67k|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1758:21): [True: 6.85k, False: 1.81k]
  ------------------
 1759|  6.85k|      nchunk_ndim[i] += update_start[i];
 1760|  6.85k|    }
 1761|  1.81k|    int64_t nchunk;
 1762|  1.81k|    blosc2_multidim_to_unidim(nchunk_ndim, ndim, chunks_in_array_strides, &nchunk);
 1763|       |
 1764|       |    // Check if the chunk needs to be updated
 1765|  1.81k|    int64_t chunk_start[B2ND_MAX_DIM] = {0};
 1766|  1.81k|    int64_t chunk_stop[B2ND_MAX_DIM] = {0};
 1767|  8.67k|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1767:21): [True: 6.85k, False: 1.81k]
  ------------------
 1768|  6.85k|      chunk_start[i] = nchunk_ndim[i] * array->chunkshape[i];
 1769|  6.85k|      chunk_stop[i] = chunk_start[i] + array->chunkshape[i];
 1770|  6.85k|      if (chunk_stop[i] > array->shape[i]) {
  ------------------
  |  Branch (1770:11): [True: 1.22k, False: 5.63k]
  ------------------
 1771|  1.22k|        chunk_stop[i] = array->shape[i];
 1772|  1.22k|      }
 1773|  6.85k|    }
 1774|  1.81k|    bool chunk_empty = false;
 1775|  8.67k|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1775:21): [True: 6.85k, False: 1.81k]
  ------------------
 1776|  6.85k|      chunk_empty |= (chunk_stop[i] <= start[i] || chunk_start[i] >= stop[i]);
  ------------------
  |  Branch (1776:23): [True: 0, False: 6.85k]
  |  Branch (1776:52): [True: 0, False: 6.85k]
  ------------------
 1777|  6.85k|    }
 1778|  1.81k|    if (chunk_empty) {
  ------------------
  |  Branch (1778:9): [True: 0, False: 1.81k]
  ------------------
 1779|      0|      continue;
 1780|      0|    }
 1781|  1.81k|    if (zero_chunk != NULL && zero_chunk[update_nchunk]) {
  ------------------
  |  Branch (1781:9): [True: 1.20k, False: 606]
  |  Branch (1781:31): [True: 0, False: 1.20k]
  ------------------
 1782|      0|      if (!slice_zeroed) {
  ------------------
  |  Branch (1782:11): [True: 0, False: 0]
  ------------------
 1783|      0|        int64_t box_start[B2ND_MAX_DIM];
 1784|      0|        int64_t box_stop[B2ND_MAX_DIM];
 1785|      0|        chunk_slice_box(ndim, chunk_start, chunk_stop, start, stop, box_start, box_stop);
 1786|      0|        b2nd_zero_box(ndim, array->sc->typesize, buffer_b, shape, box_start, box_stop);
 1787|      0|      }
 1788|      0|      continue;
 1789|      0|    }
 1790|       |    // Decompress each chunk as soon as it has been read ahead, while the later ones are still coming in
 1791|  1.81k|    prefetch_batch_wait(prefetch, nchunk);
 1792|  1.81k|    slice_chunk_t slice_chunk;
 1793|  1.81k|    memset(&slice_chunk, 0, sizeof(slice_chunk));
 1794|  1.81k|    slice_chunk.array = array;
 1795|  1.81k|    slice_chunk.buffer = buffer_b;
 1796|  1.81k|    slice_chunk.buffershape = shape;
 1797|  1.81k|    slice_chunk.start = start;
 1798|  1.81k|    slice_chunk.stop = stop;
 1799|  1.81k|    slice_chunk.chunk_start = chunk_start;
 1800|  1.81k|    slice_chunk.chunk_stop = chunk_stop;
 1801|  1.81k|    slice_chunk.blocks_in_chunk = blocks_in_chunk;
 1802|  1.81k|    slice_chunk.blockshape = blockshape;
 1803|       |
 1804|       |    // A whole chunk that is one run of the buffer in its decompressed layout
 1805|       |    // is (de)compressed straight from/into the buffer.
 1806|  1.81k|    int64_t run_offset;
 1807|  1.81k|    if (blocks_in_c_order &&
  ------------------
  |  Branch (1807:9): [True: 463, False: 1.35k]
  ------------------
 1808|    463|        chunk_contiguous_in_buffer(array, chunk_start, start, stop, shape, &run_offset)) {
  ------------------
  |  Branch (1808:9): [True: 49, False: 414]
  ------------------
 1809|     49|      uint8_t *run = buffer_b + run_offset;
 1810|     49|      if (set_slice) {
  ------------------
  |  Branch (1810:11): [True: 17, False: 32]
  ------------------
 1811|     17|        rc = compress_update_chunk(array, nchunk, run, data_nbytes, NULL);
 1812|     17|        if (rc < 0) {
  ------------------
  |  Branch (1812:13): [True: 1, False: 16]
  ------------------
 1813|      1|          goto out;
 1814|      1|        }
 1815|     17|      }
 1816|     32|      else {
 1817|       |        // All threads start writing their blocks at once; with shares
 1818|       |        // below a huge page several of them hit each one
 1819|     32|        if (prefault && data_nbytes / dctx->nthreads < (1 << 20) &&
  ------------------
  |  Branch (1819:13): [True: 0, False: 32]
  |  Branch (1819:25): [True: 0, False: 0]
  ------------------
 1820|      0|            block_nbytes < (1 << 20)) {
  ------------------
  |  Branch (1820:13): [True: 0, False: 0]
  ------------------
 1821|      0|          prefault_range(run, data_nbytes);
 1822|      0|        }
 1823|     32|        rc = blosc2_schunk_decompress_chunk(array->sc, nchunk, run, data_nbytes);
 1824|     32|        if (rc < 0) {
  ------------------
  |  Branch (1824:13): [True: 0, False: 32]
  ------------------
 1825|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1826|      0|          goto out;
 1827|      0|        }
 1828|     32|        if (decoded_nothing(dctx, rc)) {
  ------------------
  |  Branch (1828:13): [True: 0, False: 32]
  ------------------
 1829|      0|          memset(run, 0, (size_t)data_nbytes);
 1830|      0|        }
 1831|     32|        rc = BLOSC2_ERROR_SUCCESS;
 1832|     32|      }
 1833|     48|      continue;
 1834|     49|    }
 1835|       |
 1836|       |    // Compact get path state for this chunk (see below).
 1837|  1.81k|    bool use_compact = false;
 1838|  1.76k|    uint8_t *lazychunk = NULL;
 1839|  1.76k|    bool lazychunk_needs_free = false;
 1840|  1.76k|    int32_t lazychunk_cbytes = 0;
 1841|  1.76k|    if (set_slice) {
  ------------------
  |  Branch (1841:9): [True: 589, False: 1.17k]
  ------------------
 1842|    589|      if (data == NULL) {
  ------------------
  |  Branch (1842:11): [True: 70, False: 519]
  ------------------
 1843|     70|        data = scratch_malloc(array, data_nbytes, &data_capacity);
 1844|     70|        if (data == NULL) {
  ------------------
  |  Branch (1844:13): [True: 0, False: 70]
  ------------------
 1845|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1846|      0|          goto out;
 1847|      0|        }
 1848|     70|      }
 1849|       |      // Check if all the chunk is going to be updated and avoid the decompression
 1850|    589|      bool decompress_chunk = false;
 1851|  2.84k|      for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1851:23): [True: 2.25k, False: 589]
  ------------------
 1852|  2.25k|        decompress_chunk |= (chunk_start[i] < start[i] || chunk_stop[i] > stop[i]);
  ------------------
  |  Branch (1852:30): [True: 0, False: 2.25k]
  |  Branch (1852:59): [True: 0, False: 2.25k]
  ------------------
 1853|  2.25k|      }
 1854|       |
 1855|       |      // On a partly overwritten chunk the gather copies every block that
 1856|       |      // keeps old items once more, so it only pays when the slice covers a
 1857|       |      // good part of the chunk.
 1858|    589|      int64_t box_start[B2ND_MAX_DIM];
 1859|    589|      int64_t box_stop[B2ND_MAX_DIM];
 1860|    589|      int64_t overlap_nitems = chunk_slice_box(ndim, chunk_start, chunk_stop, start, stop,
 1861|    589|                                               box_start, box_stop);
 1862|    589|      if (can_gather && (!decompress_chunk || 2 * overlap_nitems >= array->extchunknitems)) {
  ------------------
  |  Branch (1862:11): [True: 515, False: 74]
  |  Branch (1862:26): [True: 515, False: 0]
  |  Branch (1862:47): [True: 0, False: 0]
  ------------------
 1863|       |        // Gather path: the compression threads take the new items straight
 1864|       |        // from the buffer.  Only blocks keeping some old items need the old
 1865|       |        // chunk, and when there are none `data` stays untouched.
 1866|    515|        if (decompress_chunk) {
  ------------------
  |  Branch (1866:13): [True: 0, False: 515]
  ------------------
 1867|      0|          if (block_maskout == NULL) {
  ------------------
  |  Branch (1867:15): [True: 0, False: 0]
  ------------------
 1868|      0|            block_maskout = malloc(nblocks);
 1869|      0|            if (block_maskout == NULL) {
  ------------------
  |  Branch (1869:17): [True: 0, False: 0]
  ------------------
 1870|      0|              rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1871|      0|              goto out;
 1872|      0|            }
 1873|      0|          }
 1874|      0|          for (int nblock = 0; nblock < nblocks; ++nblock) {
  ------------------
  |  Branch (1874:32): [True: 0, False: 0]
  ------------------
 1875|      0|            block_overlap_t overlap;
 1876|      0|            block_maskout[nblock] = block_slice_overlap(&slice_chunk, nblock, &overlap) &&
  ------------------
  |  Branch (1876:37): [True: 0, False: 0]
  ------------------
 1877|      0|                                    overlap.whole_block;
  ------------------
  |  Branch (1877:37): [True: 0, False: 0]
  ------------------
 1878|      0|          }
 1879|      0|          int err = schunk_decompress_masked(array->sc, nchunk, NULL, 0, block_maskout, nblocks,
 1880|      0|                                             NULL, NULL, data, data_nbytes);
 1881|      0|          if (err < 0) {
  ------------------
  |  Branch (1881:15): [True: 0, False: 0]
  ------------------
 1882|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1883|      0|            rc = BLOSC2_ERROR_FAILURE;
 1884|      0|            goto out;
 1885|      0|          }
 1886|      0|          if (decoded_nothing(dctx, err)) {
  ------------------
  |  Branch (1886:15): [True: 0, False: 0]
  ------------------
 1887|      0|            memset(data, 0, data_nbytes);
 1888|      0|          }
 1889|      0|        }
 1890|    515|        slice_chunk.keep_old = decompress_chunk;
 1891|    515|        rc = compress_update_chunk(array, nchunk, data, data_nbytes, &slice_chunk);
 1892|    515|        if (rc < 0) {
  ------------------
  |  Branch (1892:13): [True: 1, False: 514]
  ------------------
 1893|      1|          goto out;
 1894|      1|        }
 1895|    514|        continue;
 1896|    515|      }
 1897|       |
 1898|     74|      if (decompress_chunk) {
  ------------------
  |  Branch (1898:11): [True: 0, False: 74]
  ------------------
 1899|      0|        int err = blosc2_schunk_decompress_chunk(array->sc, nchunk, data, data_nbytes);
 1900|      0|        if (err < 0) {
  ------------------
  |  Branch (1900:13): [True: 0, False: 0]
  ------------------
 1901|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1902|      0|          rc = BLOSC2_ERROR_FAILURE;
 1903|      0|          goto out;
 1904|      0|        }
 1905|      0|        if (decoded_nothing(dctx, err)) {
  ------------------
  |  Branch (1905:13): [True: 0, False: 0]
  ------------------
 1906|      0|          memset(data, 0, data_nbytes);
 1907|      0|        }
 1908|     74|      } else {
 1909|       |        // Avoid writing non zero padding from previous chunk
 1910|     74|        memset(data, 0, data_nbytes);
 1911|     74|      }
 1912|  1.17k|    } else {
 1913|  1.17k|      if (block_maskout == NULL) {
  ------------------
  |  Branch (1913:11): [True: 138, False: 1.03k]
  ------------------
 1914|    138|        block_maskout = malloc(nblocks);
 1915|    138|        if (block_maskout == NULL) {
  ------------------
  |  Branch (1915:13): [True: 0, False: 138]
  ------------------
 1916|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1917|      0|          goto out;
 1918|      0|        }
 1919|    138|      }
 1920|       |      // Delta filter encodes subsequent blocks relative to the reference block (block 0): if any block in the chunk
 1921|       |      // is needed, block 0 must be decompressed as reference
 1922|  1.17k|      int32_t nblocks_needed = (int32_t) slice_chunk_maskout(&slice_chunk, nblocks, has_delta, block_maskout);
 1923|       |
 1924|       |      // Compact get path: when only a fraction of the chunk's blocks is
 1925|       |      // needed, decompress just those blocks -- one at a time, straight
 1926|       |      // from the (lazy)chunk -- instead of decompressing into a chunk-sized
 1927|       |      // scratch.  This keeps the working buffer at one block, so small reads
 1928|       |      // from arrays with large chunks stay O(request), not O(chunksize).
 1929|       |      // Larger requests keep the maskout path, which decompresses the needed
 1930|       |      // blocks in parallel.
 1931|       |      //
 1932|       |      // The threshold depends on the storage backend.  On disk, the maskout
 1933|       |      // path reads the *whole* compressed chunk per call while the compact
 1934|       |      // path only reads the touched blocks, so compact wins by 10-100x well
 1935|       |      // past needed == nblocks/4 for typical data.  In memory there is no
 1936|       |      // I/O to save: for poorly-compressible data the maskout path's
 1937|       |      // parallel decompression overtakes the compact path's serial one at
 1938|       |      // around 2-4 needed blocks, so stay conservative there (1/16 keeps
 1939|       |      // the possible loss window narrow while still capturing the common
 1940|       |      // 1-2 block reads, where compact always wins or ties).
 1941|       |      //
 1942|       |      // If DELTA is used, blocks cannot be decompressed independently; keep maskout path.
 1943|  1.17k|      use_compact = slice_chunk_compact(array, nblocks_needed, has_delta);
 1944|  1.17k|      if (use_compact) {
  ------------------
  |  Branch (1944:11): [True: 0, False: 1.17k]
  ------------------
 1945|      0|        lazychunk_cbytes = blosc2_schunk_get_lazychunk(array->sc, nchunk, &lazychunk,
 1946|      0|                                                       &lazychunk_needs_free);
 1947|      0|        if (lazychunk_cbytes < 0) {
  ------------------
  |  Branch (1947:13): [True: 0, False: 0]
  ------------------
 1948|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1949|      0|          rc = BLOSC2_ERROR_FAILURE;
 1950|      0|          goto out;
 1951|      0|        }
 1952|      0|        if (block_data == NULL) {
  ------------------
  |  Branch (1952:13): [True: 0, False: 0]
  ------------------
 1953|      0|          block_data = scratch_malloc(array, block_nbytes, &block_data_capacity);
 1954|      0|          if (block_data == NULL) {
  ------------------
  |  Branch (1954:15): [True: 0, False: 0]
  ------------------
 1955|      0|            if (lazychunk_needs_free) {
  ------------------
  |  Branch (1955:17): [True: 0, False: 0]
  ------------------
 1956|      0|              free(lazychunk);
 1957|      0|            }
 1958|      0|            rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1959|      0|            goto out;
 1960|      0|          }
 1961|      0|        }
 1962|  1.17k|      } else {
 1963|  1.17k|        if (data == NULL) {
  ------------------
  |  Branch (1963:13): [True: 138, False: 1.03k]
  ------------------
 1964|    138|          data = scratch_malloc(array, data_nbytes, &data_capacity);
 1965|    138|          if (data == NULL) {
  ------------------
  |  Branch (1965:15): [True: 0, False: 138]
  ------------------
 1966|      0|            rc = BLOSC2_ERROR_MEMORY_ALLOC;
 1967|      0|            goto out;
 1968|      0|          }
 1969|    138|        }
 1970|  1.17k|        bool scattered = false;
 1971|  1.17k|        if (can_scatter) {
  ------------------
  |  Branch (1971:13): [True: 1.02k, False: 148]
  ------------------
 1972|       |          // Scatter path: the needed blocks go from the worker threads that
 1973|       |          // decode them straight to the buffer.  `data` only satisfies the
 1974|       |          // decompressor's destination size and stays untouched.
 1975|  1.02k|          int64_t box_start[B2ND_MAX_DIM];
 1976|  1.02k|          int64_t box_stop[B2ND_MAX_DIM];
 1977|  1.02k|          chunk_slice_box(ndim, chunk_start, chunk_stop, start, stop, box_start, box_stop);
 1978|  1.02k|          if (prefault) {
  ------------------
  |  Branch (1978:15): [True: 0, False: 1.02k]
  ------------------
 1979|      0|            int64_t box_last[B2ND_MAX_DIM];
 1980|      0|            for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1980:29): [True: 0, False: 0]
  ------------------
 1981|      0|              box_last[i] = box_stop[i] - 1;
 1982|      0|            }
 1983|      0|            int64_t first;
 1984|      0|            int64_t last;
 1985|      0|            blosc2_multidim_to_unidim(box_start, ndim, buffer_strides, &first);
 1986|      0|            blosc2_multidim_to_unidim(box_last, ndim, buffer_strides, &last);
 1987|      0|            prefault_range(buffer_b + first * array->sc->typesize,
 1988|      0|                           (last + 1 - first) * array->sc->typesize);
 1989|      0|          }
 1990|  1.02k|          int err = schunk_decompress_masked(array->sc, nchunk, NULL, 0, block_maskout, nblocks,
 1991|  1.02k|                                             slice_scatter_postfilter, &slice_chunk, data, data_nbytes);
 1992|  1.02k|          if (err < 0) {
  ------------------
  |  Branch (1992:15): [True: 0, False: 1.02k]
  ------------------
 1993|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1994|      0|            rc = BLOSC2_ERROR_FAILURE;
 1995|      0|            goto out;
 1996|      0|          }
 1997|  1.02k|          if (err == 0) {
  ------------------
  |  Branch (1997:15): [True: 0, False: 1.02k]
  ------------------
 1998|       |            // Missing chunk: nothing was decoded
 1999|      0|            b2nd_zero_box(ndim, array->sc->typesize, buffer_b, shape, box_start, box_stop);
 2000|      0|          }
 2001|  1.02k|          scattered = err == 0 || !scatter_unsupported(dctx);
  ------------------
  |  Branch (2001:23): [True: 0, False: 1.02k]
  |  Branch (2001:35): [True: 1.02k, False: 0]
  ------------------
 2002|  1.02k|        }
 2003|  1.17k|        if (scattered) {
  ------------------
  |  Branch (2003:13): [True: 1.02k, False: 148]
  ------------------
 2004|  1.02k|          continue;
 2005|  1.02k|        }
 2006|    148|        int err = schunk_decompress_masked(array->sc, nchunk, NULL, 0, block_maskout, nblocks,
 2007|    148|                                           NULL, NULL, data, data_nbytes);
 2008|    148|        if (err < 0) {
  ------------------
  |  Branch (2008:13): [True: 0, False: 148]
  ------------------
 2009|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2010|      0|          rc = BLOSC2_ERROR_FAILURE;
 2011|      0|          goto out;
 2012|      0|        }
 2013|    148|        if (decoded_nothing(dctx, err)) {
  ------------------
  |  Branch (2013:13): [True: 0, False: 148]
  ------------------
 2014|      0|          memset(data, 0, data_nbytes);
 2015|      0|        }
 2016|    148|      }
 2017|  1.17k|    }
 2018|       |
 2019|       |    // Iterate over blocks
 2020|       |
 2021|  3.45k|    for (int nblock = 0; nblock < nblocks; ++nblock) {
  ------------------
  |  Branch (2021:26): [True: 3.22k, False: 222]
  ------------------
 2022|  3.22k|      block_overlap_t overlap;
 2023|  3.22k|      if (!block_slice_overlap(&slice_chunk, nblock, &overlap)) {
  ------------------
  |  Branch (2023:11): [True: 729, False: 2.49k]
  ------------------
 2024|    729|        continue;
 2025|    729|      }
 2026|       |
 2027|  2.49k|      uint8_t *dst;
 2028|  2.49k|      if (use_compact) {
  ------------------
  |  Branch (2028:11): [True: 0, False: 2.49k]
  ------------------
 2029|       |        // Decompress just this block from the (lazy)chunk.
 2030|      0|        int grc = blosc2_getitem_bytes_ctx(array->sc->dctx, lazychunk, lazychunk_cbytes,
 2031|      0|                                           (int32_t) ((int64_t) nblock * block_nbytes), block_nbytes,
 2032|      0|                                           block_data, block_nbytes);
 2033|      0|        if (grc < 0) {
  ------------------
  |  Branch (2033:13): [True: 0, False: 0]
  ------------------
 2034|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2035|      0|          if (lazychunk_needs_free) {
  ------------------
  |  Branch (2035:15): [True: 0, False: 0]
  ------------------
 2036|      0|            free(lazychunk);
 2037|      0|          }
 2038|      0|          rc = BLOSC2_ERROR_FAILURE;
 2039|      0|          goto out;
 2040|      0|        }
 2041|      0|        if (decoded_nothing(dctx, grc)) {
  ------------------
  |  Branch (2041:13): [True: 0, False: 0]
  ------------------
 2042|      0|          memset(block_data, 0, block_nbytes);
 2043|      0|        }
 2044|      0|        dst = block_data;
 2045|  2.49k|      } else {
 2046|  2.49k|        dst = &data[nblock * array->blocknitems * array->sc->typesize];
 2047|  2.49k|      }
 2048|       |
 2049|  2.49k|      if (set_slice) {
  ------------------
  |  Branch (2049:11): [True: 833, False: 1.66k]
  ------------------
 2050|    833|        b2nd_copy_buffer2(ndim, array->sc->typesize,
 2051|    833|                          buffer_b, shape, overlap.dst_start, overlap.dst_stop,
 2052|    833|                          dst, blockshape, overlap.src_start);
 2053|  1.66k|      } else {
 2054|  1.66k|        b2nd_copy_buffer2(ndim, array->sc->typesize,
 2055|  1.66k|                          dst, blockshape, overlap.src_start, overlap.src_stop,
 2056|  1.66k|                          buffer_b, shape, overlap.dst_start);
 2057|  1.66k|      }
 2058|  2.49k|    }
 2059|       |
 2060|    222|    if (use_compact && lazychunk_needs_free) {
  ------------------
  |  Branch (2060:9): [True: 0, False: 222]
  |  Branch (2060:24): [True: 0, False: 0]
  ------------------
 2061|      0|      free(lazychunk);
 2062|      0|    }
 2063|       |
 2064|    222|    if (set_slice) {
  ------------------
  |  Branch (2064:9): [True: 74, False: 148]
  ------------------
 2065|     74|      rc = compress_update_chunk(array, nchunk, data, data_nbytes, NULL);
 2066|     74|      if (rc < 0) {
  ------------------
  |  Branch (2066:11): [True: 0, False: 74]
  ------------------
 2067|      0|        goto out;
 2068|      0|      }
 2069|     74|    }
 2070|    222|  }
 2071|       |
 2072|    257|  out:
 2073|    257|  free(slice_chunks);
 2074|    257|  prefetch_batch_free(own_prefetch);
 2075|    257|  blosc2_tmp_free(data, data_capacity);
 2076|    257|  blosc2_tmp_free(block_data, block_data_capacity);
 2077|    257|  free(block_maskout);
 2078|       |
 2079|    257|  return rc;
 2080|    257|}
b2nd_get_slice_cbuffer:
 2120|    170|                           void *buffer, const int64_t *buffershape, int64_t buffersize) {
 2121|    170|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    170|    do {                                            \
  |  |  105|    170|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 170]
  |  |  ------------------
  |  |  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|    170|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 170]
  |  |  ------------------
  ------------------
 2122|    170|  BLOSC_ERROR_NULL(start, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    170|    do {                                            \
  |  |  105|    170|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 170]
  |  |  ------------------
  |  |  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|    170|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 170]
  |  |  ------------------
  ------------------
 2123|    170|  BLOSC_ERROR_NULL(stop, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    170|    do {                                            \
  |  |  105|    170|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 170]
  |  |  ------------------
  |  |  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|    170|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 170]
  |  |  ------------------
  ------------------
 2124|    170|  BLOSC_ERROR_NULL(buffershape, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    170|    do {                                            \
  |  |  105|    170|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 170]
  |  |  ------------------
  |  |  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|    170|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 170]
  |  |  ------------------
  ------------------
 2125|    170|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    170|    do {                                            \
  |  |  105|    170|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 170]
  |  |  ------------------
  |  |  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|    170|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 170]
  |  |  ------------------
  ------------------
 2126|       |
 2127|    170|  return locked_get_set_slice(buffer, buffersize, start, stop, buffershape, (b2nd_array_t *) array,
 2128|    170|                              false, false, NULL);
 2129|    170|}
b2nd_set_slice_cbuffer:
 2179|     87|                           b2nd_array_t *array) {
 2180|     87|  BLOSC_ERROR_NULL(buffer, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
 2181|     87|  BLOSC_ERROR_NULL(start, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
 2182|     87|  BLOSC_ERROR_NULL(stop, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
 2183|     87|  BLOSC_ERROR_NULL(array, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
 2184|       |
 2185|     87|  return locked_get_set_slice((void *) buffer, buffersize, start, stop, buffershape, array, true, false, NULL);
 2186|     87|}
b2nd_create_ctx:
 3695|     87|                int32_t nmetalayers) {
 3696|     87|  if (ndim < 0 || ndim > B2ND_MAX_DIM) {
  ------------------
  |  |   50|     87|#define B2ND_MAX_DIM 16
  ------------------
  |  Branch (3696:7): [True: 0, False: 87]
  |  Branch (3696:19): [True: 0, False: 87]
  ------------------
 3697|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 3697|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3698|      0|    return NULL;
 3699|      0|  }
 3700|       |
 3701|     87|  if (ndim > 0) {
  ------------------
  |  Branch (3701:7): [True: 87, False: 0]
  ------------------
 3702|     87|    if (shape == NULL || chunkshape == NULL || blockshape == NULL) {
  ------------------
  |  Branch (3702:9): [True: 0, False: 87]
  |  Branch (3702:26): [True: 0, False: 87]
  |  Branch (3702:48): [True: 0, False: 87]
  ------------------
 3703|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3704|      0|      return NULL;
 3705|      0|    }
 3706|     87|    if (validate_shape_chunkshape_blockshape(ndim, shape, chunkshape, blockshape) < 0) {
  ------------------
  |  Branch (3706:9): [True: 0, False: 87]
  ------------------
 3707|      0|      return NULL;
 3708|      0|    }
 3709|     87|  }
 3710|       |
 3711|     87|  b2nd_context_t *ctx = malloc(sizeof(b2nd_context_t));
 3712|     87|  BLOSC_ERROR_NULL(ctx, NULL);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
 3713|     87|  blosc2_storage *params_b2_storage = malloc(sizeof(blosc2_storage));
 3714|     87|  BLOSC_ERROR_NULL(params_b2_storage, NULL);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
 3715|     87|  if (b2_storage == NULL) {
  ------------------
  |  Branch (3715:7): [True: 0, False: 87]
  ------------------
 3716|      0|    memcpy(params_b2_storage, &BLOSC2_STORAGE_DEFAULTS, sizeof(blosc2_storage));
 3717|      0|  }
 3718|     87|  else {
 3719|     87|    memcpy(params_b2_storage, b2_storage, sizeof(blosc2_storage));
 3720|     87|  }
 3721|     87|  blosc2_cparams *cparams = malloc(sizeof(blosc2_cparams));
 3722|     87|  BLOSC_ERROR_NULL(cparams, NULL);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
 3723|       |  // We need a copy of cparams mainly to be able to modify blocksize
 3724|     87|  if (params_b2_storage->cparams == NULL) {
  ------------------
  |  Branch (3724:7): [True: 0, False: 87]
  ------------------
 3725|      0|    memcpy(cparams, &BLOSC2_CPARAMS_DEFAULTS, sizeof(blosc2_cparams));
 3726|      0|  }
 3727|     87|  else {
 3728|     87|    memcpy(cparams, params_b2_storage->cparams, sizeof(blosc2_cparams));
 3729|     87|  }
 3730|       |
 3731|     87|  if (dtype == NULL) {
  ------------------
  |  Branch (3731:7): [True: 87, False: 0]
  ------------------
 3732|       |    // ctx->dtype = strdup(B2ND_DEFAULT_DTYPE);
 3733|     87|    char buf[16] = {0};
 3734|     87|    snprintf(buf, sizeof(buf), "|S%d", cparams->typesize);
 3735|     87|    ctx->dtype = strdup(buf);
 3736|     87|  }
 3737|      0|  else {
 3738|      0|    ctx->dtype = strdup(dtype);
 3739|      0|  }
 3740|     87|  ctx->dtype_format = dtype_format;
 3741|       |
 3742|     87|  params_b2_storage->cparams = cparams;
 3743|     87|  ctx->b2_storage = params_b2_storage;
 3744|     87|  ctx->ndim = ndim;
 3745|     87|  int32_t blocknitems = 1;
 3746|     87|  bool blocksize_overflow = false;
 3747|    385|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (3747:19): [True: 298, False: 87]
  ------------------
 3748|    298|    ctx->shape[i] = shape[i];
 3749|    298|    ctx->chunkshape[i] = chunkshape[i];
 3750|    298|    ctx->blockshape[i] = blockshape[i];
 3751|    298|    if (!blosc2_checked_mul_i32_nonneg(blocknitems, ctx->blockshape[i], &blocknitems)) {
  ------------------
  |  Branch (3751:9): [True: 0, False: 298]
  ------------------
 3752|      0|      blocksize_overflow = true;
 3753|      0|      break;
 3754|      0|    }
 3755|    298|  }
 3756|       |  // update_shape_struct() rejects this too, but only once an array is built out
 3757|       |  // of the context; catching it here keeps cparams->blocksize from wrapping
 3758|     87|  if (blocksize_overflow ||
  ------------------
  |  Branch (3758:7): [True: 0, False: 87]
  ------------------
 3759|     87|      !blosc2_checked_mul_i32_nonneg(blocknitems, cparams->typesize, &cparams->blocksize)) {
  ------------------
  |  Branch (3759:7): [True: 0, False: 87]
  ------------------
 3760|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3761|      0|    free(ctx->dtype);
 3762|      0|    free(cparams);
 3763|      0|    free(params_b2_storage);
 3764|      0|    free(ctx);
 3765|      0|    return NULL;
 3766|      0|  }
 3767|       |
 3768|     87|  ctx->nmetalayers = nmetalayers;
 3769|     87|  for (int i = 0; i < nmetalayers; ++i) {
  ------------------
  |  Branch (3769:19): [True: 0, False: 87]
  ------------------
 3770|      0|    ctx->metalayers[i] = metalayers[i];
 3771|      0|  }
 3772|       |
 3773|       |#if defined(HAVE_ZFP)
 3774|       |  #include "blosc2/codecs-registry.h"
 3775|       |  if ((ctx->b2_storage->cparams->compcode >= BLOSC_CODEC_ZFP_FIXED_ACCURACY) &&
 3776|       |      (ctx->b2_storage->cparams->compcode <= BLOSC_CODEC_ZFP_FIXED_RATE)) {
 3777|       |    for (int i = 0; i < BLOSC2_MAX_FILTERS; ++i) {
 3778|       |      if ((ctx->b2_storage->cparams->filters[i] == BLOSC_SHUFFLE) ||
 3779|       |          (ctx->b2_storage->cparams->filters[i] == BLOSC_BITSHUFFLE)) {
 3780|       |        BLOSC_TRACE_ERROR("ZFP cannot be run in presence of SHUFFLE / BITSHUFFLE");
 3781|       |        return NULL;
 3782|       |      }
 3783|       |    }
 3784|       |  }
 3785|       |#endif /* HAVE_ZFP */
 3786|       |
 3787|     87|  return ctx;
 3788|     87|}
b2nd_free_ctx:
 3791|     87|int b2nd_free_ctx(b2nd_context_t *ctx) {
 3792|     87|  ctx->b2_storage->cparams->schunk = NULL;
 3793|     87|  free(ctx->b2_storage->cparams);
 3794|     87|  free(ctx->b2_storage);
 3795|     87|  free(ctx->dtype);
 3796|     87|  free(ctx);
 3797|       |
 3798|     87|  return BLOSC2_ERROR_SUCCESS;
 3799|     87|}
b2nd.c:update_shape_struct:
  155|    259|                               const int32_t *chunkshape, const int32_t *blockshape) {
  156|    259|  BLOSC_ERROR(validate_shape_chunkshape_blockshape(ndim, shape, chunkshape, blockshape));
  ------------------
  |  |  111|    259|    do {                                            \
  |  |  112|    259|        int rc_ = (rc);                             \
  |  |  113|    259|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 259]
  |  |  ------------------
  |  |  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|    259|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 259]
  |  |  ------------------
  ------------------
  157|       |
  158|    259|  array->ndim = ndim;
  159|    259|  array->nitems = 1;
  160|    259|  array->extnitems = 1;
  161|    259|  array->extchunknitems = 1;
  162|    259|  array->chunknitems = 1;
  163|    259|  array->blocknitems = 1;
  164|  4.40k|  for (int i = 0; i < B2ND_MAX_DIM; ++i) {
  ------------------
  |  |   50|  4.40k|#define B2ND_MAX_DIM 16
  ------------------
  |  Branch (164:19): [True: 4.14k, False: 259]
  ------------------
  165|  4.14k|    if (i < ndim) {
  ------------------
  |  Branch (165:9): [True: 888, False: 3.25k]
  ------------------
  166|    888|      array->shape[i] = shape[i];
  167|    888|      array->chunkshape[i] = chunkshape[i];
  168|    888|      array->blockshape[i] = blockshape[i];
  169|    888|      if (array->chunkshape[i] != 0) {
  ------------------
  |  Branch (169:11): [True: 888, False: 0]
  ------------------
  170|    888|        if (shape[i] % array->chunkshape[i] == 0) {
  ------------------
  |  Branch (170:13): [True: 652, False: 236]
  ------------------
  171|    652|          array->extshape[i] = shape[i];
  172|    652|        } else {
  173|       |          // Rounding shape up to the next chunk must not wrap int64
  174|    236|          if (shape[i] > INT64_MAX - chunkshape[i]) {
  ------------------
  |  Branch (174:15): [True: 0, False: 236]
  ------------------
  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|    236|          array->extshape[i] = shape[i] + chunkshape[i] - shape[i] % chunkshape[i];
  179|    236|        }
  180|    888|        if (chunkshape[i] % blockshape[i] == 0) {
  ------------------
  |  Branch (180:13): [True: 813, False: 75]
  ------------------
  181|    813|          array->extchunkshape[i] = chunkshape[i];
  182|    813|        } else {
  183|       |          // Done in 64 bits: the sum of two int32 values does not fit in int32,
  184|       |          // and extchunkshape is int64 anyway
  185|     75|          array->extchunkshape[i] =
  186|     75|                  (int64_t) chunkshape[i] + blockshape[i] - chunkshape[i] % blockshape[i];
  187|     75|        }
  188|    888|      } else {
  189|      0|        array->extchunkshape[i] = chunkshape[i];
  190|      0|        array->extshape[i] = 0;
  191|      0|      }
  192|  3.25k|    } else {
  193|  3.25k|      array->blockshape[i] = 1;
  194|  3.25k|      array->chunkshape[i] = 1;
  195|  3.25k|      array->extshape[i] = 1;
  196|  3.25k|      array->extchunkshape[i] = 1;
  197|  3.25k|      array->shape[i] = 1;
  198|  3.25k|    }
  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|  4.14k|    if (!blosc2_checked_mul_i64_nonneg(array->nitems, array->shape[i], &array->nitems) ||
  ------------------
  |  Branch (201:9): [True: 0, False: 4.14k]
  ------------------
  202|  4.14k|        !blosc2_checked_mul_i64_nonneg(array->extnitems, array->extshape[i], &array->extnitems) ||
  ------------------
  |  Branch (202:9): [True: 0, False: 4.14k]
  ------------------
  203|  4.14k|        !blosc2_checked_mul_i64_nonneg(array->extchunknitems, array->extchunkshape[i],
  ------------------
  |  Branch (203:9): [True: 0, False: 4.14k]
  ------------------
  204|  4.14k|                                       &array->extchunknitems) ||
  205|  4.14k|        !blosc2_checked_mul_i32_nonneg(array->chunknitems, array->chunkshape[i], &array->chunknitems) ||
  ------------------
  |  Branch (205:9): [True: 0, False: 4.14k]
  ------------------
  206|  4.14k|        !blosc2_checked_mul_i32_nonneg(array->blocknitems, array->blockshape[i], &array->blocknitems)) {
  ------------------
  |  Branch (206:9): [True: 0, False: 4.14k]
  ------------------
  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|  4.14k|  }
  211|       |
  212|       |  // Compute strides
  213|    259|  if (ndim > 0) {
  ------------------
  |  Branch (213:7): [True: 259, False: 0]
  ------------------
  214|    259|    array->item_array_strides[ndim - 1] = 1;
  215|    259|    array->item_extchunk_strides[ndim - 1] = 1;
  216|    259|    array->item_chunk_strides[ndim - 1] = 1;
  217|    259|    array->item_block_strides[ndim - 1] = 1;
  218|    259|    array->block_chunk_strides[ndim - 1] = 1;
  219|    259|    array->chunk_array_strides[ndim - 1] = 1;
  220|    259|  }
  221|    888|  for (int i = ndim - 2; i >= 0; --i) {
  ------------------
  |  Branch (221:26): [True: 629, False: 259]
  ------------------
  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|    629|    if (shape[i + 1] != 0 && array->chunkshape[i + 1] != 0 &&
  ------------------
  |  Branch (232:9): [True: 629, False: 0]
  |  Branch (232:30): [True: 629, False: 0]
  ------------------
  233|    629|        array->blockshape[i + 1] != 0) {
  ------------------
  |  Branch (233:9): [True: 629, False: 0]
  ------------------
  234|    629|      if (!blosc2_checked_mul_i64_nonneg(array->item_array_strides[i + 1], array->shape[i + 1],
  ------------------
  |  Branch (234:11): [True: 0, False: 629]
  ------------------
  235|    629|                                         &array->item_array_strides[i]) ||
  236|    629|          !blosc2_checked_mul_i64_nonneg(array->item_extchunk_strides[i + 1], array->extchunkshape[i + 1],
  ------------------
  |  Branch (236:11): [True: 0, False: 629]
  ------------------
  237|    629|                                         &array->item_extchunk_strides[i]) ||
  238|    629|          !blosc2_checked_mul_i64_nonneg(array->item_chunk_strides[i + 1], array->chunkshape[i + 1],
  ------------------
  |  Branch (238:11): [True: 0, False: 629]
  ------------------
  239|    629|                                         &array->item_chunk_strides[i]) ||
  240|    629|          !blosc2_checked_mul_i64_nonneg(array->item_block_strides[i + 1], array->blockshape[i + 1],
  ------------------
  |  Branch (240:11): [True: 0, False: 629]
  ------------------
  241|    629|                                         &array->item_block_strides[i]) ||
  242|    629|          !blosc2_checked_mul_i64_nonneg(array->block_chunk_strides[i + 1],
  ------------------
  |  Branch (242:11): [True: 0, False: 629]
  ------------------
  243|    629|                                         array->extchunkshape[i + 1] / array->blockshape[i + 1],
  244|    629|                                         &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|    629|      int64_t extent;
  251|    629|      if (!blosc2_checked_mul_i64_nonneg(array->extshape[i + 1], array->chunkshape[i + 1], &extent) ||
  ------------------
  |  Branch (251:11): [True: 0, False: 629]
  ------------------
  252|    629|          !blosc2_checked_mul_i64_nonneg(array->chunk_array_strides[i + 1], extent,
  ------------------
  |  Branch (252:11): [True: 0, False: 629]
  ------------------
  253|    629|                                         &array->chunk_array_strides[i])) {
  254|      0|        array->chunk_array_strides[i] = 0;
  255|      0|      }
  256|    629|    } 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|    629|  }
  265|    259|  return BLOSC2_ERROR_SUCCESS;
  266|    259|}
b2nd.c:publish_shape_meta:
  270|    172|static int publish_shape_meta(b2nd_array_t *array) {
  271|    172|  if (!array->sc) {
  ------------------
  |  Branch (271:7): [True: 172, False: 0]
  ------------------
  272|    172|    return BLOSC2_ERROR_SUCCESS;
  273|    172|  }
  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|    427|static int refresh_if_stale(b2nd_array_t *array) {
  314|    427|  blosc2_schunk *sc = array->sc;
  315|    427|  if (sc == NULL || sc->frame == NULL) {
  ------------------
  |  Branch (315:7): [True: 0, False: 427]
  |  Branch (315:21): [True: 0, False: 427]
  ------------------
  316|      0|    return BLOSC2_ERROR_SUCCESS;
  317|      0|  }
  318|    427|  BLOSC_ERROR(frame_check_stale((blosc2_frame_s *) sc->frame));
  ------------------
  |  |  111|    427|    do {                                            \
  |  |  112|    427|        int rc_ = (rc);                             \
  |  |  113|    427|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 427]
  |  |  ------------------
  |  |  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|    427|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 427]
  |  |  ------------------
  ------------------
  319|    427|  if (array->last_tick == sc->change_tick) {
  ------------------
  |  Branch (319:7): [True: 340, False: 87]
  ------------------
  320|    340|    return BLOSC2_ERROR_SUCCESS;
  321|    340|  }
  322|       |
  323|     87|  uint8_t *smeta;
  324|     87|  int32_t smeta_len;
  325|     87|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (325:7): [True: 0, False: 87]
  ------------------
  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|     87|  int8_t ndim;
  345|     87|  int64_t shape[B2ND_MAX_DIM];
  346|     87|  int32_t chunkshape[B2ND_MAX_DIM];
  347|     87|  int32_t blockshape[B2ND_MAX_DIM];
  348|     87|  char *dtype;
  349|     87|  int8_t dtype_format;
  350|     87|  int rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape,
  351|     87|                                 &dtype, &dtype_format);
  352|     87|  free(smeta);
  353|     87|  BLOSC_ERROR(rc);
  ------------------
  |  |  111|     87|    do {                                            \
  |  |  112|     87|        int rc_ = (rc);                             \
  |  |  113|     87|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  354|     87|  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|     87|  if (ndim != array->ndim ||
  ------------------
  |  Branch (359:7): [True: 0, False: 87]
  ------------------
  360|     87|      memcmp(chunkshape, array->chunkshape, ndim * sizeof(int32_t)) != 0 ||
  ------------------
  |  Branch (360:7): [True: 0, False: 87]
  ------------------
  361|     87|      memcmp(blockshape, array->blockshape, ndim * sizeof(int32_t)) != 0) {
  ------------------
  |  Branch (361:7): [True: 0, False: 87]
  ------------------
  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|     87|  BLOSC_ERROR(update_shape_struct(array, ndim, shape, chunkshape, blockshape));
  ------------------
  |  |  111|     87|    do {                                            \
  |  |  112|     87|        int rc_ = (rc);                             \
  |  |  113|     87|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
  368|     87|  array->last_tick = sc->change_tick;
  369|       |
  370|     87|  return 1;
  371|     87|}
b2nd.c:check_schunk_matches_meta:
  620|     85|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|     85|  int64_t needed_nchunks = array->chunknitems == 0 ? 0 : array->extnitems / array->chunknitems;
  ------------------
  |  Branch (623:28): [True: 0, False: 85]
  ------------------
  624|     85|  if (schunk->nchunks < needed_nchunks) {
  ------------------
  |  Branch (624:7): [True: 0, False: 85]
  ------------------
  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|     85|  int64_t chunkbytes;
  632|     85|  if (schunk->nchunks > 0 && schunk->chunksize > 0 &&
  ------------------
  |  Branch (632:7): [True: 85, False: 0]
  |  Branch (632:30): [True: 85, False: 0]
  ------------------
  633|     85|      (!blosc2_checked_mul_i64_nonneg(array->extchunknitems, schunk->typesize, &chunkbytes) ||
  ------------------
  |  Branch (633:8): [True: 0, False: 85]
  ------------------
  634|     85|       chunkbytes != schunk->chunksize)) {
  ------------------
  |  Branch (634:8): [True: 0, False: 85]
  ------------------
  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|     85|  return BLOSC2_ERROR_SUCCESS;
  640|     85|}
b2nd.c:buffer_wants_prefault:
 1206|    170|static bool buffer_wants_prefault(const uint8_t *buffer, int64_t nbytes, int nthreads) {
 1207|    170|#if defined(__linux__)
 1208|       |  // A huge page is 2 MB with 4 KB pages; other page sizes are not probed
 1209|    170|  enum { huge_page = 2 << 20, small_page = 4096, npages = huge_page / small_page };
 1210|    170|  if (nthreads < 2 || nbytes < 2 * huge_page || sysconf(_SC_PAGESIZE) != small_page) {
  ------------------
  |  Branch (1210:7): [True: 170, False: 0]
  |  Branch (1210:23): [True: 0, False: 0]
  |  Branch (1210:49): [True: 0, False: 0]
  ------------------
 1211|    170|    return false;
 1212|    170|  }
 1213|       |  // The aligned huge page around the middle lies inside a buffer of 4 MB or more,
 1214|       |  // away from its first page, where malloc writes its chunk header
 1215|      0|  uint8_t *block = (uint8_t *) (((uintptr_t) buffer + (uintptr_t) (nbytes / 2)) & ~(uintptr_t) (huge_page - 1));
 1216|      0|  unsigned char resident[npages];
 1217|      0|  if (mincore(block, huge_page, resident) != 0) {
  ------------------
  |  Branch (1217:7): [True: 0, False: 0]
  ------------------
 1218|      0|    return false;
 1219|      0|  }
 1220|      0|  for (int i = 0; i < npages; i++) {
  ------------------
  |  Branch (1220:19): [True: 0, False: 0]
  ------------------
 1221|      0|    if (resident[i] & 1) {
  ------------------
  |  Branch (1221:9): [True: 0, False: 0]
  ------------------
 1222|      0|      return false;
 1223|      0|    }
 1224|      0|  }
 1225|       |  // Fault in one page as a write would, and see whether the whole huge page came
 1226|       |  // with it (best effort: kernels before 5.14 cannot, and then nothing is prefaulted)
 1227|      0|  if (madvise(block + huge_page / 2, small_page, MADV_POPULATE_WRITE) != 0 ||
  ------------------
  |  Branch (1227:7): [True: 0, False: 0]
  ------------------
 1228|      0|      mincore(block, huge_page, resident) != 0) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 0]
  ------------------
 1229|      0|    return false;
 1230|      0|  }
 1231|      0|  for (int i = 0; i < npages; i++) {
  ------------------
  |  Branch (1231:19): [True: 0, False: 0]
  ------------------
 1232|      0|    if ((resident[i] & 1) == 0) {
  ------------------
  |  Branch (1232:9): [True: 0, False: 0]
  ------------------
 1233|      0|      return false;
 1234|      0|    }
 1235|      0|  }
 1236|      0|  return true;
 1237|       |#else
 1238|       |  BLOSC_UNUSED_PARAM(buffer);
 1239|       |  BLOSC_UNUSED_PARAM(nbytes);
 1240|       |  BLOSC_UNUSED_PARAM(nthreads);
 1241|       |  return false;
 1242|       |#endif
 1243|      0|}
b2nd.c:chunk_blocks_in_c_order:
 1068|    257|static bool chunk_blocks_in_c_order(const b2nd_array_t *array) {
 1069|    257|  int k = 0;
 1070|    692|  for (int i = 0; i < array->ndim; ++i) {
  ------------------
  |  Branch (1070:19): [True: 577, False: 115]
  ------------------
 1071|    577|    if (array->chunkshape[i] % array->blockshape[i] != 0) {
  ------------------
  |  Branch (1071:9): [True: 42, False: 535]
  ------------------
 1072|     42|      return false;
 1073|     42|    }
 1074|    535|    if (i > k && array->chunkshape[i] != array->blockshape[i]) {
  ------------------
  |  Branch (1074:9): [True: 314, False: 221]
  |  Branch (1074:18): [True: 100, False: 214]
  ------------------
 1075|    100|      return false;
 1076|    100|    }
 1077|    435|    if (i == k && array->blockshape[i] == 1) {
  ------------------
  |  Branch (1077:9): [True: 221, False: 214]
  |  Branch (1077:19): [True: 9, False: 212]
  ------------------
 1078|      9|      k++;
 1079|      9|    }
 1080|    435|  }
 1081|    115|  return true;
 1082|    257|}
b2nd.c:prefetch_slice:
 1448|    170|static prefetch_batch* prefetch_slice(const b2nd_array_t *array, const int64_t *start, const int64_t *stop) {
 1449|    170|  blosc2_frame_s *frame = (blosc2_frame_s *) array->sc->frame;
 1450|    170|  if (!prefetch_applies(frame)) {
  ------------------
  |  Branch (1450:7): [True: 170, False: 0]
  ------------------
 1451|    170|    return NULL;
 1452|    170|  }
 1453|      0|  int8_t ndim = array->ndim;
 1454|      0|  int64_t nblocks = array->blocknitems > 0 ? array->extchunknitems / array->blocknitems : 0;
  ------------------
  |  Branch (1454:21): [True: 0, False: 0]
  ------------------
 1455|      0|  int64_t *nchunks = NULL;
 1456|      0|  int64_t n = b2nd_get_slice_nchunks(array, start, stop, &nchunks);
 1457|      0|  int64_t chunk_start[B2ND_MAX_DIM];
 1458|      0|  int64_t chunk_stop[B2ND_MAX_DIM];
 1459|      0|  int64_t npartial = 0;
 1460|      0|  for (int64_t c = 0; c < n && nblocks > 0; ++c) {
  ------------------
  |  Branch (1460:23): [True: 0, False: 0]
  |  Branch (1460:32): [True: 0, False: 0]
  ------------------
 1461|      0|    npartial += chunk_box(array, nchunks[c], start, stop, chunk_start, chunk_stop);
 1462|      0|  }
 1463|       |  // One maskout per chunk covered in part (NULL for a chunk read whole), all in one allocation
 1464|      0|  const bool **maskouts = NULL;
 1465|      0|  if (npartial > 0) {
  ------------------
  |  Branch (1465:7): [True: 0, False: 0]
  ------------------
 1466|      0|    maskouts = calloc(1, n * sizeof(bool *) + npartial * nblocks * sizeof(bool));
 1467|      0|  }
 1468|      0|  if (maskouts != NULL) {
  ------------------
  |  Branch (1468:7): [True: 0, False: 0]
  ------------------
 1469|      0|    bool *row = (bool *) (maskouts + n);
 1470|      0|    int64_t blocks_in_chunk[B2ND_MAX_DIM];
 1471|      0|    int64_t blockshape[B2ND_MAX_DIM];
 1472|      0|    for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1472:21): [True: 0, False: 0]
  ------------------
 1473|      0|      blocks_in_chunk[i] = array->extchunkshape[i] / array->blockshape[i];
 1474|      0|      blockshape[i] = array->blockshape[i];
 1475|      0|    }
 1476|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(array->sc->storage->io->id);
 1477|      0|    bool mapped = io_cb != NULL && !io_cb->is_allocation_necessary;
  ------------------
  |  Branch (1477:19): [True: 0, False: 0]
  |  Branch (1477:36): [True: 0, False: 0]
  ------------------
 1478|      0|    bool has_delta = filters_contain(array->sc->filters, BLOSC_DELTA);
 1479|      0|    slice_chunk_t slice_chunk;
 1480|      0|    memset(&slice_chunk, 0, sizeof(slice_chunk));
 1481|      0|    slice_chunk.array = array;
 1482|      0|    slice_chunk.start = start;
 1483|      0|    slice_chunk.stop = stop;
 1484|      0|    slice_chunk.chunk_start = chunk_start;
 1485|      0|    slice_chunk.chunk_stop = chunk_stop;
 1486|      0|    slice_chunk.blocks_in_chunk = blocks_in_chunk;
 1487|      0|    slice_chunk.blockshape = blockshape;
 1488|      0|    for (int64_t c = 0; c < n; ++c) {
  ------------------
  |  Branch (1488:25): [True: 0, False: 0]
  ------------------
 1489|      0|      if (!chunk_box(array, nchunks[c], start, stop, chunk_start, chunk_stop)) {
  ------------------
  |  Branch (1489:11): [True: 0, False: 0]
  ------------------
 1490|      0|        continue;  // read whole
 1491|      0|      }
 1492|      0|      int64_t nneeded = slice_chunk_maskout(&slice_chunk, nblocks, has_delta, row);
 1493|      0|      if (mapped || slice_chunk_compact(array, nneeded, has_delta)) {
  ------------------
  |  Branch (1493:11): [True: 0, False: 0]
  |  Branch (1493:21): [True: 0, False: 0]
  ------------------
 1494|      0|        maskouts[c] = row;
 1495|      0|        row += nblocks;
 1496|      0|      }
 1497|      0|    }
 1498|      0|  }
 1499|      0|  prefetch_batch *batch = prefetch_batch_new(frame, nchunks, n, maskouts, nblocks);
 1500|      0|  free(maskouts);
 1501|      0|  free(nchunks);
 1502|      0|  return batch;
 1503|    170|}
b2nd.c:chunks_special:
 1510|    170|static int chunks_special(blosc2_schunk *sc, const int64_t *nchunks, int64_t n, uint8_t *special) {
 1511|    170|  if (sc->frame != NULL) {
  ------------------
  |  Branch (1511:7): [True: 170, False: 0]
  ------------------
 1512|    170|    return frame_get_chunks_special((blosc2_frame_s *) sc->frame, nchunks, n, special);
 1513|    170|  }
 1514|      0|  for (int64_t k = 0; k < n; ++k) {
  ------------------
  |  Branch (1514:23): [True: 0, False: 0]
  ------------------
 1515|      0|    if (nchunks[k] < 0 || nchunks[k] >= sc->nchunks || sc->data[nchunks[k]] == NULL) {
  ------------------
  |  Branch (1515:9): [True: 0, False: 0]
  |  Branch (1515:27): [True: 0, False: 0]
  |  Branch (1515:56): [True: 0, False: 0]
  ------------------
 1516|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1517|      0|    }
 1518|      0|    const uint8_t *chunk = sc->data[nchunks[k]];
 1519|      0|    special[k] = (uint8_t) chunk_special_in_offset(chunk, sw32_(chunk + BLOSC2_CHUNK_CBYTES));
 1520|      0|  }
 1521|      0|  return BLOSC2_ERROR_SUCCESS;
 1522|      0|}
b2nd.c:chunk_slice_box:
 1184|  1.61k|                               int64_t *box_stop) {
 1185|  1.61k|  int64_t nitems = 1;
 1186|  7.78k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1186:19): [True: 6.17k, False: 1.61k]
  ------------------
 1187|  6.17k|    box_start[i] = (chunk_start[i] > start[i] ? chunk_start[i] : start[i]) - start[i];
  ------------------
  |  Branch (1187:21): [True: 2.82k, False: 3.35k]
  ------------------
 1188|  6.17k|    box_stop[i] = (chunk_stop[i] < stop[i] ? chunk_stop[i] : stop[i]) - start[i];
  ------------------
  |  Branch (1188:20): [True: 2.82k, False: 3.35k]
  ------------------
 1189|  6.17k|    nitems *= box_stop[i] - box_start[i];
 1190|  6.17k|  }
 1191|  1.61k|  return nitems;
 1192|  1.61k|}
b2nd.c:chunk_contiguous_in_buffer:
 1090|    463|                                       const int64_t *shape, int64_t *offset) {
 1091|       |  // Leading dims where the chunk is one item wide can sit anywhere; past the
 1092|       |  // first wider dim the chunk has to span the buffer.
 1093|    463|  bool must_span = false;
 1094|    463|  int64_t off = 0;
 1095|    909|  for (int i = 0; i < array->ndim; ++i) {
  ------------------
  |  Branch (1095:19): [True: 860, False: 49]
  ------------------
 1096|    860|    int64_t extent = array->chunkshape[i];
 1097|    860|    if (chunk_start[i] < start[i] || chunk_start[i] + extent > stop[i] ||
  ------------------
  |  Branch (1097:9): [True: 0, False: 860]
  |  Branch (1097:38): [True: 186, False: 674]
  ------------------
 1098|    674|        chunk_start[i] + extent > array->shape[i]) {
  ------------------
  |  Branch (1098:9): [True: 0, False: 674]
  ------------------
 1099|    186|      return false;
 1100|    186|    }
 1101|    674|    if (must_span && extent != shape[i]) {
  ------------------
  |  Branch (1101:9): [True: 301, False: 373]
  |  Branch (1101:22): [True: 228, False: 73]
  ------------------
 1102|    228|      return false;
 1103|    228|    }
 1104|    446|    if (extent > 1) {
  ------------------
  |  Branch (1104:9): [True: 437, False: 9]
  ------------------
 1105|    437|      must_span = true;
 1106|    437|    }
 1107|    446|    off = off * shape[i] + (chunk_start[i] - start[i]);
 1108|    446|  }
 1109|     49|  *offset = off * array->sc->typesize;
 1110|       |  return true;
 1111|    463|}
b2nd.c:compress_update_chunk:
 1349|    606|                                 int32_t nbytes, slice_chunk_t *gather) {
 1350|    606|  int32_t chunk_nbytes = nbytes + BLOSC2_MAX_OVERHEAD;
 1351|    606|  size_t chunk_capacity;
 1352|    606|  uint8_t *chunk = scratch_malloc(array, chunk_nbytes, &chunk_capacity);
 1353|    606|  BLOSC_ERROR_NULL(chunk, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    606|    do {                                            \
  |  |  105|    606|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 606]
  |  |  ------------------
  |  |  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|    606|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 606]
  |  |  ------------------
  ------------------
 1354|       |  // Update current_chunk in case a prefilter is applied
 1355|    606|  array->sc->current_nchunk = nchunk;
 1356|    606|  blosc2_context *cctx = array->sc->cctx;
 1357|    606|  blosc2_prefilter_params params;
 1358|    606|  blosc2_prefilter_params *saved_preparams = cctx->preparams;
 1359|    606|  bool saved_full_write = cctx->prefilter_full_write;
 1360|    606|  if (gather != NULL) {
  ------------------
  |  Branch (1360:7): [True: 515, False: 91]
  ------------------
 1361|    515|    memset(&params, 0, sizeof(params));
 1362|    515|    params.user_data = gather;
 1363|    515|    cctx->prefilter = slice_gather_prefilter;
 1364|    515|    cctx->preparams = &params;
 1365|       |    /* The gather callback copies old contents or clears partial/padding blocks;
 1366|       |     * a whole-block slice copy needs no preliminary memset. */
 1367|    515|    cctx->prefilter_full_write = true;
 1368|    515|  }
 1369|    606|  int brc = blosc2_compress_ctx(cctx, src, nbytes, chunk, chunk_nbytes);
 1370|    606|  if (gather != NULL) {
  ------------------
  |  Branch (1370:7): [True: 515, False: 91]
  ------------------
 1371|    515|    cctx->prefilter = NULL;
 1372|    515|    cctx->preparams = saved_preparams;
 1373|    515|    cctx->prefilter_full_write = saved_full_write;
 1374|    515|  }
 1375|    606|  if (brc < 0) {
  ------------------
  |  Branch (1375:7): [True: 2, False: 604]
  ------------------
 1376|      2|    blosc2_tmp_free(chunk, chunk_capacity);
 1377|      2|    BLOSC_TRACE_ERROR("Blosc can not compress the data");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1378|      2|    return BLOSC2_ERROR_FAILURE;
 1379|      2|  }
 1380|       |  // A frame stores its own copy of the chunk, so it is lent a reused buffer; an
 1381|       |  // in-memory super-chunk keeps the buffer itself
 1382|    606|  bool in_frame = array->sc->frame != NULL;
 1383|    604|  int64_t brc_ = in_frame ? schunk_update_chunk_lent(array->sc, nchunk, chunk)
  ------------------
  |  Branch (1383:18): [True: 604, False: 0]
  ------------------
 1384|    604|                          : blosc2_schunk_update_chunk(array->sc, nchunk, chunk, false);
 1385|    604|  if (in_frame || brc_ < 0) {
  ------------------
  |  Branch (1385:7): [True: 604, False: 0]
  |  Branch (1385:19): [True: 0, False: 0]
  ------------------
 1386|       |    // A failed update leaves the chunk to us
 1387|    604|    blosc2_tmp_free(chunk, chunk_capacity);
 1388|    604|  }
 1389|    604|  if (brc_ < 0) {
  ------------------
  |  Branch (1389:7): [True: 0, False: 604]
  ------------------
 1390|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1391|      0|    return BLOSC2_ERROR_FAILURE;
 1392|      0|  }
 1393|    604|  return BLOSC2_ERROR_SUCCESS;
 1394|    604|}
b2nd.c:slice_gather_prefilter:
 1312|  8.05k|static int slice_gather_prefilter(blosc2_prefilter_params *params) {
 1313|  8.05k|  const slice_chunk_t *c = params->user_data;
 1314|  8.05k|  const b2nd_array_t *array = c->array;
 1315|  8.05k|  int8_t ndim = array->ndim;
 1316|  8.05k|  int32_t typesize = array->sc->typesize;
 1317|  8.05k|  if (params->output_size != array->blocknitems * typesize) {
  ------------------
  |  Branch (1317:7): [True: 0, False: 8.05k]
  ------------------
 1318|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1319|      0|    return BLOSC2_ERROR_FAILURE;
 1320|      0|  }
 1321|  8.05k|  block_overlap_t overlap;
 1322|  8.05k|  bool overlaps = block_slice_overlap(c, params->nblock, &overlap);
 1323|  8.05k|  if (!(overlaps && overlap.whole_block)) {
  ------------------
  |  Branch (1323:9): [True: 7.69k, False: 354]
  |  Branch (1323:21): [True: 6.20k, False: 1.49k]
  ------------------
 1324|  1.84k|    if (c->keep_old) {
  ------------------
  |  Branch (1324:9): [True: 0, False: 1.84k]
  ------------------
 1325|      0|      memcpy(params->output, params->input, (size_t) params->output_size);
 1326|  1.84k|    } else {
 1327|  1.84k|      memset(params->output, 0, (size_t) params->output_size);
 1328|  1.84k|    }
 1329|  1.84k|  }
 1330|  8.05k|  if (!overlaps) {
  ------------------
  |  Branch (1330:7): [True: 354, False: 7.69k]
  ------------------
 1331|    354|    return 0;
 1332|    354|  }
 1333|  7.69k|  return b2nd_copy_buffer2(ndim, typesize, c->buffer, c->buffershape, overlap.dst_start,
 1334|  7.69k|                           overlap.dst_stop, params->output, c->blockshape, overlap.src_start);
 1335|  8.05k|}
b2nd.c:decoded_nothing:
 1304|    180|static bool decoded_nothing(const blosc2_context *dctx, int rc) {
 1305|    180|  return rc == 0 || (dctx->special_type == BLOSC2_SPECIAL_UNINIT && dctx->postfilter == NULL);
  ------------------
  |  Branch (1305:10): [True: 0, False: 180]
  |  Branch (1305:22): [True: 0, False: 180]
  |  Branch (1305:69): [True: 0, False: 0]
  ------------------
 1306|    180|}
b2nd.c:scratch_malloc:
 1340|    814|static uint8_t *scratch_malloc(const b2nd_array_t *array, int32_t nbytes, size_t *capacity) {
 1341|    814|  return schunk_scratch_malloc(array->sc, nbytes, capacity);
 1342|    814|}
b2nd.c:block_slice_overlap:
 1149|  36.9k|static bool block_slice_overlap(const slice_chunk_t *c, int64_t nblock, block_overlap_t *overlap) {
 1150|  36.9k|  int8_t ndim = c->array->ndim;
 1151|  36.9k|  int64_t nblock_ndim[B2ND_MAX_DIM] = {0};
 1152|  36.9k|  blosc2_unidim_to_multidim(ndim, (int64_t *) c->blocks_in_chunk, nblock, nblock_ndim);
 1153|  36.9k|  bool whole_block = true;
 1154|   178k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (1154:19): [True: 143k, False: 34.6k]
  ------------------
 1155|   143k|    int64_t block_start = c->chunk_start[i] + nblock_ndim[i] * c->blockshape[i];
 1156|   143k|    int64_t block_stop = block_start + c->blockshape[i];
 1157|   143k|    if (block_stop > c->chunk_stop[i]) {
  ------------------
  |  Branch (1157:9): [True: 13.7k, False: 130k]
  ------------------
 1158|  13.7k|      block_stop = c->chunk_stop[i];
 1159|  13.7k|    }
 1160|   143k|    int64_t lo = block_start > c->start[i] ? block_start : c->start[i];
  ------------------
  |  Branch (1160:18): [True: 104k, False: 39.6k]
  ------------------
 1161|   143k|    int64_t hi = block_stop < c->stop[i] ? block_stop : c->stop[i];
  ------------------
  |  Branch (1161:18): [True: 102k, False: 41.7k]
  ------------------
 1162|   143k|    if (lo >= hi) {
  ------------------
  |  Branch (1162:9): [True: 2.27k, False: 141k]
  ------------------
 1163|  2.27k|      return false;
 1164|  2.27k|    }
 1165|   141k|    whole_block &= lo == block_start && hi == block_start + c->blockshape[i];
  ------------------
  |  Branch (1165:20): [True: 141k, False: 0]
  |  Branch (1165:41): [True: 130k, False: 11.5k]
  ------------------
 1166|   141k|    if (overlap != NULL) {
  ------------------
  |  Branch (1166:9): [True: 87.7k, False: 53.9k]
  ------------------
 1167|  87.7k|      overlap->src_start[i] = lo - block_start;
 1168|  87.7k|      overlap->src_stop[i] = hi - block_start;
 1169|  87.7k|      overlap->dst_start[i] = lo - c->start[i];
 1170|  87.7k|      overlap->dst_stop[i] = hi - c->start[i];
 1171|  87.7k|    }
 1172|   141k|  }
 1173|  34.6k|  if (overlap != NULL) {
  ------------------
  |  Branch (1173:7): [True: 21.5k, False: 13.0k]
  ------------------
 1174|  21.5k|    overlap->whole_block = whole_block;
 1175|  21.5k|  }
 1176|       |  return true;
 1177|  36.9k|}
b2nd.c:slice_chunk_maskout:
 1399|  1.17k|static int64_t slice_chunk_maskout(const slice_chunk_t *c, int64_t nblocks, bool has_delta, bool *maskout) {
 1400|  1.17k|  int64_t nneeded = 0;
 1401|  15.4k|  for (int64_t nblock = 0; nblock < nblocks; ++nblock) {
  ------------------
  |  Branch (1401:28): [True: 14.2k, False: 1.17k]
  ------------------
 1402|  14.2k|    maskout[nblock] = !block_slice_overlap(c, nblock, NULL);
 1403|  14.2k|    nneeded += !maskout[nblock];
 1404|  14.2k|  }
 1405|  1.17k|  if (has_delta && nneeded > 0) {
  ------------------
  |  Branch (1405:7): [True: 148, False: 1.02k]
  |  Branch (1405:20): [True: 148, False: 0]
  ------------------
 1406|       |    maskout[0] = false;
 1407|    148|  }
 1408|  1.17k|  return nneeded;
 1409|  1.17k|}
b2nd.c:slice_chunk_compact:
 1414|  1.17k|static bool slice_chunk_compact(const b2nd_array_t *array, int64_t nblocks_needed, bool has_delta) {
 1415|  1.17k|  bool on_disk = array->sc->storage != NULL && array->sc->storage->urlpath != NULL;
  ------------------
  |  Branch (1415:18): [True: 1.17k, False: 0]
  |  Branch (1415:48): [True: 0, False: 1.17k]
  ------------------
 1416|  1.17k|  int64_t frac = on_disk ? 4 : 16;
  ------------------
  |  Branch (1416:18): [True: 0, False: 1.17k]
  ------------------
 1417|  1.17k|  int64_t block_nbytes = (int64_t) array->blocknitems * array->sc->typesize;
 1418|  1.17k|  int64_t data_nbytes = array->extchunknitems * array->sc->typesize;
 1419|  1.17k|  return !has_delta && nblocks_needed * block_nbytes * frac <= data_nbytes;
  ------------------
  |  Branch (1419:10): [True: 1.02k, False: 148]
  |  Branch (1419:24): [True: 0, False: 1.02k]
  ------------------
 1420|  1.17k|}
b2nd.c:slice_scatter_postfilter:
 1269|  11.4k|static int slice_scatter_postfilter(blosc2_postfilter_params *params) {
 1270|  11.4k|  const slice_chunk_t *c = params->user_data;
 1271|  11.4k|  const b2nd_array_t *array = c->array;
 1272|  11.4k|  int8_t ndim = array->ndim;
 1273|  11.4k|  int32_t typesize = array->sc->typesize;
 1274|  11.4k|  if (params->size != array->blocknitems * typesize) {
  ------------------
  |  Branch (1274:7): [True: 0, False: 11.4k]
  ------------------
 1275|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1276|      0|    return BLOSC2_ERROR_FAILURE;
 1277|      0|  }
 1278|  11.4k|  block_overlap_t overlap;
 1279|  11.4k|  if (!block_slice_overlap(c, params->nblock, &overlap)) {
  ------------------
  |  Branch (1279:7): [True: 0, False: 11.4k]
  ------------------
 1280|      0|    return 0;
 1281|      0|  }
 1282|  11.4k|  if (params->ctx->special_type == BLOSC2_SPECIAL_UNINIT) {
  ------------------
  |  Branch (1282:7): [True: 0, False: 11.4k]
  ------------------
 1283|       |    // Nothing was decoded into the input; hand out zeros rather than stale memory
 1284|      0|    b2nd_zero_box(ndim, typesize, c->buffer, c->buffershape, overlap.dst_start, overlap.dst_stop);
 1285|      0|    return 0;
 1286|      0|  }
 1287|  11.4k|  return b2nd_copy_buffer2(ndim, typesize, params->input, c->blockshape, overlap.src_start,
 1288|  11.4k|                           overlap.src_stop, c->buffer, c->buffershape, overlap.dst_start);
 1289|  11.4k|}
b2nd.c:scatter_unsupported:
 1295|  1.02k|static bool scatter_unsupported(const blosc2_context *dctx) {
 1296|  1.02k|  return (dctx->blosc2_flags & BLOSC2_INSTR_CODEC) || filters_contain(dctx->filters, BLOSC_DELTA);
  ------------------
  |  Branch (1296:10): [True: 0, False: 1.02k]
  |  Branch (1296:55): [True: 0, False: 1.02k]
  ------------------
 1297|  1.02k|}
b2nd.c:locked_get_set_slice:
 2099|    257|                                bool set_slice, bool slice_only, prefetch_batch *prefetch) {
 2100|    257|  blosc2_frame_s *frame = (blosc2_frame_s *) array->sc->frame;
 2101|    257|  BLOSC_ERROR(set_slice ? frame_begin_updates(frame) : frame_lock(frame, false));
  ------------------
  |  |  111|    257|    do {                                            \
  |  |  112|    514|        int rc_ = (rc);                             \
  |  |  ------------------
  |  |  |  Branch (112:20): [True: 87, False: 170]
  |  |  ------------------
  |  |  113|    257|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 257]
  |  |  ------------------
  |  |  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|    257|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 257]
  |  |  ------------------
  ------------------
 2102|    257|  int rc = refresh_if_stale(array);
 2103|    257|  if (rc >= 0) {
  ------------------
  |  Branch (2103:7): [True: 257, False: 0]
  ------------------
 2104|    257|    rc = get_set_slice(buffer, buffersize, start, stop, shape, array, set_slice, slice_only, prefetch);
 2105|    257|  }
 2106|    257|  if (set_slice) {
  ------------------
  |  Branch (2106:7): [True: 87, False: 170]
  ------------------
 2107|     87|    int end_rc = frame_end_updates(frame, array->sc);
 2108|     87|    rc = (rc < 0) ? rc : end_rc;
  ------------------
  |  Branch (2108:10): [True: 2, False: 85]
  ------------------
 2109|     87|  }
 2110|    170|  else {
 2111|    170|    frame_unlock(frame);
 2112|    170|  }
 2113|    257|  BLOSC_ERROR(rc);
  ------------------
  |  |  111|    257|    do {                                            \
  |  |  112|    257|        int rc_ = (rc);                             \
  |  |  113|    257|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 2, False: 255]
  |  |  ------------------
  |  |  114|      2|            char *error_msg = print_error(rc_);     \
  |  |  115|      2|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      2|            return rc_;                             \
  |  |  117|      2|        }                                           \
  |  |  118|    257|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 255]
  |  |  ------------------
  ------------------
 2114|       |
 2115|    255|  return BLOSC2_ERROR_SUCCESS;
 2116|    257|}
b2nd.c:validate_shape_chunkshape_blockshape:
  124|    346|                                                const int32_t *chunkshape, const int32_t *blockshape) {
  125|  1.53k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (125:19): [True: 1.18k, False: 346]
  ------------------
  126|  1.18k|    if (shape[i] < 0) {
  ------------------
  |  Branch (126:9): [True: 0, False: 1.18k]
  ------------------
  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.18k|    if (chunkshape[i] < 0 || blockshape[i] < 0) {
  ------------------
  |  Branch (130:9): [True: 0, False: 1.18k]
  |  Branch (130:30): [True: 0, False: 1.18k]
  ------------------
  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.18k|    bool chunkshape_is_zero = (chunkshape[i] == 0);
  136|  1.18k|    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.18k|    if (blockshape_is_zero && !chunkshape_is_zero) {
  ------------------
  |  Branch (140:9): [True: 0, False: 1.18k]
  |  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.18k|  }
  145|       |
  146|    346|  return BLOSC2_ERROR_SUCCESS;
  147|    346|}

b2nd_copy_buffer2:
  192|  21.5k|                      const int64_t *dst_start) {
  193|  21.5k|  int64_t copy_shape[B2ND_MAX_DIM];
  194|   107k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (194:19): [True: 85.9k, False: 21.5k]
  ------------------
  195|  85.9k|    copy_shape[i] = src_stop[i] - src_start[i];
  196|  85.9k|    if (copy_shape[i] == 0) {
  ------------------
  |  Branch (196:9): [True: 0, False: 85.9k]
  ------------------
  197|      0|      return BLOSC2_ERROR_SUCCESS;
  198|      0|    }
  199|  85.9k|  }
  200|  21.5k|  copy_or_zero_box(ndim, itemsize, copy_shape, src, src_pad_shape, src_start, dst, dst_pad_shape, dst_start);
  201|       |
  202|  21.5k|  return BLOSC2_ERROR_SUCCESS;
  203|  21.5k|}
b2nd_utils.c:copy_or_zero_box:
  156|  21.5k|                             uint8_t *dst, const int64_t *dst_pad_shape, const int64_t *dst_start) {
  157|  21.5k|  int64_t src_strides[B2ND_MAX_DIM];
  158|  21.5k|  int64_t dst_strides[B2ND_MAX_DIM];
  159|  21.5k|  byte_strides(ndim, itemsize, src_pad_shape, src_strides);
  160|  21.5k|  byte_strides(ndim, itemsize, dst_pad_shape, dst_strides);
  161|  21.5k|  int64_t src_offset = 0;
  162|  21.5k|  int64_t dst_offset = 0;
  163|   107k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (163:19): [True: 85.9k, False: 21.5k]
  ------------------
  164|  85.9k|    src_offset += src_start[i] * src_strides[i];
  165|  85.9k|    dst_offset += dst_start[i] * dst_strides[i];
  166|  85.9k|  }
  167|  21.5k|  dst += dst_offset;
  168|  21.5k|  if (src != NULL) {
  ------------------
  |  Branch (168:7): [True: 21.5k, False: 0]
  ------------------
  169|  21.5k|    src += src_offset;
  170|  21.5k|  }
  171|       |
  172|  21.5k|  int64_t shape[B2ND_MAX_DIM];
  173|  21.5k|  int64_t src_bstrides[B2ND_MAX_DIM];
  174|  21.5k|  int64_t dst_bstrides[B2ND_MAX_DIM];
  175|  21.5k|  int ndim_bytes = simplify_box(ndim, itemsize, box_shape, src_strides, dst_strides, shape, src_bstrides,
  176|  21.5k|                                dst_bstrides);
  177|  21.5k|  if (ndim_bytes > 1) {
  ------------------
  |  Branch (177:7): [True: 21.5k, False: 87]
  ------------------
  178|  21.5k|    copy_box(ndim_bytes, shape, src, src_bstrides, dst, dst_bstrides);
  179|  21.5k|  } else if (src == NULL) {
  ------------------
  |  Branch (179:14): [True: 0, False: 87]
  ------------------
  180|      0|    memset(dst, 0, (size_t) shape[0]);
  181|     87|  } else {
  182|     87|    memcpy(dst, src, (size_t) shape[0]);
  183|     87|  }
  184|  21.5k|}
b2nd_utils.c:byte_strides:
  143|  43.1k|static void byte_strides(int8_t ndim, int32_t itemsize, const int64_t *pad_shape, int64_t *strides) {
  144|  43.1k|  int64_t stride = itemsize;
  145|   215k|  for (int i = ndim - 1; i >= 0; --i) {
  ------------------
  |  Branch (145:26): [True: 171k, False: 43.1k]
  ------------------
  146|   171k|    strides[i] = stride;
  147|   171k|    stride *= pad_shape[i];
  148|   171k|  }
  149|  43.1k|}
b2nd_utils.c:simplify_box:
  114|  21.5k|                        int64_t *shape, int64_t *src_bstrides, int64_t *dst_bstrides) {
  115|  21.5k|  int n = 0;
  116|  21.5k|  int64_t extent = itemsize;
  117|  21.5k|  int64_t src_stride = 1;
  118|  21.5k|  int64_t dst_stride = 1;
  119|   107k|  for (int i = ndim - 1; i >= 0; --i) {
  ------------------
  |  Branch (119:26): [True: 85.9k, False: 21.5k]
  ------------------
  120|  85.9k|    if (box_shape[i] == 1) {
  ------------------
  |  Branch (120:9): [True: 6.79k, False: 79.1k]
  ------------------
  121|  6.79k|      continue;
  122|  6.79k|    }
  123|  79.1k|    if (src_strides[i] == src_stride * extent && dst_strides[i] == dst_stride * extent) {
  ------------------
  |  Branch (123:9): [True: 52.9k, False: 26.1k]
  |  Branch (123:50): [True: 20.5k, False: 32.3k]
  ------------------
  124|  20.5k|      extent *= box_shape[i];
  125|  20.5k|      continue;
  126|  20.5k|    }
  127|  58.5k|    shape[n] = extent;
  128|  58.5k|    src_bstrides[n] = src_stride;
  129|  58.5k|    dst_bstrides[n] = dst_stride;
  130|  58.5k|    ++n;
  131|  58.5k|    extent = box_shape[i];
  132|  58.5k|    src_stride = src_strides[i];
  133|  58.5k|    dst_stride = dst_strides[i];
  134|  58.5k|  }
  135|  21.5k|  shape[n] = extent;
  136|  21.5k|  src_bstrides[n] = src_stride;
  137|  21.5k|  dst_bstrides[n] = dst_stride;
  138|  21.5k|  return n + 1;
  139|  21.5k|}
b2nd_utils.c:copy_box:
   69|  21.5k|                     uint8_t *dst, const int64_t *dst_strides) {
   70|  21.5k|  const int64_t row_nbytes = shape[0];
   71|  21.5k|  const int64_t nrows = shape[1];
   72|  21.5k|  const int64_t src_row_stride = src_strides[1];
   73|  21.5k|  const int64_t dst_row_stride = dst_strides[1];
   74|  21.5k|  int64_t index[B2ND_MAX_DIM];
   75|  58.5k|  for (int i = 2; i < ndim; ++i) {
  ------------------
  |  Branch (75:19): [True: 37.0k, False: 21.5k]
  ------------------
   76|  37.0k|    index[i] = 0;
   77|  37.0k|  }
   78|  76.6k|  for (;;) {
   79|  76.6k|    int64_t src_offset = 0;
   80|  76.6k|    int64_t dst_offset = 0;
   81|   219k|    for (int i = 2; i < ndim; ++i) {
  ------------------
  |  Branch (81:21): [True: 142k, False: 76.6k]
  ------------------
   82|   142k|      src_offset += index[i] * src_strides[i];
   83|   142k|      dst_offset += index[i] * dst_strides[i];
   84|   142k|    }
   85|  76.6k|    if (src == NULL) {
  ------------------
  |  Branch (85:9): [True: 0, False: 76.6k]
  ------------------
   86|      0|      uint8_t *row = dst + dst_offset;
   87|      0|      for (int64_t r = 0; r < nrows; ++r) {
  ------------------
  |  Branch (87:27): [True: 0, False: 0]
  ------------------
   88|      0|        memset(row, 0, (size_t) row_nbytes);
   89|      0|        row += dst_row_stride;
   90|      0|      }
   91|  76.6k|    } else {
   92|  76.6k|      copy_rows(dst + dst_offset, dst_row_stride, src + src_offset, src_row_stride, nrows, row_nbytes);
   93|  76.6k|    }
   94|  76.6k|    int i = 2;
   95|   130k|    while (i < ndim && ++index[i] == shape[i]) {
  ------------------
  |  Branch (95:12): [True: 108k, False: 21.5k]
  |  Branch (95:24): [True: 53.7k, False: 55.0k]
  ------------------
   96|  53.7k|      index[i] = 0;
   97|  53.7k|      ++i;
   98|  53.7k|    }
   99|  76.6k|    if (i == ndim) {
  ------------------
  |  Branch (99:9): [True: 21.5k, False: 55.0k]
  ------------------
  100|  21.5k|      break;
  101|  21.5k|    }
  102|  76.6k|  }
  103|  21.5k|}
b2nd_utils.c:copy_rows:
   23|  76.6k|                             int64_t nrows, int64_t row_nbytes) {
   24|  76.6k|#define COPY_ROWS(stmt)                     \
   25|  76.6k|  for (int64_t r = nrows; r > 0; --r) {     \
   26|  76.6k|    stmt;                                   \
   27|  76.6k|    dst += dst_stride;                      \
   28|  76.6k|    src += src_stride;                      \
   29|  76.6k|  }
   30|  76.6k|#define MOVE_2X(n)                                                     \
   31|  76.6k|  memcpy(dst, src, n);                                                 \
   32|  76.6k|  memcpy(dst + row_nbytes - (n), src + row_nbytes - (n), n)
   33|       |
   34|  76.6k|  if (row_nbytes > 64) {
  ------------------
  |  Branch (34:7): [True: 42, False: 76.5k]
  ------------------
   35|     42|    COPY_ROWS(memcpy(dst, src, (size_t) row_nbytes))
  ------------------
  |  |   25|    210|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 168, False: 42]
  |  |  ------------------
  |  |   26|    168|    stmt;                                   \
  |  |   27|    168|    dst += dst_stride;                      \
  |  |   28|    168|    src += src_stride;                      \
  |  |   29|    168|  }
  ------------------
   36|  76.5k|  } else if (row_nbytes > 32) {
  ------------------
  |  Branch (36:14): [True: 6, False: 76.5k]
  ------------------
   37|      6|    COPY_ROWS(MOVE_2X(32))
  ------------------
  |  |   25|     27|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 21, False: 6]
  |  |  ------------------
  |  |   26|     21|    stmt;                                   \
  |  |   27|     21|    dst += dst_stride;                      \
  |  |   28|     21|    src += src_stride;                      \
  |  |   29|     21|  }
  ------------------
   38|  76.5k|  } else if (row_nbytes == 32) {
  ------------------
  |  Branch (38:14): [True: 312, False: 76.2k]
  ------------------
   39|    312|    COPY_ROWS(memcpy(dst, src, 32))
  ------------------
  |  |   25|  1.24k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 936, False: 312]
  |  |  ------------------
  |  |   26|    936|    stmt;                                   \
  |  |   27|    936|    dst += dst_stride;                      \
  |  |   28|    936|    src += src_stride;                      \
  |  |   29|    936|  }
  ------------------
   40|  76.2k|  } else if (row_nbytes > 16) {
  ------------------
  |  Branch (40:14): [True: 0, False: 76.2k]
  ------------------
   41|      0|    COPY_ROWS(MOVE_2X(16))
  ------------------
  |  |   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|  }
  ------------------
   42|  76.2k|  } else if (row_nbytes == 16) {
  ------------------
  |  Branch (42:14): [True: 60.4k, False: 15.8k]
  ------------------
   43|  60.4k|    COPY_ROWS(memcpy(dst, src, 16))
  ------------------
  |  |   25|   184k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 124k, False: 60.4k]
  |  |  ------------------
  |  |   26|   124k|    stmt;                                   \
  |  |   27|   124k|    dst += dst_stride;                      \
  |  |   28|   124k|    src += src_stride;                      \
  |  |   29|   124k|  }
  ------------------
   44|  60.4k|  } else if (row_nbytes > 8) {
  ------------------
  |  Branch (44:14): [True: 84, False: 15.7k]
  ------------------
   45|     84|    COPY_ROWS(MOVE_2X(8))
  ------------------
  |  |   25|    378|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 294, False: 84]
  |  |  ------------------
  |  |   26|    294|    stmt;                                   \
  |  |   27|    294|    dst += dst_stride;                      \
  |  |   28|    294|    src += src_stride;                      \
  |  |   29|    294|  }
  ------------------
   46|  15.7k|  } else if (row_nbytes == 8) {
  ------------------
  |  Branch (46:14): [True: 7.08k, False: 8.64k]
  ------------------
   47|  7.08k|    COPY_ROWS(memcpy(dst, src, 8))
  ------------------
  |  |   25|  21.2k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 14.1k, False: 7.08k]
  |  |  ------------------
  |  |   26|  14.1k|    stmt;                                   \
  |  |   27|  14.1k|    dst += dst_stride;                      \
  |  |   28|  14.1k|    src += src_stride;                      \
  |  |   29|  14.1k|  }
  ------------------
   48|  8.64k|  } else if (row_nbytes > 4) {
  ------------------
  |  Branch (48:14): [True: 0, False: 8.64k]
  ------------------
   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|  8.64k|  } else if (row_nbytes == 4) {
  ------------------
  |  Branch (50:14): [True: 7.80k, False: 847]
  ------------------
   51|  7.80k|    COPY_ROWS(memcpy(dst, src, 4))
  ------------------
  |  |   25|  23.6k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 15.8k, False: 7.80k]
  |  |  ------------------
  |  |   26|  15.8k|    stmt;                                   \
  |  |   27|  15.8k|    dst += dst_stride;                      \
  |  |   28|  15.8k|    src += src_stride;                      \
  |  |   29|  15.8k|  }
  ------------------
   52|  7.80k|  } else if (row_nbytes > 2) {
  ------------------
  |  Branch (52:14): [True: 9, False: 838]
  ------------------
   53|      9|    COPY_ROWS(MOVE_2X(2))
  ------------------
  |  |   25|     42|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 33, False: 9]
  |  |  ------------------
  |  |   26|     33|    stmt;                                   \
  |  |   27|     33|    dst += dst_stride;                      \
  |  |   28|     33|    src += src_stride;                      \
  |  |   29|     33|  }
  ------------------
   54|    838|  } else if (row_nbytes == 2) {
  ------------------
  |  Branch (54:14): [True: 832, False: 6]
  ------------------
   55|    832|    COPY_ROWS(memcpy(dst, src, 2))
  ------------------
  |  |   25|  2.49k|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 1.66k, False: 832]
  |  |  ------------------
  |  |   26|  1.66k|    stmt;                                   \
  |  |   27|  1.66k|    dst += dst_stride;                      \
  |  |   28|  1.66k|    src += src_stride;                      \
  |  |   29|  1.66k|  }
  ------------------
   56|    832|  } else {
   57|      6|    COPY_ROWS(*dst = *src)
  ------------------
  |  |   25|     30|  for (int64_t r = nrows; r > 0; --r) {     \
  |  |  ------------------
  |  |  |  Branch (25:27): [True: 24, False: 6]
  |  |  ------------------
  |  |   26|     24|    stmt;                                   \
  |  |   27|     24|    dst += dst_stride;                      \
  |  |   28|     24|    src += src_stride;                      \
  |  |   29|     24|  }
  ------------------
   58|      6|  }
   59|  76.6k|#undef MOVE_2X
   60|  76.6k|#undef COPY_ROWS
   61|  76.6k|}

bshuf_trans_bit_byte_AVX:
   66|  25.2k|                                 const size_t elem_size) {
   67|       |
   68|  25.2k|  size_t ii, kk;
   69|  25.2k|  const char* in_b = (const char*) in;
   70|  25.2k|  char* out_b = (char*) out;
   71|       |
   72|  25.2k|  size_t nbyte = elem_size * size;
   73|       |
   74|  25.2k|  int64_t count;
   75|       |
   76|  25.2k|  __m256i ymm;
   77|  25.2k|  int32_t bt;
   78|       |
   79|  25.2k|  ii = bshuf_emit_constant_prefix(in, out, nbyte);
   80|  25.2k|  if (ii == nbyte) return nbyte;
  ------------------
  |  Branch (80:7): [True: 0, False: 25.2k]
  ------------------
   81|  25.3k|  for (; ii + 31 < nbyte; ii += 32) {
  ------------------
  |  Branch (81:10): [True: 64, False: 25.2k]
  ------------------
   82|     64|    ymm = _mm256_loadu_si256((__m256i *) &in_b[ii]);
   83|    576|    for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (83:18): [True: 512, False: 64]
  ------------------
   84|    512|      bt = _mm256_movemask_epi8(ymm);
   85|    512|      ymm = _mm256_slli_epi16(ymm, 1);
   86|    512|      memcpy(out_b + ((7 - kk) * nbyte + ii) / 8, &bt, sizeof(bt));
   87|    512|    }
   88|     64|  }
   89|  25.2k|  count = bshuf_trans_bit_byte_remainder(in, out, size, elem_size,
   90|  25.2k|                                         nbyte - nbyte % 32);
   91|  25.2k|  return count;
   92|  25.2k|}
bshuf_trans_bit_elem_AVX:
   97|  3.16k|                                 const size_t elem_size, void* tmp_buf) {
   98|       |
   99|  3.16k|  int64_t count;
  100|       |
  101|  3.16k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  3.16k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 3.16k]
  |  |  ------------------
  ------------------
  102|       |
  103|  3.16k|  if ((elem_size == 1 || elem_size == 2 || elem_size == 4 || elem_size == 8 || elem_size == 16)
  ------------------
  |  Branch (103:8): [True: 0, False: 3.16k]
  |  Branch (103:26): [True: 0, False: 3.16k]
  |  Branch (103:44): [True: 8, False: 3.15k]
  |  Branch (103:62): [True: 3.15k, False: 0]
  |  Branch (103:80): [True: 0, False: 0]
  ------------------
  104|  3.16k|      && size <= INT32_MAX / elem_size) {
  ------------------
  |  Branch (104:10): [True: 3.16k, False: 0]
  ------------------
  105|  3.16k|    const uint8_t* bytes = (const uint8_t*)in;
  106|  3.16k|    if (elem_size != 1) {
  ------------------
  |  Branch (106:9): [True: 3.16k, False: 0]
  ------------------
  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.16k|      shuffle_sse2((int32_t)elem_size, (int32_t)(size * elem_size), in, tmp_buf);
  110|  3.16k|      bytes = (const uint8_t*)tmp_buf;
  111|  3.16k|    }
  112|  28.4k|    for (size_t j = 0; j < elem_size; ++j) {
  ------------------
  |  Branch (112:24): [True: 25.2k, False: 3.16k]
  ------------------
  113|  25.2k|      count = bshuf_trans_bit_byte_AVX(bytes + j * size, (uint8_t*)out + j * size, size, 1);
  114|  25.2k|      CHECK_ERR(count);
  ------------------
  |  |   40|  25.2k|        do {                              \
  |  |   41|  25.2k|          if ((count) < 0)                \
  |  |  ------------------
  |  |  |  Branch (41:15): [True: 0, False: 25.2k]
  |  |  ------------------
  |  |   42|  25.2k|            return count;                 \
  |  |   43|  25.2k|         } while (0)
  |  |  ------------------
  |  |  |  Branch (43:19): [Folded, False: 25.2k]
  |  |  ------------------
  ------------------
  115|  25.2k|    }
  116|  3.16k|    return size * elem_size;
  117|  3.16k|  }
  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|      4|                                    const size_t elem_size) {
  132|       |
  133|      4|  size_t hh, ii, jj, kk, mm;
  134|      4|  const char* in_b = (const char*) in;
  135|      4|  char* out_b = (char*) out;
  136|       |
  137|      4|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|      4|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  138|       |
  139|      4|  size_t nrows = 8 * elem_size;
  140|      4|  size_t nbyte_row = size / 8;
  141|       |
  142|      4|  if (elem_size % 4) return bshuf_trans_byte_bitrow_SSE(in, out, size,
  ------------------
  |  Branch (142:7): [True: 3, False: 1]
  ------------------
  143|      3|                                                        elem_size);
  144|       |
  145|      1|  __m256i ymm_0[8];
  146|      1|  __m256i ymm_1[8];
  147|      1|  __m256i ymm_storeage[8][4];
  148|       |
  149|     33|  for (jj = 0; jj + 31 < nbyte_row; jj += 32) {
  ------------------
  |  Branch (149:16): [True: 32, False: 1]
  ------------------
  150|    544|    for (ii = 0; ii + 3 < elem_size; ii += 4) {
  ------------------
  |  Branch (150:18): [True: 512, False: 32]
  ------------------
  151|  2.56k|      for (hh = 0; hh < 4; hh ++) {
  ------------------
  |  Branch (151:20): [True: 2.04k, False: 512]
  ------------------
  152|       |
  153|  18.4k|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (153:22): [True: 16.3k, False: 2.04k]
  ------------------
  154|  16.3k|          ymm_0[kk] = _mm256_loadu_si256((__m256i *) &in_b[
  155|  16.3k|              (ii * 8 + hh * 8 + kk) * nbyte_row + jj]);
  156|  16.3k|        }
  157|       |
  158|  10.2k|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (158:22): [True: 8.19k, False: 2.04k]
  ------------------
  159|  8.19k|          ymm_1[kk] = _mm256_unpacklo_epi8(ymm_0[kk * 2],
  160|  8.19k|                                           ymm_0[kk * 2 + 1]);
  161|  8.19k|          ymm_1[kk + 4] = _mm256_unpackhi_epi8(ymm_0[kk * 2],
  162|  8.19k|                                               ymm_0[kk * 2 + 1]);
  163|  8.19k|        }
  164|       |
  165|  6.14k|        for (kk = 0; kk < 2; kk ++){
  ------------------
  |  Branch (165:22): [True: 4.09k, False: 2.04k]
  ------------------
  166|  12.2k|          for (mm = 0; mm < 2; mm ++){
  ------------------
  |  Branch (166:24): [True: 8.19k, False: 4.09k]
  ------------------
  167|  8.19k|            ymm_0[kk * 4 + mm] = _mm256_unpacklo_epi16(
  168|  8.19k|                ymm_1[kk * 4 + mm * 2],
  169|  8.19k|                ymm_1[kk * 4 + mm * 2 + 1]);
  170|  8.19k|            ymm_0[kk * 4 + mm + 2] = _mm256_unpackhi_epi16(
  171|  8.19k|                ymm_1[kk * 4 + mm * 2],
  172|  8.19k|                ymm_1[kk * 4 + mm * 2 + 1]);
  173|  8.19k|          }
  174|  4.09k|        }
  175|       |
  176|  10.2k|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (176:22): [True: 8.19k, False: 2.04k]
  ------------------
  177|  8.19k|          ymm_1[kk * 2] = _mm256_unpacklo_epi32(ymm_0[kk * 2],
  178|  8.19k|                                                ymm_0[kk * 2 + 1]);
  179|  8.19k|          ymm_1[kk * 2 + 1] = _mm256_unpackhi_epi32(ymm_0[kk * 2],
  180|  8.19k|                                                    ymm_0[kk * 2 + 1]);
  181|  8.19k|        }
  182|       |
  183|  18.4k|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (183:22): [True: 16.3k, False: 2.04k]
  ------------------
  184|  16.3k|          ymm_storeage[kk][hh] = ymm_1[kk];
  185|  16.3k|        }
  186|  2.04k|      }
  187|       |
  188|  4.60k|      for (mm = 0; mm < 8; mm ++) {
  ------------------
  |  Branch (188:20): [True: 4.09k, False: 512]
  ------------------
  189|       |
  190|  20.4k|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (190:22): [True: 16.3k, False: 4.09k]
  ------------------
  191|  16.3k|          ymm_0[kk] = ymm_storeage[mm][kk];
  192|  16.3k|        }
  193|       |
  194|  4.09k|        ymm_1[0] = _mm256_unpacklo_epi64(ymm_0[0], ymm_0[1]);
  195|  4.09k|        ymm_1[1] = _mm256_unpacklo_epi64(ymm_0[2], ymm_0[3]);
  196|  4.09k|        ymm_1[2] = _mm256_unpackhi_epi64(ymm_0[0], ymm_0[1]);
  197|  4.09k|        ymm_1[3] = _mm256_unpackhi_epi64(ymm_0[2], ymm_0[3]);
  198|       |
  199|  4.09k|        ymm_0[0] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 32);
  200|  4.09k|        ymm_0[1] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 32);
  201|  4.09k|        ymm_0[2] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 49);
  202|  4.09k|        ymm_0[3] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 49);
  203|       |
  204|  4.09k|        _mm256_storeu_si256((__m256i *) &out_b[
  205|  4.09k|            (jj + mm * 2 + 0 * 16) * nrows + ii * 8], ymm_0[0]);
  206|  4.09k|        _mm256_storeu_si256((__m256i *) &out_b[
  207|  4.09k|            (jj + mm * 2 + 0 * 16 + 1) * nrows + ii * 8], ymm_0[1]);
  208|  4.09k|        _mm256_storeu_si256((__m256i *) &out_b[
  209|  4.09k|            (jj + mm * 2 + 1 * 16) * nrows + ii * 8], ymm_0[2]);
  210|  4.09k|        _mm256_storeu_si256((__m256i *) &out_b[
  211|  4.09k|            (jj + mm * 2 + 1 * 16 + 1) * nrows + ii * 8], ymm_0[3]);
  212|  4.09k|      }
  213|    512|    }
  214|     32|  }
  215|    513|  for (ii = 0; ii < nrows; ii ++ ) {
  ------------------
  |  Branch (215:16): [True: 512, False: 1]
  ------------------
  216|  2.56k|    for (jj = nbyte_row - nbyte_row % 32; jj < nbyte_row; jj ++) {
  ------------------
  |  Branch (216:43): [True: 2.04k, False: 512]
  ------------------
  217|  2.04k|      out_b[jj * nrows + ii] = in_b[ii * nbyte_row + jj];
  218|  2.04k|    }
  219|    512|  }
  220|      1|  return size * elem_size;
  221|      4|}
bshuf_shuffle_bit_eightelem_AVX:
  242|      4|                                        const size_t elem_size) {
  243|       |
  244|      4|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|      4|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  245|       |
  246|       |  // With a bit of care, this could be written such that such that it is
  247|       |  // in_buf = out_buf safe.
  248|      4|  const char* in_b = (const char*) in;
  249|      4|  char* out_b = (char*) out;
  250|       |
  251|      4|  size_t ii, jj, kk;
  252|      4|  size_t nbyte = elem_size * size;
  253|       |
  254|      4|  __m256i ymm;
  255|      4|  int32_t bt;
  256|       |
  257|      4|  if (elem_size <= 2) {
  ------------------
  |  Branch (257:7): [True: 0, False: 4]
  ------------------
  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|      4|  } else if (elem_size % 4) {
  ------------------
  |  Branch (275:14): [True: 3, False: 1]
  ------------------
  276|      3|    return bshuf_shuffle_bit_eightelem_SSE(in, out, size, elem_size);
  277|      3|  } else {
  278|     17|    for (jj = 0; jj + 31 < 8 * elem_size; jj += 32) {
  ------------------
  |  Branch (278:18): [True: 16, False: 1]
  ------------------
  279|  16.4k|      for (ii = 0; ii + 8 * elem_size - 1 < nbyte;
  ------------------
  |  Branch (279:20): [True: 16.4k, False: 16]
  ------------------
  280|  16.4k|           ii += 8 * elem_size) {
  281|  16.4k|        ymm = _mm256_loadu_si256((__m256i *) &in_b[ii + jj]);
  282|   148k|        for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (282:22): [True: 131k, False: 16.4k]
  ------------------
  283|   131k|          bt = _mm256_movemask_epi8(ymm);
  284|   131k|          ymm = _mm256_slli_epi16(ymm, 1);
  285|   131k|          size_t ind = (ii + jj / 8 + (7 - kk) * elem_size);
  286|   131k|          * (int32_t *) &out_b[ind] = bt;
  287|   131k|        }
  288|  16.4k|      }
  289|     16|    }
  290|      1|  }
  291|      1|  return size * elem_size;
  292|      4|}
bshuf_untrans_bit_elem_AVX:
  297|  3.80k|                                   const size_t elem_size, void* tmp_buf) {
  298|       |
  299|  3.80k|  int64_t count;
  300|       |
  301|  3.80k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  3.80k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 3.80k]
  |  |  ------------------
  ------------------
  302|       |
  303|  3.80k|  if (elem_size == 1) return bshuf_untrans_bit_byte_SSE(in, out, size);
  ------------------
  |  Branch (303:7): [True: 2, False: 3.79k]
  ------------------
  304|  3.79k|  if ((elem_size == 2 || elem_size == 4 || elem_size == 8 || elem_size == 16)
  ------------------
  |  Branch (304:8): [True: 1, False: 3.79k]
  |  Branch (304:26): [True: 14, False: 3.78k]
  |  Branch (304:44): [True: 3.77k, False: 5]
  |  Branch (304:62): [True: 1, False: 4]
  ------------------
  305|  3.79k|      && size <= INT32_MAX / elem_size) {
  ------------------
  |  Branch (305:10): [True: 3.79k, False: 0]
  ------------------
  306|  34.0k|    for (size_t j = 0; j < elem_size; ++j) {
  ------------------
  |  Branch (306:24): [True: 30.2k, False: 3.79k]
  ------------------
  307|  30.2k|      bshuf_untrans_bit_byte_SSE((const uint8_t*)in + j * size, (uint8_t*)tmp_buf + j * size, size);
  308|  30.2k|    }
  309|  3.79k|    unshuffle_avx2((int32_t)elem_size, (int32_t)(size * elem_size), tmp_buf, out);
  310|  3.79k|    return size * elem_size;
  311|  3.79k|  }
  312|      4|  count = bshuf_trans_byte_bitrow_AVX(in, tmp_buf, size, elem_size);
  313|      4|  CHECK_ERR(count);
  ------------------
  |  |   40|      4|        do {                              \
  |  |   41|      4|          if ((count) < 0)                \
  |  |  ------------------
  |  |  |  Branch (41:15): [True: 0, False: 4]
  |  |  ------------------
  |  |   42|      4|            return count;                 \
  |  |   43|      4|         } while (0)
  |  |  ------------------
  |  |  |  Branch (43:19): [Folded, False: 4]
  |  |  ------------------
  ------------------
  314|      4|  count =  bshuf_shuffle_bit_eightelem_AVX(tmp_buf, out, size, elem_size);
  315|       |
  316|      4|  return count;
  317|      4|}

bitshuffle-avx2.c:bshuf_emit_constant_prefix:
   79|  25.2k|static inline size_t bshuf_emit_constant_prefix(const void* in, void* out, size_t nbyte) {
   80|  25.2k|  const uint8_t* input = (const uint8_t*)in;
   81|  25.2k|  size_t prefix = bshuf_constant_prefix(input, nbyte);
   82|  25.2k|  if (prefix != 0) {
  ------------------
  |  Branch (82:7): [True: 0, False: 25.2k]
  ------------------
   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|  25.2k|  return prefix;
   88|  25.2k|}
bitshuffle-avx2.c:bshuf_constant_prefix:
   24|  25.2k|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|  25.2k|  if (nbyte < 1024) return 0;
  ------------------
  |  Branch (26:7): [True: 25.2k, 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|  25.2k|                                       const size_t elem_size, const size_t start_byte) {
   75|       |
   76|  25.2k|  const uint64_t* in_b = (const uint64_t*) in;
   77|  25.2k|  uint8_t* out_b = (uint8_t*) out;
   78|       |
   79|  25.2k|  uint64_t x, t;
   80|       |
   81|  25.2k|  size_t ii, kk;
   82|  25.2k|  size_t nbyte = elem_size * size;
   83|  25.2k|  size_t nbyte_bitrow = nbyte / 8;
   84|       |
   85|  25.2k|  uint64_t e=1;
   86|  25.2k|  const int little_endian = *(uint8_t *) &e == 1;
   87|  25.2k|  const size_t bit_row_skip = little_endian ? nbyte_bitrow : -nbyte_bitrow;
  ------------------
  |  Branch (87:31): [True: 25.2k, False: 0]
  ------------------
   88|  25.2k|  const int64_t bit_row_offset = little_endian ? 0 : 7 * nbyte_bitrow;
  ------------------
  |  Branch (88:34): [True: 25.2k, False: 0]
  ------------------
   89|       |
   90|  25.2k|  CHECK_MULT_EIGHT(nbyte);
  ------------------
  |  |   35|  25.2k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 25.2k]
  |  |  ------------------
  ------------------
   91|  25.2k|  CHECK_MULT_EIGHT(start_byte);
  ------------------
  |  |   35|  25.2k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 25.2k]
  |  |  ------------------
  ------------------
   92|       |
   93|  75.6k|  for (ii = start_byte / 8; ii < nbyte_bitrow; ii ++) {
  ------------------
  |  Branch (93:29): [True: 50.4k, False: 25.2k]
  ------------------
   94|  50.4k|    x = in_b[ii];
   95|  50.4k|    if (little_endian) {
  ------------------
  |  Branch (95:9): [True: 50.4k, False: 0]
  ------------------
   96|  50.4k|      TRANS_BIT_8X8(x, t);
  ------------------
  |  |   54|  50.4k|#define TRANS_BIT_8X8(x, t) {                                               \
  |  |   55|  50.4k|        t = (x ^ (x >> 7)) & 0x00AA00AA00AA00AALL;                          \
  |  |   56|  50.4k|        x = x ^ t ^ (t << 7);                                               \
  |  |   57|  50.4k|        t = (x ^ (x >> 14)) & 0x0000CCCC0000CCCCLL;                         \
  |  |   58|  50.4k|        x = x ^ t ^ (t << 14);                                              \
  |  |   59|  50.4k|        t = (x ^ (x >> 28)) & 0x00000000F0F0F0F0LL;                         \
  |  |   60|  50.4k|        x = x ^ t ^ (t << 28);                                              \
  |  |   61|  50.4k|    }
  ------------------
   97|  50.4k|    } 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|   453k|    for (kk = 0; kk < 8; kk ++) {
  ------------------
  |  Branch (100:18): [True: 403k, False: 50.4k]
  ------------------
  101|   403k|      out_b[bit_row_offset + kk * bit_row_skip + ii] = x;
  102|   403k|      x = x >> 8;
  103|   403k|    }
  104|  50.4k|  }
  105|  25.2k|  return size * elem_size;
  106|  25.2k|}
bshuf_shuffle_bit_eightelem_scal:
  194|      2|        const size_t size, const size_t elem_size) {
  195|       |
  196|      2|  const char *in_b;
  197|      2|  char *out_b;
  198|      2|  uint64_t x, t;
  199|      2|  size_t ii, jj, kk;
  200|      2|  size_t nbyte, out_index;
  201|       |
  202|      2|  uint64_t e=1;
  203|      2|  const int little_endian = *(uint8_t *) &e == 1;
  204|      2|  const size_t elem_skip = little_endian ? elem_size : -elem_size;
  ------------------
  |  Branch (204:28): [True: 2, False: 0]
  ------------------
  205|      2|  const uint64_t elem_offset = little_endian ? 0 : 7 * elem_size;
  ------------------
  |  Branch (205:32): [True: 2, False: 0]
  ------------------
  206|       |
  207|      2|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|      2|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  208|       |
  209|      2|  in_b = (const char*) in;
  210|      2|  out_b = (char*) out;
  211|       |
  212|      2|  nbyte = elem_size * size;
  213|       |
  214|     12|  for (jj = 0; jj < 8 * elem_size; jj += 8) {
  ------------------
  |  Branch (214:16): [True: 10, False: 2]
  ------------------
  215|  17.1k|    for (ii = 0; ii + 8 * elem_size - 1 < nbyte; ii += 8 * elem_size) {
  ------------------
  |  Branch (215:18): [True: 17.1k, False: 10]
  ------------------
  216|  17.1k|      x = *((uint64_t*) &in_b[ii + jj]);
  217|  17.1k|      if (little_endian) {
  ------------------
  |  Branch (217:11): [True: 17.1k, False: 0]
  ------------------
  218|  17.1k|        TRANS_BIT_8X8(x, t);
  ------------------
  |  |   54|  17.1k|#define TRANS_BIT_8X8(x, t) {                                               \
  |  |   55|  17.1k|        t = (x ^ (x >> 7)) & 0x00AA00AA00AA00AALL;                          \
  |  |   56|  17.1k|        x = x ^ t ^ (t << 7);                                               \
  |  |   57|  17.1k|        t = (x ^ (x >> 14)) & 0x0000CCCC0000CCCCLL;                         \
  |  |   58|  17.1k|        x = x ^ t ^ (t << 14);                                              \
  |  |   59|  17.1k|        t = (x ^ (x >> 28)) & 0x00000000F0F0F0F0LL;                         \
  |  |   60|  17.1k|        x = x ^ t ^ (t << 28);                                              \
  |  |   61|  17.1k|    }
  ------------------
  219|  17.1k|      } 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|   154k|      for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (222:20): [True: 137k, False: 17.1k]
  ------------------
  223|   137k|        out_index = ii + jj / 8 + elem_offset + kk * elem_skip;
  224|   137k|        *((uint8_t*) &out_b[out_index]) = x;
  225|   137k|        x = x >> 8;
  226|   137k|      }
  227|  17.1k|    }
  228|     10|  }
  229|      2|  return size * elem_size;
  230|      2|}

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

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

blosc2.c:is_little_endian:
   42|  92.3k|static bool is_little_endian(void) {
   43|  92.3k|  static const int i = 1;
   44|  92.3k|  char* p = (char*)&i;
   45|       |
   46|  92.3k|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 92.3k, False: 0]
  ------------------
   47|  92.3k|    return true;
   48|  92.3k|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|  92.3k|}
blosc2.c:_sw32:
  241|  16.1k|static inline void _sw32(void* dest, int32_t a) {
  242|  16.1k|  uint8_t* dest_ = (uint8_t*)dest;
  243|  16.1k|  uint8_t* pa = (uint8_t*)&a;
  244|       |
  245|  16.1k|  bool little_endian = is_little_endian();
  246|  16.1k|  if (little_endian) {
  ------------------
  |  Branch (246:7): [True: 16.1k, False: 0]
  ------------------
  247|  16.1k|    memcpy(dest_, &a, sizeof(a));;
  248|  16.1k|  }
  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.1k|}
blosc2.c:sw32_:
  216|  23.2k|static inline int32_t sw32_(const void* pa) {
  217|  23.2k|  int32_t idest;
  218|       |
  219|  23.2k|  bool little_endian = is_little_endian();
  220|  23.2k|  if (little_endian) {
  ------------------
  |  Branch (220:7): [True: 23.2k, False: 0]
  ------------------
  221|  23.2k|    memcpy(&idest, pa, sizeof(idest));
  222|  23.2k|  }
  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|  23.2k|  return idest;
  238|  23.2k|}
blosc2.c:filters_contain:
  131|  2.80k|static inline bool filters_contain(const uint8_t *filters, uint8_t id) {
  132|  19.4k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (132:19): [True: 16.8k, False: 2.65k]
  ------------------
  133|  16.8k|    if (filters[i] == id) {
  ------------------
  |  Branch (133:9): [True: 148, False: 16.6k]
  ------------------
  134|    148|      return true;
  135|    148|    }
  136|  16.8k|  }
  137|  2.65k|  return false;
  138|  2.80k|}
schunk.c:blosc2_nchunks_to_offsets_nbytes:
  103|     87|static inline bool blosc2_nchunks_to_offsets_nbytes(int64_t nchunks, int32_t *off_nbytes) {
  104|     87|  const int64_t max_nchunks = INT32_MAX / (int64_t)sizeof(int64_t);
  105|     87|  if (nchunks < 0 || nchunks > max_nchunks) {
  ------------------
  |  Branch (105:7): [True: 0, False: 87]
  |  Branch (105:22): [True: 0, False: 87]
  ------------------
  106|      0|    return false;
  107|      0|  }
  108|     87|  if (off_nbytes != NULL) {
  ------------------
  |  Branch (108:7): [True: 0, False: 87]
  ------------------
  109|      0|    *off_nbytes = (int32_t)(nchunks * (int64_t)sizeof(int64_t));
  110|      0|  }
  111|       |  return true;
  112|     87|}
schunk.c:get_chunk_flags2:
  121|  1.17k|static inline uint8_t get_chunk_flags2(const uint8_t *chunk, int32_t chunk_cbytes) {
  122|  1.17k|  uint8_t flags = chunk[BLOSC2_CHUNK_FLAGS];
  123|  1.17k|  bool extended_header = (flags & BLOSC_DOSHUFFLE) && (flags & BLOSC_DOBITSHUFFLE);
  ------------------
  |  Branch (123:26): [True: 1.17k, False: 0]
  |  Branch (123:55): [True: 1.17k, False: 0]
  ------------------
  124|  1.17k|  if (!extended_header || chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (124:7): [True: 0, False: 1.17k]
  |  Branch (124:27): [True: 0, False: 1.17k]
  ------------------
  125|      0|    return 0;
  126|      0|  }
  127|  1.17k|  return chunk[BLOSC2_CHUNK_BLOSC2_FLAGS2];
  128|  1.17k|}
schunk.c:chunk_special_in_offset:
  143|    604|static inline int chunk_special_in_offset(const uint8_t *chunk, int32_t cbytes) {
  144|    604|  if (cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (144:7): [True: 0, False: 604]
  ------------------
  145|      0|    return 0;
  146|      0|  }
  147|    604|  int special_value = (chunk[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
  148|    604|  switch (special_value) {
  149|      0|    case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (149:5): [True: 0, False: 604]
  ------------------
  150|      0|    case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (150:5): [True: 0, False: 604]
  ------------------
  151|      0|    case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (151:5): [True: 0, False: 604]
  ------------------
  152|      0|      return special_value;
  153|    604|    default:
  ------------------
  |  Branch (153:5): [True: 604, False: 0]
  ------------------
  154|    604|      return 0;
  155|    604|  }
  156|    604|}
frame.c:endian_handler:
   56|  49.8k|{
   57|  49.8k|  bool little_endian = is_little_endian();
   58|  49.8k|  if (little_endian == little) {
  ------------------
  |  Branch (58:7): [True: 0, False: 49.8k]
  ------------------
   59|      0|    memcpy(dest, pa, size);
   60|      0|  }
   61|  49.8k|  else {
   62|  49.8k|    uint8_t* pa_ = (uint8_t*)pa;
   63|  49.8k|    uint8_t pa2_[8];
   64|  49.8k|    switch (size) {
   65|  17.7k|      case 8:
  ------------------
  |  Branch (65:7): [True: 17.7k, False: 32.1k]
  ------------------
   66|  17.7k|        pa2_[0] = pa_[7];
   67|  17.7k|        pa2_[1] = pa_[6];
   68|  17.7k|        pa2_[2] = pa_[5];
   69|  17.7k|        pa2_[3] = pa_[4];
   70|  17.7k|        pa2_[4] = pa_[3];
   71|  17.7k|        pa2_[5] = pa_[2];
   72|  17.7k|        pa2_[6] = pa_[1];
   73|  17.7k|        pa2_[7] = pa_[0];
   74|  17.7k|        break;
   75|  24.5k|      case 4:
  ------------------
  |  Branch (75:7): [True: 24.5k, False: 25.2k]
  ------------------
   76|  24.5k|        pa2_[0] = pa_[3];
   77|  24.5k|        pa2_[1] = pa_[2];
   78|  24.5k|        pa2_[2] = pa_[1];
   79|  24.5k|        pa2_[3] = pa_[0];
   80|  24.5k|        break;
   81|  7.26k|      case 2:
  ------------------
  |  Branch (81:7): [True: 7.26k, False: 42.5k]
  ------------------
   82|  7.26k|        pa2_[0] = pa_[1];
   83|  7.26k|        pa2_[1] = pa_[0];
   84|  7.26k|        break;
   85|    270|      case 1:
  ------------------
  |  Branch (85:7): [True: 270, False: 49.5k]
  ------------------
   86|    270|        pa2_[0] = pa_[0];
   87|    270|        break;
   88|      0|      default:
  ------------------
  |  Branch (88:7): [True: 0, False: 49.8k]
  ------------------
   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|  49.8k|    }
   91|  49.8k|    memcpy(dest, pa2_, size);
   92|  49.8k|  }
   93|  49.8k|}
frame.c:is_little_endian:
   42|  49.8k|static bool is_little_endian(void) {
   43|  49.8k|  static const int i = 1;
   44|  49.8k|  char* p = (char*)&i;
   45|       |
   46|  49.8k|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 49.8k, False: 0]
  ------------------
   47|  49.8k|    return true;
   48|  49.8k|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|  49.8k|}
frame.c:blosc2_nchunks_to_offsets_nbytes:
  103|  8.76k|static inline bool blosc2_nchunks_to_offsets_nbytes(int64_t nchunks, int32_t *off_nbytes) {
  104|  8.76k|  const int64_t max_nchunks = INT32_MAX / (int64_t)sizeof(int64_t);
  105|  8.76k|  if (nchunks < 0 || nchunks > max_nchunks) {
  ------------------
  |  Branch (105:7): [True: 0, False: 8.76k]
  |  Branch (105:22): [True: 2, False: 8.76k]
  ------------------
  106|      2|    return false;
  107|      2|  }
  108|  8.76k|  if (off_nbytes != NULL) {
  ------------------
  |  Branch (108:7): [True: 8.76k, False: 0]
  ------------------
  109|  8.76k|    *off_nbytes = (int32_t)(nchunks * (int64_t)sizeof(int64_t));
  110|  8.76k|  }
  111|       |  return true;
  112|  8.76k|}
frame.c:chunk_special_in_offset:
  143|    604|static inline int chunk_special_in_offset(const uint8_t *chunk, int32_t cbytes) {
  144|    604|  if (cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (144:7): [True: 0, False: 604]
  ------------------
  145|      0|    return 0;
  146|      0|  }
  147|    604|  int special_value = (chunk[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
  148|    604|  switch (special_value) {
  149|      0|    case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (149:5): [True: 0, False: 604]
  ------------------
  150|      0|    case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (150:5): [True: 0, False: 604]
  ------------------
  151|      0|    case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (151:5): [True: 0, False: 604]
  ------------------
  152|      0|      return special_value;
  153|    604|    default:
  ------------------
  |  Branch (153:5): [True: 604, False: 0]
  ------------------
  154|    604|      return 0;
  155|    604|  }
  156|    604|}
b2nd.c:filters_contain:
  131|  1.54k|static inline bool filters_contain(const uint8_t *filters, uint8_t id) {
  132|  10.7k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (132:19): [True: 9.25k, False: 1.49k]
  ------------------
  133|  9.25k|    if (filters[i] == id) {
  ------------------
  |  Branch (133:9): [True: 48, False: 9.20k]
  ------------------
  134|     48|      return true;
  135|     48|    }
  136|  9.25k|  }
  137|  1.49k|  return false;
  138|  1.54k|}

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

do_nothing:
  797|   204k|int do_nothing(const blosc2_context* context, int i, char cmode) {
  798|   204k|  uint8_t filter = context->filters[i];
  799|   204k|  if (filter == BLOSC_SHUFFLE) {
  ------------------
  |  Branch (799:7): [True: 17.0k, False: 187k]
  ------------------
  800|       |    // Shuffling single bytes is the identity, so skip it instead of copying the block
  801|  17.0k|    return shuffle_size(context, i) == 1;
  802|  17.0k|  }
  803|   187k|  if (cmode == 'c') {
  ------------------
  |  Branch (803:7): [True: 101k, False: 86.0k]
  ------------------
  804|   101k|    return (filter == BLOSC_NOFILTER);
  805|   101k|  } else {
  806|       |    // TRUNC_PREC do not have to be applied during decompression
  807|  86.0k|    return ((filter == BLOSC_NOFILTER) || (filter == BLOSC_TRUNC_PREC));
  ------------------
  |  Branch (807:13): [True: 56.0k, False: 29.9k]
  |  Branch (807:43): [True: 240, False: 29.7k]
  ------------------
  808|  86.0k|  }
  809|   187k|}
next_filter:
  812|  21.9k|int next_filter(const blosc2_context* context, int current_filter, char cmode) {
  813|  22.4k|  for (int i = current_filter - 1; i >= 0; i--) {
  ------------------
  |  Branch (813:36): [True: 22.4k, False: 80]
  ------------------
  814|  22.4k|    if (!do_nothing(context, i, cmode)) {
  ------------------
  |  Branch (814:9): [True: 21.8k, False: 530]
  ------------------
  815|  21.8k|      return context->filters[i];
  816|  21.8k|    }
  817|  22.4k|  }
  818|     80|  return BLOSC_NOFILTER;
  819|  21.9k|}
last_filter:
  822|  20.7k|int last_filter(const blosc2_context* context, char cmode) {
  823|  20.7k|  int last_index = -1;
  824|   145k|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (824:40): [True: 124k, False: 20.7k]
  ------------------
  825|   124k|    if (!do_nothing(context, i, cmode))  {
  ------------------
  |  Branch (825:9): [True: 20.6k, False: 103k]
  ------------------
  826|  20.6k|      last_index = i;
  827|  20.6k|    }
  828|   124k|  }
  829|  20.7k|  return last_index;
  830|  20.7k|}
read_chunk_header:
  909|  51.6k|{
  910|  51.6k|  memset(header, 0, sizeof(blosc_header));
  911|       |
  912|  51.6k|  if (srcsize < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (912:7): [True: 0, False: 51.6k]
  ------------------
  913|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  914|      0|    return BLOSC2_ERROR_READ_BUFFER;
  915|      0|  }
  916|       |
  917|  51.6k|  memcpy(header, src, BLOSC_MIN_HEADER_LENGTH);
  918|       |
  919|  51.6k|  bool little_endian = is_little_endian();
  920|       |
  921|  51.6k|  if (!little_endian) {
  ------------------
  |  Branch (921:7): [True: 0, False: 51.6k]
  ------------------
  922|      0|    header->nbytes = bswap32_(header->nbytes);
  923|      0|    header->blocksize = bswap32_(header->blocksize);
  924|      0|    header->cbytes = bswap32_(header->cbytes);
  925|      0|  }
  926|       |
  927|  51.6k|  if (header->cbytes < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (927:7): [True: 3, False: 51.6k]
  ------------------
  928|      3|    BLOSC_TRACE_ERROR("`cbytes` is too small to read min header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  929|      3|    return BLOSC2_ERROR_INVALID_HEADER;
  930|      3|  }
  931|  51.6k|  if (header->blocksize <= 0) {
  ------------------
  |  Branch (931:7): [True: 2, False: 51.6k]
  ------------------
  932|      2|    BLOSC_TRACE_ERROR("`blocksize` is zero");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  933|      2|    return BLOSC2_ERROR_INVALID_HEADER;
  934|      2|  }
  935|  51.6k|  if (header->blocksize > BLOSC2_MAXBLOCKSIZE) {
  ------------------
  |  Branch (935:7): [True: 0, False: 51.6k]
  ------------------
  936|      0|    BLOSC_TRACE_ERROR("`blocksize` 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  937|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  938|      0|  }
  939|  51.6k|  if (header->typesize == 0) {
  ------------------
  |  Branch (939:7): [True: 0, False: 51.6k]
  ------------------
  940|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  941|      0|    return BLOSC2_ERROR_INVALID_HEADER;
  942|      0|  }
  943|       |
  944|       |  /* Read extended header if it is wanted */
  945|  51.6k|  if ((extended_header) && (header->flags & BLOSC_DOSHUFFLE) && (header->flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (945:7): [True: 4.65k, False: 47.0k]
  |  Branch (945:28): [True: 4.56k, False: 85]
  |  Branch (945:65): [True: 4.56k, False: 6]
  ------------------
  946|  4.56k|    if (header->cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (946:9): [True: 0, False: 4.56k]
  ------------------
  947|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  948|      0|      return BLOSC2_ERROR_INVALID_HEADER;
  949|      0|    }
  950|  4.56k|    if (srcsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (950:9): [True: 0, False: 4.56k]
  ------------------
  951|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  952|      0|      return BLOSC2_ERROR_READ_BUFFER;
  953|      0|    }
  954|       |
  955|  4.56k|    memcpy((uint8_t *)header + BLOSC_MIN_HEADER_LENGTH, src + BLOSC_MIN_HEADER_LENGTH,
  956|  4.56k|      BLOSC_EXTENDED_HEADER_LENGTH - BLOSC_MIN_HEADER_LENGTH);
  957|       |
  958|  4.56k|    if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) && (header->blosc2_flags != 0)) {
  ------------------
  |  Branch (958:9): [True: 3, False: 4.56k]
  |  Branch (958:55): [True: 1, False: 2]
  ------------------
  959|      1|      int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  960|      1|      if (special_type != 0) {
  ------------------
  |  Branch (960:11): [True: 0, False: 1]
  ------------------
  961|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  962|      0|        return BLOSC2_ERROR_INVALID_HEADER;
  963|      0|      }
  964|      1|    }
  965|       |
  966|  4.56k|    int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  967|  4.56k|    if (special_type != 0) {
  ------------------
  |  Branch (967:9): [True: 246, False: 4.31k]
  ------------------
  968|    246|      if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (968:11): [True: 241, False: 5]
  ------------------
  969|       |        // In this case, the actual type size must be derived from the cbytes
  970|    241|        int32_t typesize = header->cbytes - BLOSC_EXTENDED_HEADER_LENGTH;
  971|    241|        if (typesize <= 0) {
  ------------------
  |  Branch (971:13): [True: 0, False: 241]
  ------------------
  972|      0|          BLOSC_TRACE_ERROR("`typesize` is zero or 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  973|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  974|      0|        }
  975|    241|        if (typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (975:13): [True: 0, False: 241]
  ------------------
  976|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  977|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  978|      0|        }
  979|    241|        if (typesize > header->nbytes) {
  ------------------
  |  Branch (979:13): [True: 0, False: 241]
  ------------------
  980|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  981|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  982|      0|        }
  983|    241|        if (header->nbytes % typesize != 0) {
  ------------------
  |  Branch (983:13): [True: 0, False: 241]
  ------------------
  984|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  985|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  986|      0|        }
  987|    241|      }
  988|      5|      else {
  989|       |        // All-zero chunks fill with memset, which works regardless of element alignment.
  990|      5|        if (special_type != BLOSC2_SPECIAL_ZERO
  ------------------
  |  Branch (990:13): [True: 4, False: 1]
  ------------------
  991|      4|            && header->nbytes % header->typesize != 0) {
  ------------------
  |  Branch (991:16): [True: 0, False: 4]
  ------------------
  992|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  993|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  994|      0|        }
  995|      5|      }
  996|    246|    }
  997|       |    // The number of filters depends on the version of the header. Blosc2 alpha series
  998|       |    // did not initialize filters to zero beyond the max supported.
  999|  4.56k|    if (header->version == BLOSC2_VERSION_FORMAT_ALPHA) {
  ------------------
  |  Branch (999:9): [True: 1, False: 4.56k]
  ------------------
 1000|      1|      header->filters[5] = 0;
 1001|      1|      header->filters_meta[5] = 0;
 1002|      1|    }
 1003|  4.56k|  }
 1004|  47.0k|  else {
 1005|  47.0k|    flags_to_filters(header->flags, header->filters);
 1006|  47.0k|  }
 1007|  51.6k|  if (header->version > BLOSC2_VERSION_FORMAT &&
  ------------------
  |  Branch (1007:7): [True: 15.3k, False: 36.3k]
  ------------------
 1008|  15.3k|      (header->blosc2_flags2 & (uint8_t)~BLOSC2_VL_BLOCKS) != 0) {
  ------------------
  |  Branch (1008:7): [True: 0, False: 15.3k]
  ------------------
 1009|       |    /* Version from future with unsupported chunk features. */
 1010|      0|    return BLOSC2_ERROR_VERSION_SUPPORT;
 1011|      0|  }
 1012|  51.6k|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0 &&
  ------------------
  |  Branch (1012:7): [True: 3, False: 51.6k]
  ------------------
 1013|      3|      (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0) {
  ------------------
  |  Branch (1013:7): [True: 0, False: 3]
  ------------------
 1014|      0|    BLOSC_TRACE_ERROR("VL-block chunks cannot be memcpyed.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  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_INVALID_HEADER;
 1016|      0|  }
 1017|  51.6k|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) == 0 &&
  ------------------
  |  Branch (1017:7): [True: 51.6k, False: 3]
  ------------------
 1018|  51.6k|      header->nbytes > 0 && header->blocksize > header->nbytes) {
  ------------------
  |  Branch (1018:7): [True: 51.6k, False: 2]
  |  Branch (1018:29): [True: 296, False: 51.3k]
  ------------------
 1019|    296|    header->blocksize = header->nbytes;
 1020|    296|  }
 1021|  51.6k|  return 0;
 1022|  51.6k|}
pipeline_forward:
 1318|  9.70k|                          uint8_t* dest, uint8_t* tmp) {
 1319|  9.70k|  blosc2_context* context = thread_context->parent_context;
 1320|  9.70k|  uint8_t* _src = (uint8_t*)src + offset;
 1321|  9.70k|  uint8_t* _tmp = tmp;
 1322|  9.70k|  uint8_t* _dest = dest;
 1323|  9.70k|  int32_t typesize = context->typesize;
 1324|  9.70k|  uint8_t* filters = context->filters;
 1325|  9.70k|  uint8_t* filters_meta = context->filters_meta;
 1326|  9.70k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 1327|  9.70k|  bool output_is_disposable = (context->preparams != NULL) ? context->preparams->output_is_disposable : false;
  ------------------
  |  Branch (1327:31): [True: 8.05k, False: 1.65k]
  ------------------
 1328|       |
 1329|       |  /* Prefilter function */
 1330|  9.70k|  if (context->prefilter != NULL) {
  ------------------
  |  Branch (1330:7): [True: 8.05k, False: 1.65k]
  ------------------
 1331|       |    // Create new prefilter parameters for this block (must be private for each thread)
 1332|  8.05k|    blosc2_prefilter_params preparams;
 1333|  8.05k|    memcpy(&preparams, context->preparams, sizeof(preparams));
 1334|       |    // Calculate output_size based on number of elements and output typesize
 1335|  8.05k|    int32_t nelems = bsize / typesize;  // number of elements in the input block
 1336|       |    // If output_typesize is not set (0), default to input typesize (no type conversion)
 1337|  8.05k|    int32_t output_typesize_actual = (preparams.output_typesize > 0) ? preparams.output_typesize : typesize;
  ------------------
  |  Branch (1337:38): [True: 0, False: 8.05k]
  ------------------
 1338|  8.05k|    int32_t output_size = nelems * output_typesize_actual;  // output size in bytes
 1339|  8.05k|    preparams.output_typesize = output_typesize_actual;  // ensure it's set
 1340|       |    /* Legacy callbacks may leave bytes unwritten or accumulate into the output.
 1341|       |     * Only audited full-write callbacks may bypass this initialization. */
 1342|  8.05k|    if (!output_is_disposable && !context->prefilter_full_write) {
  ------------------
  |  Branch (1342:9): [True: 8.05k, False: 0]
  |  Branch (1342:34): [True: 0, False: 8.05k]
  ------------------
 1343|      0|      memset(_dest, 0, output_size);
 1344|      0|    }
 1345|  8.05k|    preparams.input = _src;
 1346|  8.05k|    preparams.output = _dest;
 1347|  8.05k|    preparams.output_size = output_size;
 1348|  8.05k|    preparams.output_offset = offset;
 1349|  8.05k|    preparams.nblock = offset / context->blocksize;
 1350|  8.05k|    preparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (1350:24): [True: 8.05k, False: 0]
  ------------------
 1351|  8.05k|    preparams.tid = thread_context->tid;
 1352|  8.05k|    preparams.ttmp = thread_context->tmp;
 1353|  8.05k|    preparams.ttmp_nbytes = thread_context->tmp_nbytes;
 1354|  8.05k|    preparams.ctx = context;
 1355|  8.05k|    preparams.output_is_disposable = output_is_disposable;
 1356|       |
 1357|  8.05k|    if (context->prefilter(&preparams) != 0) {
  ------------------
  |  Branch (1357:9): [True: 0, False: 8.05k]
  ------------------
 1358|      0|      if (output_is_disposable) {
  ------------------
  |  Branch (1358:11): [True: 0, False: 0]
  ------------------
 1359|       |        // Output is going to be discarded; no more filters are required
 1360|      0|        BLOSC_TRACE_INFO("Output is disposable");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1361|      0|        return _dest;
 1362|      0|      }
 1363|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1364|      0|      return NULL;
 1365|      0|    }
 1366|       |
 1367|  8.05k|    if (memcpyed) {
  ------------------
  |  Branch (1367:9): [True: 2.06k, False: 5.98k]
  ------------------
 1368|       |      // No more filters are required
 1369|  2.06k|      return _dest;
 1370|  2.06k|    }
 1371|  5.98k|    _cycle_buffers_forward(&_src, &_dest, &_tmp, src + offset);
 1372|  5.98k|  }
 1373|       |
 1374|       |  /* Process the filter pipeline */
 1375|  53.4k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (1375:19): [True: 45.8k, False: 7.63k]
  ------------------
 1376|  45.8k|    int rc = BLOSC2_ERROR_SUCCESS;
 1377|  45.8k|    if (do_nothing(context, i, 'c')) {
  ------------------
  |  Branch (1377:9): [True: 38.1k, False: 7.63k]
  ------------------
 1378|  38.1k|      continue;
 1379|  38.1k|    }
 1380|  7.63k|#ifdef BLOSC_USE_FUSED_SHUFFLE_BYTEDELTA
 1381|  7.63k|    int fused_size = fused_shuffle_bytedelta_size(context, i);
 1382|  7.63k|    if (fused_size && shuffle_bytedelta_forward(_src, _dest, bsize, fused_size)) {
  ------------------
  |  Branch (1382:9): [True: 0, False: 7.63k]
  |  Branch (1382:23): [True: 0, False: 0]
  ------------------
 1383|      0|      i++;
 1384|      0|      _cycle_buffers_forward(&_src, &_dest, &_tmp, src + offset);
 1385|      0|      continue;
 1386|      0|    }
 1387|  7.63k|#endif
 1388|  7.63k|    if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (1388:9): [True: 5.75k, False: 1.87k]
  ------------------
 1389|  5.75k|      switch (filters[i]) {
 1390|  1.45k|        case BLOSC_SHUFFLE:
  ------------------
  |  Branch (1390:9): [True: 1.45k, False: 4.30k]
  ------------------
 1391|  1.45k|          blosc2_shuffle(shuffle_size(context, i), bsize, _src, _dest);
 1392|  1.45k|          break;
 1393|  3.16k|        case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (1393:9): [True: 3.16k, False: 2.59k]
  ------------------
 1394|  3.16k|          if (context->blosc1_format && ((bsize / typesize) % 8) != 0) {
  ------------------
  |  Branch (1394:15): [True: 0, False: 3.16k]
  |  Branch (1394:41): [True: 0, False: 0]
  ------------------
 1395|       |            // Format version 2 (Blosc1) only bit-shuffles blocks whose number of
 1396|       |            // elements is a multiple of 8; other blocks are stored unshuffled.
 1397|      0|            memcpy(_dest, _src, (size_t)bsize);
 1398|      0|          }
 1399|  3.16k|          else if (bitshuffle(typesize, bsize, _src, _dest, bitshuffle_scratch(thread_context, bsize)) < 0) {
  ------------------
  |  Branch (1399:20): [True: 0, False: 3.16k]
  ------------------
 1400|      0|            return NULL;
 1401|      0|          }
 1402|  3.16k|          break;
 1403|  3.16k|        case BLOSC_DELTA:
  ------------------
  |  Branch (1403:9): [True: 1.07k, False: 4.68k]
  ------------------
 1404|  1.07k|          delta_encoder(offset == 0 ? _src : src, offset, bsize, typesize, _src, _dest);
  ------------------
  |  Branch (1404:25): [True: 74, False: 1.00k]
  ------------------
 1405|  1.07k|          break;
 1406|     70|        case BLOSC_TRUNC_PREC:
  ------------------
  |  Branch (1406:9): [True: 70, False: 5.68k]
  ------------------
 1407|     70|          if (truncate_precision(filters_meta[i], typesize, bsize, _src, _dest) < 0) {
  ------------------
  |  Branch (1407:15): [True: 2, False: 68]
  ------------------
 1408|      2|            return NULL;
 1409|      2|          }
 1410|     68|          break;
 1411|     68|        default:
  ------------------
  |  Branch (1411:9): [True: 0, False: 5.75k]
  ------------------
 1412|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1413|      0|          return NULL;
 1414|  5.75k|      }
 1415|  5.75k|    }
 1416|  1.87k|    else {
 1417|       |      // Look for the filters_meta in user filters and run it
 1418|  5.49k|      for (uint64_t j = 0; j < g_nfilters; ++j) {
  ------------------
  |  Branch (1418:28): [True: 5.49k, False: 0]
  ------------------
 1419|  5.49k|        if (g_filters[j].id == filters[i]) {
  ------------------
  |  Branch (1419:13): [True: 1.87k, False: 3.61k]
  ------------------
 1420|  1.87k|          if (load_acquire_ptr(&g_filters[j].backward) == NULL) {
  ------------------
  |  |  144|  1.87k|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (1420:15): [True: 0, False: 1.87k]
  ------------------
 1421|       |            // Dynamically load library
 1422|      0|            if (fill_filter(&g_filters[j]) < 0) {
  ------------------
  |  Branch (1422:17): [True: 0, False: 0]
  ------------------
 1423|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1424|      0|              return NULL;
 1425|      0|            }
 1426|      0|          }
 1427|  1.87k|          if (g_filters[j].forward != NULL) {
  ------------------
  |  Branch (1427:15): [True: 1.87k, False: 0]
  ------------------
 1428|  1.87k|            blosc2_cparams cparams;
 1429|  1.87k|            blosc2_ctx_get_cparams(context, &cparams);
 1430|  1.87k|            rc = g_filters[j].forward(_src, _dest, bsize, filters_meta[i], &cparams, g_filters[j].id);
 1431|  1.87k|          } else {
 1432|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1433|      0|            return NULL;
 1434|      0|          }
 1435|  1.87k|          if (rc != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1435:15): [True: 0, False: 1.87k]
  ------------------
 1436|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1437|      0|            return NULL;
 1438|      0|          }
 1439|  1.87k|          goto urfiltersuccess;
 1440|  1.87k|        }
 1441|  5.49k|      }
 1442|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1443|      0|      return NULL;
 1444|       |
 1445|  1.87k|      urfiltersuccess:;
 1446|       |
 1447|  1.87k|    }
 1448|       |
 1449|       |    // do_nothing() skipped the filters that leave the block as it is
 1450|  7.63k|    _cycle_buffers_forward(&_src, &_dest, &_tmp, src + offset);
 1451|  7.63k|  }
 1452|  7.63k|  return _src;
 1453|  7.63k|}
pipeline_backward:
 1824|  10.9k|                      uint8_t* tmp2, int last_filter_index, int32_t nblock) {
 1825|  10.9k|  (void)tmp2;
 1826|  10.9k|  blosc2_context* context = thread_context->parent_context;
 1827|  10.9k|  int32_t typesize = context->typesize;
 1828|  10.9k|  uint8_t* filters = context->filters;
 1829|  10.9k|  uint8_t* filters_meta = context->filters_meta;
 1830|  10.9k|  uint8_t* _src = (next_filter(context, BLOSC2_MAX_FILTERS, 'd') == BLOSC_DELTA &&
  ------------------
  |  Branch (1830:20): [True: 1.65k, False: 9.32k]
  ------------------
 1831|  9.32k|                   context->postfilter == NULL) ? (dest + offset) : src;
  ------------------
  |  Branch (1831:20): [True: 1.65k, False: 0]
  ------------------
 1832|  10.9k|  uint8_t* _dest = tmp;
 1833|  10.9k|  int errcode = 0;
 1834|       |
 1835|  11.4k|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (1835:40): [True: 11.3k, False: 80]
  ------------------
 1836|  11.3k|    if (do_nothing(context, i, 'd')) {
  ------------------
  |  Branch (1836:9): [True: 486, False: 10.9k]
  ------------------
 1837|    486|      continue;
 1838|    486|    }
 1839|  10.9k|    int first_index = i;
 1840|  10.9k|#ifdef BLOSC_USE_FUSED_SHUFFLE_BYTEDELTA
 1841|  10.9k|    int fused_size = fused_shuffle_bytedelta_size(context, i - 1);
 1842|  10.9k|    if (fused_size) {
  ------------------
  |  Branch (1842:9): [True: 0, False: 10.9k]
  ------------------
 1843|      0|      first_index = i - 1;
 1844|      0|    }
 1845|  10.9k|#endif
 1846|       |    // Delta filter requires the whole chunk ready. A fused inverse ends at
 1847|       |    // SHUFFLE's position, so select its sink using the pair's first index.
 1848|  10.9k|    int last_copy_filter = (last_filter_index == first_index) || (filters[i] == BLOSC_DELTA) ||
  ------------------
  |  Branch (1848:28): [True: 10.8k, False: 14]
  |  Branch (1848:66): [True: 0, False: 14]
  ------------------
 1849|     14|                           (next_filter(context, first_index, 'd') == BLOSC_DELTA);
  ------------------
  |  Branch (1849:28): [True: 14, False: 0]
  ------------------
 1850|  10.9k|    if (last_copy_filter && context->postfilter == NULL &&
  ------------------
  |  Branch (1850:9): [True: 10.9k, False: 0]
  |  Branch (1850:29): [True: 3.72k, False: 7.18k]
  ------------------
 1851|  3.72k|        (filters[i] == BLOSC_DELTA || _src != dest + offset)) {
  ------------------
  |  Branch (1851:10): [True: 1.67k, False: 2.05k]
  |  Branch (1851:39): [True: 2.05k, False: 0]
  ------------------
 1852|  3.72k|      _dest = dest + offset;
 1853|  7.18k|    } else {
 1854|  7.18k|      _dest = (_src == src) ? tmp : src;
  ------------------
  |  Branch (1854:15): [True: 7.18k, False: 0]
  ------------------
 1855|  7.18k|    }
 1856|  10.9k|    int rc = BLOSC2_ERROR_SUCCESS;
 1857|  10.9k|#ifdef BLOSC_USE_FUSED_SHUFFLE_BYTEDELTA
 1858|  10.9k|    if (fused_size && shuffle_bytedelta_backward(_src, _dest, bsize, fused_size)) {
  ------------------
  |  Branch (1858:9): [True: 0, False: 10.9k]
  |  Branch (1858:23): [True: 0, False: 0]
  ------------------
 1859|      0|      i--;
 1860|      0|      _src = _dest;
 1861|      0|      if (last_filter_index == i) {
  ------------------
  |  Branch (1861:11): [True: 0, False: 0]
  ------------------
 1862|      0|        break;
 1863|      0|      }
 1864|      0|      continue;
 1865|      0|    }
 1866|  10.9k|#endif
 1867|  10.9k|    if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (1867:9): [True: 8.97k, False: 1.93k]
  ------------------
 1868|  8.97k|      switch (filters[i]) {
 1869|  3.50k|        case BLOSC_SHUFFLE:
  ------------------
  |  Branch (1869:9): [True: 3.50k, False: 5.47k]
  ------------------
 1870|  3.50k|          blosc2_unshuffle(shuffle_size(context, i), bsize, _src, _dest);
 1871|  3.50k|          break;
 1872|  3.80k|        case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (1872:9): [True: 3.80k, False: 5.17k]
  ------------------
 1873|  3.80k|          if (bitunshuffle(typesize, bsize, _src, _dest, bitshuffle_scratch(thread_context, bsize),
  ------------------
  |  Branch (1873:15): [True: 0, False: 3.80k]
  ------------------
 1874|  3.80k|                           context->src[BLOSC2_CHUNK_VERSION]) < 0) {
 1875|      0|            return BLOSC2_ERROR_FILTER_PIPELINE;
 1876|      0|          }
 1877|  3.80k|          break;
 1878|  3.80k|        case BLOSC_DELTA:
  ------------------
  |  Branch (1878:9): [True: 1.67k, False: 7.30k]
  ------------------
 1879|  1.67k|          if (_src != _dest) {
  ------------------
  |  Branch (1879:15): [True: 0, False: 1.67k]
  ------------------
 1880|      0|            memcpy(_dest, _src, (size_t)bsize);
 1881|      0|          }
 1882|  1.67k|          if (offset != 0 && !thread_context->serial) {
  ------------------
  |  Branch (1882:15): [True: 1.51k, False: 159]
  |  Branch (1882:30): [True: 0, False: 1.51k]
  ------------------
 1883|      0|            delta_wait_dref(context);
 1884|      0|          }
 1885|  1.67k|          delta_decoder(offset == 0 ? _dest : dest, offset, bsize, typesize, _dest);
  ------------------
  |  Branch (1885:25): [True: 159, False: 1.51k]
  ------------------
 1886|  1.67k|          break;
 1887|      0|        default:
  ------------------
  |  Branch (1887:9): [True: 0, False: 8.97k]
  ------------------
 1888|      0|          BLOSC_TRACE_ERROR("Filter %d not handled during decompression.", 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1889|      0|          errcode = -1;
 1890|  8.97k|      }
 1891|  8.97k|    } else {
 1892|       |        // Look for the filters_meta in user filters and run it
 1893|  5.37k|        for (uint64_t j = 0; j < g_nfilters; ++j) {
  ------------------
  |  Branch (1893:30): [True: 5.37k, False: 0]
  ------------------
 1894|  5.37k|          if (g_filters[j].id == filters[i]) {
  ------------------
  |  Branch (1894:15): [True: 1.93k, False: 3.44k]
  ------------------
 1895|  1.93k|            if (load_acquire_ptr(&g_filters[j].backward) == NULL) {
  ------------------
  |  |  144|  1.93k|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (1895:17): [True: 0, False: 1.93k]
  ------------------
 1896|       |              // Dynamically load filter
 1897|      0|              if (fill_filter(&g_filters[j]) < 0) {
  ------------------
  |  Branch (1897:19): [True: 0, False: 0]
  ------------------
 1898|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1899|      0|                return BLOSC2_ERROR_FILTER_PIPELINE;
 1900|      0|              }
 1901|      0|            }
 1902|  1.93k|            if (g_filters[j].backward != NULL) {
  ------------------
  |  Branch (1902:17): [True: 1.93k, False: 0]
  ------------------
 1903|  1.93k|              blosc2_dparams dparams;
 1904|  1.93k|              blosc2_ctx_get_dparams(context, &dparams);
 1905|  1.93k|              rc = g_filters[j].backward(_src, _dest, bsize, filters_meta[i], &dparams, g_filters[j].id);
 1906|  1.93k|            } else {
 1907|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1908|      0|              return BLOSC2_ERROR_FILTER_PIPELINE;
 1909|      0|            }
 1910|  1.93k|            if (rc != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1910:17): [True: 0, False: 1.93k]
  ------------------
 1911|      0|              BLOSC_TRACE_ERROR("User-defined filter %d failed during decompression.", 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1912|      0|              return rc;
 1913|      0|            }
 1914|  1.93k|            goto urfiltersuccess;
 1915|  1.93k|          }
 1916|  5.37k|        }
 1917|      0|      BLOSC_TRACE_ERROR("User-defined filter %d not found during decompression.", 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1918|      0|      return BLOSC2_ERROR_FILTER_PIPELINE;
 1919|  1.93k|      urfiltersuccess:;
 1920|  1.93k|    }
 1921|       |
 1922|       |    // do_nothing() skipped the filters that leave the block as it is (TRUNC_PREC is not undone);
 1923|       |    // the output of this filter is the input of the next one
 1924|  10.9k|    _src = _dest;
 1925|  10.9k|    if (last_filter_index == i) {
  ------------------
  |  Branch (1925:9): [True: 10.8k, False: 14]
  ------------------
 1926|  10.8k|      break;
 1927|  10.8k|    }
 1928|  10.9k|  }
 1929|       |
 1930|  10.9k|  if (context->postfilter == NULL && _src != dest + offset) {
  ------------------
  |  Branch (1930:7): [True: 3.71k, False: 7.26k]
  |  Branch (1930:38): [True: 0, False: 3.71k]
  ------------------
 1931|      0|    memcpy(dest + offset, _src, (unsigned int)bsize);
 1932|      0|  }
 1933|       |
 1934|       |  /* Postfilter function */
 1935|  10.9k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (1935:7): [True: 7.26k, False: 3.71k]
  ------------------
 1936|       |    // Create new postfilter parameters for this block (must be private for each thread)
 1937|  7.26k|    blosc2_postfilter_params postparams;
 1938|  7.26k|    memcpy(&postparams, context->postparams, sizeof(postparams));
 1939|  7.26k|    postparams.input = _src;
 1940|  7.26k|    postparams.output = dest + offset;
 1941|  7.26k|    postparams.size = bsize;
 1942|  7.26k|    postparams.typesize = typesize;
 1943|  7.26k|    postparams.offset = nblock * context->blocksize;
 1944|  7.26k|    postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (1944:25): [True: 7.26k, False: 0]
  ------------------
 1945|  7.26k|    postparams.nblock = nblock;
 1946|  7.26k|    postparams.tid = thread_context->tid;
 1947|  7.26k|    postparams.ttmp = thread_context->tmp;
 1948|  7.26k|    postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 1949|  7.26k|    postparams.ctx = context;
 1950|       |
 1951|  7.26k|    if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (1951:9): [True: 0, False: 7.26k]
  ------------------
 1952|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1953|      0|      return BLOSC2_ERROR_POSTFILTER;
 1954|      0|    }
 1955|  7.26k|  }
 1956|       |
 1957|  10.9k|  return errcode;
 1958|  10.9k|}
free_thread_context:
 2648|    188|void free_thread_context(struct thread_context* thread_context) {
 2649|    188|  destroy_thread_context(thread_context);
 2650|    188|  my_free(thread_context);
 2651|    188|}
blosc2_compress_ctx:
 3652|  1.21k|                        void* dest, int32_t destsize) {
 3653|  1.21k|  int error, cbytes;
 3654|       |
 3655|  1.21k|  if (context->do_compress != 1) {
  ------------------
  |  Branch (3655:7): [True: 0, False: 1.21k]
  ------------------
 3656|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3657|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3658|      0|  }
 3659|       |
 3660|  1.21k|  error = initialize_context_compression(
 3661|  1.21k|          context, src, srcsize, dest, destsize,
 3662|  1.21k|          context->clevel, context->filters, context->filters_meta,
 3663|  1.21k|          context->typesize, context->compcode, context->blocksize,
 3664|  1.21k|          context->new_nthreads, context->nthreads, context->splitmode,
 3665|  1.21k|          context->tuner_id, context->tuner_params, context->schunk);
 3666|  1.21k|  if (error <= 0) {
  ------------------
  |  Branch (3666:7): [True: 0, False: 1.21k]
  ------------------
 3667|      0|    return error;
 3668|      0|  }
 3669|       |
 3670|  1.21k|  error = blosc1_format_check(context);
 3671|  1.21k|  if (error < 0) {
  ------------------
  |  Branch (3671:7): [True: 0, False: 1.21k]
  ------------------
 3672|      0|    return error;
 3673|      0|  }
 3674|       |
 3675|       |  /* Write the extended header, or the Blosc1 header if requested */
 3676|  1.21k|  error = write_compression_header(context, !context->blosc1_format);
 3677|  1.21k|  if (error < 0) {
  ------------------
  |  Branch (3677:7): [True: 0, False: 1.21k]
  ------------------
 3678|      0|    return error;
 3679|      0|  }
 3680|       |
 3681|  1.21k|  cbytes = blosc_compress_context(context);
 3682|  1.21k|  if (cbytes < 0) {
  ------------------
  |  Branch (3682:7): [True: 2, False: 1.20k]
  ------------------
 3683|      2|    return cbytes;
 3684|      2|  }
 3685|       |
 3686|  1.20k|  if (context->use_dict && context->dict_cdict == NULL) {
  ------------------
  |  Branch (3686:7): [True: 0, False: 1.20k]
  |  Branch (3686:28): [True: 0, False: 0]
  ------------------
 3687|       |    /* blosc_compress_context() overwrites context->destsize with the training-pass output
 3688|       |     * size.  Restore it so that the real compression pass has the correct output-buffer size. */
 3689|      0|    context->destsize = destsize;
 3690|       |
 3691|      0|    bool is_lz4 = (context->compcode == BLOSC_LZ4 || context->compcode == BLOSC_LZ4HC);
  ------------------
  |  Branch (3691:20): [True: 0, False: 0]
  |  Branch (3691:54): [True: 0, False: 0]
  ------------------
 3692|      0|    if (!is_lz4 && context->compcode != BLOSC_ZSTD) {
  ------------------
  |  Branch (3692:9): [True: 0, False: 0]
  |  Branch (3692:20): [True: 0, False: 0]
  ------------------
 3693|      0|      const char* compname;
 3694|      0|      compname = clibcode_to_clibname(context->compcode);
 3695|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3696|      0|                        compname);
 3697|      0|      return BLOSC2_ERROR_CODEC_DICT;
 3698|      0|    }
 3699|       |
 3700|       |    // Build the dictionary out of the filters outcome and compress with it.
 3701|       |    // For LZ4/LZ4HC the raw samples are used directly (no training algorithm).
 3702|       |    // For ZSTD, ZDICT_trainFromBuffer() is used.
 3703|      0|    int32_t dict_maxsize = BLOSC2_MAXDICTSIZE;
 3704|       |    // Do not make the dict more than 5% larger than uncompressed buffer
 3705|      0|    if (dict_maxsize > srcsize / 20) {
  ------------------
  |  Branch (3705:9): [True: 0, False: 0]
  ------------------
 3706|      0|      dict_maxsize = srcsize / 20;
 3707|      0|    }
 3708|      0|    void* samples_buffer = context->dest + context->header_overhead;
 3709|      0|    unsigned nblocks = (unsigned)context->nblocks;
 3710|      0|    int dont_split = (context->header_flags & 0x10) >> 4;
 3711|      0|    if (!dont_split) {
  ------------------
  |  Branch (3711:9): [True: 0, False: 0]
  ------------------
 3712|      0|      nblocks = nblocks * context->typesize;
 3713|      0|    }
 3714|      0|    if (nblocks < 8) {
  ------------------
  |  Branch (3714:9): [True: 0, False: 0]
  ------------------
 3715|      0|      nblocks = 8;
 3716|      0|    }
 3717|       |
 3718|      0|    unsigned sample_fraction = 16;
 3719|      0|    size_t sample_size = context->sourcesize / nblocks / sample_fraction;
 3720|       |
 3721|       |    // When the data is too small to produce useful dict samples,
 3722|       |    // fall back to plain compression without a dict.
 3723|      0|    if (dict_maxsize < BLOSC2_MINUSEFULDICT || sample_size == 0) {
  ------------------
  |  Branch (3723:9): [True: 0, False: 0]
  |  Branch (3723:48): [True: 0, False: 0]
  ------------------
 3724|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3725|      0|                          "  Falling back to plain compression.", dict_maxsize, sample_size);
 3726|      0|      context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3727|      0|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3728|      0|      cbytes = blosc_compress_context_without_dict(context);
 3729|      0|    }
 3730|      0|    else if (is_lz4) {
  ------------------
  |  Branch (3730:14): [True: 0, False: 0]
  ------------------
 3731|       |      // LZ4/LZ4HC: use raw sample data directly as the dictionary (no training step).
 3732|      0|      int32_t dict_actual_size = (int32_t)(nblocks * sample_size);
 3733|      0|      if (dict_actual_size > dict_maxsize) {
  ------------------
  |  Branch (3733:11): [True: 0, False: 0]
  ------------------
 3734|      0|        dict_actual_size = dict_maxsize;
 3735|      0|      }
 3736|       |
 3737|       |      // Reset bstarts and embed dict in the output buffer.
 3738|      0|      context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3739|      0|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3740|       |      /* Move dict bytes; samples_buffer overlaps the dict (and its size) in dest,
 3741|       |         so this has to be a memmove, done before writing the size */
 3742|      0|      context->dict_buffer = context->dest + context->output_bytes + sizeof(int32_t);
 3743|      0|      memmove(context->dict_buffer, samples_buffer, (size_t)dict_actual_size);
 3744|       |      /* Write dict size */
 3745|      0|      _sw32(context->dest + context->output_bytes, dict_actual_size);
 3746|      0|      context->output_bytes += (int32_t)sizeof(int32_t);
 3747|       |      /* Build the stream used as cdict (pre-loaded with the dict bytes) */
 3748|      0|      if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (3748:11): [True: 0, False: 0]
  ------------------
 3749|      0|        LZ4_streamHC_t* lz4hc_cdict = LZ4_createStreamHC();
 3750|      0|        LZ4_loadDictHC(lz4hc_cdict, (const char*)context->dict_buffer, dict_actual_size);
 3751|      0|        context->dict_cdict = lz4hc_cdict;
 3752|      0|      } else {
 3753|      0|        LZ4_stream_t* lz4_cdict = LZ4_createStream();
 3754|      0|        LZ4_loadDict(lz4_cdict, (const char*)context->dict_buffer, dict_actual_size);
 3755|      0|        context->dict_cdict = lz4_cdict;
 3756|      0|      }
 3757|      0|      context->output_bytes += dict_actual_size;
 3758|      0|      context->dict_size = dict_actual_size;
 3759|       |
 3760|       |      /* Compress with dict */
 3761|      0|      cbytes = blosc_compress_context(context);
 3762|       |
 3763|       |      // Invalidate the dictionary so the context can be reused for the next chunk
 3764|      0|      context->dict_buffer = NULL;
 3765|      0|      if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (3765:11): [True: 0, False: 0]
  ------------------
 3766|      0|        LZ4_freeStreamHC((LZ4_streamHC_t*)context->dict_cdict);
 3767|      0|      } else {
 3768|      0|        LZ4_freeStream((LZ4_stream_t*)context->dict_cdict);
 3769|      0|      }
 3770|      0|      context->dict_cdict = NULL;
 3771|      0|    }
 3772|      0|#ifdef HAVE_ZSTD
 3773|      0|    else {
 3774|       |    // Populate the samples sizes for training the dictionary
 3775|      0|    size_t* samples_sizes = malloc(nblocks * sizeof(size_t));
 3776|      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]
  |  |  ------------------
  ------------------
 3777|      0|    for (size_t i = 0; i < nblocks; i++) {
  ------------------
  |  Branch (3777:24): [True: 0, False: 0]
  ------------------
 3778|      0|      samples_sizes[i] = sample_size;
 3779|      0|    }
 3780|       |
 3781|       |    // Train from samples
 3782|      0|    void* dict_buffer = malloc(dict_maxsize);
 3783|      0|    if (dict_buffer == NULL) {
  ------------------
  |  Branch (3783:9): [True: 0, False: 0]
  ------------------
 3784|      0|      free(samples_sizes);
 3785|      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]
  |  |  ------------------
  ------------------
 3786|      0|    }
 3787|      0|    int32_t dict_actual_size = (int32_t)ZDICT_trainFromBuffer(
 3788|      0|        dict_buffer, dict_maxsize,
 3789|      0|        samples_buffer, samples_sizes, nblocks);
 3790|       |
 3791|       |    // TODO: experiment with parameters of low-level fast cover algorithm
 3792|       |    // Note that this API is still unstable.  See: https://github.com/facebook/zstd/issues/1599
 3793|       |    // ZDICT_fastCover_params_t fast_cover_params;
 3794|       |    // memset(&fast_cover_params, 0, sizeof(fast_cover_params));
 3795|       |    // fast_cover_params.d = nblocks;
 3796|       |    // fast_cover_params.steps = 4;
 3797|       |    // fast_cover_params.zParams.compressionLevel = context->clevel;
 3798|       |    // size_t dict_actual_size = ZDICT_optimizeTrainFromBuffer_fastCover(
 3799|       |    //   dict_buffer, dict_maxsize, samples_buffer, samples_sizes, nblocks,
 3800|       |    //   &fast_cover_params);
 3801|       |
 3802|      0|    free(samples_sizes);
 3803|      0|    if (ZDICT_isError(dict_actual_size) != ZSTD_error_no_error) {
  ------------------
  |  Branch (3803:9): [True: 0, False: 0]
  ------------------
 3804|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3805|      0|                          "  Falling back to plain compression.",
 3806|      0|                          ZDICT_getErrorName(dict_actual_size));
 3807|      0|      free(dict_buffer);
 3808|      0|      context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3809|      0|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3810|      0|      cbytes = blosc_compress_context_without_dict(context);
 3811|      0|    }
 3812|      0|    else {
 3813|      0|    assert(dict_actual_size > 0);
 3814|       |
 3815|       |    // Update bytes counter and pointers to bstarts for the new compressed buffer
 3816|      0|    context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3817|      0|    context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3818|       |    /* Write the size of trained dict at the end of bstarts */
 3819|      0|    _sw32(context->dest + context->output_bytes, (int32_t)dict_actual_size);
 3820|      0|    context->output_bytes += sizeof(int32_t);
 3821|       |    /* Write the trained dict afterwards */
 3822|      0|    context->dict_buffer = context->dest + context->output_bytes;
 3823|      0|    memcpy(context->dict_buffer, dict_buffer, (unsigned int)dict_actual_size);
 3824|      0|    context->dict_cdict = ZSTD_createCDict(dict_buffer, dict_actual_size, 1);  // TODO: use get_accel()
 3825|      0|    free(dict_buffer);      // the dictionary is copied in the header now
 3826|      0|    context->output_bytes += (int32_t)dict_actual_size;
 3827|      0|    context->dict_size = dict_actual_size;
 3828|       |
 3829|       |    /* Compress with dict */
 3830|      0|    cbytes = blosc_compress_context(context);
 3831|       |
 3832|       |    // Invalidate the dictionary for compressing other chunks using the same context
 3833|      0|    context->dict_buffer = NULL;
 3834|      0|    ZSTD_freeCDict(context->dict_cdict);
 3835|      0|    context->dict_cdict = NULL;
 3836|      0|    }  // ZDICT_isError
 3837|      0|    }  // ZSTD else branch
 3838|      0|#endif  // HAVE_ZSTD
 3839|      0|  }
 3840|       |
 3841|  1.20k|  return cbytes;
 3842|  1.20k|}
build_filters:
 4225|  1.74k|                   const int32_t typesize, uint8_t* filters) {
 4226|       |
 4227|       |  /* Fill the end part of the filter pipeline */
 4228|  1.74k|  if ((doshuffle == BLOSC_SHUFFLE) && (typesize > 1))
  ------------------
  |  Branch (4228:7): [True: 0, False: 1.74k]
  |  Branch (4228:39): [True: 0, False: 0]
  ------------------
 4229|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
 4230|  1.74k|  if (doshuffle == BLOSC_BITSHUFFLE)
  ------------------
  |  Branch (4230:7): [True: 0, False: 1.74k]
  ------------------
 4231|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
 4232|  1.74k|  if (doshuffle == BLOSC_NOSHUFFLE)
  ------------------
  |  Branch (4232:7): [True: 0, False: 1.74k]
  ------------------
 4233|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_NOSHUFFLE;
 4234|  1.74k|  if (delta)
  ------------------
  |  Branch (4234:7): [True: 0, False: 1.74k]
  ------------------
 4235|      0|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
 4236|  1.74k|}
blosc2_decompress_ctx:
 4486|  2.00k|                          void* dest, int32_t destsize) {
 4487|  2.00k|  int result;
 4488|       |
 4489|  2.00k|  if (context->do_compress != 0) {
  ------------------
  |  Branch (4489:7): [True: 0, False: 2.00k]
  ------------------
 4490|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4491|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4492|      0|  }
 4493|       |
 4494|  2.00k|  result = blosc_run_decompression_with_context(context, src, srcsize, dest, destsize);
 4495|       |
 4496|       |  // Reset a possible block_maskout
 4497|  2.00k|  ctx_clear_maskout(context);
 4498|       |
 4499|  2.00k|  return result;
 4500|  2.00k|}
_blosc_getitem:
 4873|  2.64k|                   int start, int nitems, void* dest, int32_t destsize) {
 4874|  2.64k|  uint8_t* _src = (uint8_t*)(src);  /* current pos for source buffer */
 4875|  2.64k|  uint8_t* _dest = (uint8_t*)(dest);
 4876|  2.64k|  int32_t ntbytes = 0;              /* the number of uncompressed bytes */
 4877|  2.64k|  int32_t bsize, bsize2, leftoverblock;
 4878|  2.64k|  int32_t startb, stopb;
 4879|  2.64k|  int32_t stop;
 4880|  2.64k|  int32_t nitems_bytes;
 4881|  2.64k|  int64_t start64 = (int64_t)start;
 4882|  2.64k|  int64_t nitems64 = (int64_t)nitems;
 4883|  2.64k|  int64_t typesize64 = (int64_t)header->typesize;
 4884|  2.64k|  int64_t stop64;
 4885|  2.64k|  int64_t nitems_bytes64;
 4886|  2.64k|  int64_t start_bytes64;
 4887|  2.64k|  int64_t stop_bytes64;
 4888|  2.64k|  int j, rc;
 4889|       |
 4890|  2.64k|  if (nitems == 0) {
  ------------------
  |  Branch (4890:7): [True: 0, False: 2.64k]
  ------------------
 4891|       |    // We have nothing to do
 4892|      0|    return 0;
 4893|      0|  }
 4894|  2.64k|  if (nitems < 0) {
  ------------------
  |  Branch (4894:7): [True: 0, False: 2.64k]
  ------------------
 4895|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4896|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4897|      0|  }
 4898|       |
 4899|  2.64k|  nitems_bytes64 = nitems64 * typesize64;
 4900|  2.64k|  if (nitems_bytes64 < 0 || nitems_bytes64 > INT32_MAX || nitems_bytes64 > destsize) {
  ------------------
  |  Branch (4900:7): [True: 0, False: 2.64k]
  |  Branch (4900:29): [True: 0, False: 2.64k]
  |  Branch (4900:59): [True: 0, False: 2.64k]
  ------------------
 4901|      0|    BLOSC_TRACE_ERROR("`nitems`*`typesize` out of dest 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4902|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 4903|      0|  }
 4904|  2.64k|  nitems_bytes = (int32_t)nitems_bytes64;
 4905|       |
 4906|  2.64k|  int32_t* bstarts = (int32_t*)(_src + context->header_overhead);
 4907|       |
 4908|       |  /* Check region boundaries */
 4909|  2.64k|  start_bytes64 = start64 * typesize64;
 4910|  2.64k|  if ((start < 0) || (start_bytes64 < 0) || (start_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4910:7): [True: 0, False: 2.64k]
  |  Branch (4910:22): [True: 0, False: 2.64k]
  |  Branch (4910:45): [True: 0, False: 2.64k]
  ------------------
 4911|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4912|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4913|      0|  }
 4914|       |
 4915|  2.64k|  stop64 = start64 + nitems64;
 4916|  2.64k|  if ((stop64 < 0) || (stop64 > INT32_MAX)) {
  ------------------
  |  Branch (4916:7): [True: 0, False: 2.64k]
  |  Branch (4916:23): [True: 0, False: 2.64k]
  ------------------
 4917|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4918|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4919|      0|  }
 4920|  2.64k|  stop = (int32_t)stop64;
 4921|       |
 4922|  2.64k|  stop_bytes64 = stop64 * typesize64;
 4923|  2.64k|  if ((stop_bytes64 < 0) || (stop_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4923:7): [True: 0, False: 2.64k]
  |  Branch (4923:29): [True: 0, False: 2.64k]
  ------------------
 4924|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4925|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4926|      0|  }
 4927|       |
 4928|  2.64k|  bool chunk_memcpyed = (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0;
 4929|  2.64k|  if (!context->special_type && !chunk_memcpyed &&
  ------------------
  |  Branch (4929:7): [True: 2.50k, False: 144]
  |  Branch (4929:33): [True: 1.62k, False: 879]
  ------------------
 4930|  1.62k|      ((uint8_t *)(_src + srcsize) < (uint8_t *)(bstarts + context->nblocks))) {
  ------------------
  |  Branch (4930:7): [True: 0, False: 1.62k]
  ------------------
 4931|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4932|      0|    return BLOSC2_ERROR_READ_BUFFER;
 4933|      0|  }
 4934|       |
 4935|  2.64k|  bool memcpyed = header->flags & (uint8_t)BLOSC_MEMCPYED;
 4936|  2.64k|  if (context->special_type) {
  ------------------
  |  Branch (4936:7): [True: 144, False: 2.50k]
  ------------------
 4937|       |    // Fake a runlen as if its a memcpyed chunk
 4938|    144|    memcpyed = true;
 4939|    144|  }
 4940|       |
 4941|  2.64k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (4941:19): [True: 2.64k, False: 3]
  ------------------
 4942|  2.64k|                  (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (4942:19): [True: 3, False: 2.64k]
  |  Branch (4942:54): [True: 0, False: 3]
  ------------------
 4943|  2.64k|  if (memcpyed && !is_lazy && !context->postfilter) {
  ------------------
  |  Branch (4943:7): [True: 1.02k, False: 1.62k]
  |  Branch (4943:19): [True: 1.02k, False: 0]
  |  Branch (4943:31): [True: 1.02k, False: 0]
  ------------------
 4944|       |    // Short-circuit for (non-lazy) memcpyed or special values
 4945|  1.02k|    ntbytes = nitems_bytes;
 4946|  1.02k|    switch (context->special_type) {
 4947|    144|      case BLOSC2_SPECIAL_VALUE: {
  ------------------
  |  Branch (4947:7): [True: 144, False: 879]
  ------------------
 4948|       |        // The repeated value's width is cbytes minus the header, not the header
 4949|       |        // typesize byte (which is left unconstrained for special-value chunks).
 4950|       |        // Derive it the same way blosc_d() does so a crafted typesize cannot make
 4951|       |        // set_values() read past the end of the chunk.
 4952|    144|        int32_t value_typesize = header->cbytes - context->header_overhead;
 4953|    144|        rc = set_values(value_typesize, _src, _dest, ntbytes);
 4954|    144|        if (rc < 0) {
  ------------------
  |  Branch (4954:13): [True: 2, False: 142]
  ------------------
 4955|      2|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4956|      2|          return BLOSC2_ERROR_DATA;
 4957|      2|        }
 4958|    142|        break;
 4959|    144|      }
 4960|    142|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (4960:7): [True: 0, False: 1.02k]
  ------------------
 4961|      0|        rc = set_nans(context->typesize, _dest, ntbytes);
 4962|      0|        if (rc < 0) {
  ------------------
  |  Branch (4962:13): [True: 0, False: 0]
  ------------------
 4963|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4964|      0|          return BLOSC2_ERROR_DATA;
 4965|      0|        }
 4966|      0|        break;
 4967|      0|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (4967:7): [True: 0, False: 1.02k]
  ------------------
 4968|      0|        memset(_dest, 0, ntbytes);
 4969|      0|        break;
 4970|      0|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (4970:7): [True: 0, False: 1.02k]
  ------------------
 4971|       |        // We do nothing here
 4972|      0|        break;
 4973|    879|      case BLOSC2_NO_SPECIAL:
  ------------------
  |  Branch (4973:7): [True: 879, False: 144]
  ------------------
 4974|    879|        {
 4975|    879|          int64_t src_offset64 = (int64_t)context->header_overhead + start_bytes64;
 4976|    879|          int64_t src_stop64 = src_offset64 + nitems_bytes64;
 4977|    879|          if ((src_offset64 < 0) || (src_stop64 < src_offset64) || (src_stop64 > srcsize)) {
  ------------------
  |  Branch (4977:15): [True: 0, False: 879]
  |  Branch (4977:37): [True: 0, False: 879]
  |  Branch (4977:68): [True: 0, False: 879]
  ------------------
 4978|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4979|      0|            return BLOSC2_ERROR_READ_BUFFER;
 4980|      0|          }
 4981|    879|          _src += (int32_t)src_offset64;
 4982|    879|        }
 4983|      0|        memcpy(_dest, _src, ntbytes);
 4984|    879|        break;
 4985|      0|      default:
  ------------------
  |  Branch (4985:7): [True: 0, False: 1.02k]
  ------------------
 4986|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4987|      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]
  |  |  ------------------
  ------------------
 4988|  1.02k|    }
 4989|  1.02k|    return ntbytes;
 4990|  1.02k|  }
 4991|       |
 4992|  1.62k|  if (filters_contain(context->filters, BLOSC_DELTA)) {
  ------------------
  |  Branch (4992:7): [True: 0, False: 1.62k]
  ------------------
 4993|      0|    uint8_t* full_chunk = malloc((size_t)header->nbytes);
 4994|      0|    if (full_chunk == NULL) {
  ------------------
  |  Branch (4994:9): [True: 0, False: 0]
  ------------------
 4995|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 4996|      0|    }
 4997|      0|    int dbytes = blosc2_decompress_ctx(context, src, srcsize, full_chunk, header->nbytes);
 4998|      0|    context->dest = NULL;
 4999|      0|    context->destsize = 0;
 5000|      0|    if (dbytes < 0 || dbytes != header->nbytes) {
  ------------------
  |  Branch (5000:9): [True: 0, False: 0]
  |  Branch (5000:23): [True: 0, False: 0]
  ------------------
 5001|      0|      free(full_chunk);
 5002|      0|      return dbytes < 0 ? dbytes : BLOSC2_ERROR_DATA;
  ------------------
  |  Branch (5002:14): [True: 0, False: 0]
  ------------------
 5003|      0|    }
 5004|      0|    memcpy(dest, full_chunk + start_bytes64, (size_t)nitems_bytes);
 5005|      0|    free(full_chunk);
 5006|      0|    return nitems_bytes;
 5007|      0|  }
 5008|       |
 5009|  1.62k|  struct thread_context* scontext = serial_context_get(context);
 5010|  1.62k|  BLOSC_ERROR_NULL(scontext, BLOSC2_ERROR_THREAD_CREATE);
  ------------------
  |  |  104|  1.62k|    do {                                            \
  |  |  105|  1.62k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.62k]
  |  |  ------------------
  |  |  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.62k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.62k]
  |  |  ------------------
  ------------------
 5011|       |
 5012|  3.25k|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (5012:15): [True: 1.62k, False: 1.62k]
  ------------------
 5013|  1.62k|    bsize = header->blocksize;
 5014|  1.62k|    leftoverblock = 0;
 5015|  1.62k|    if ((j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (5015:9): [True: 1.62k, False: 0]
  |  Branch (5015:40): [True: 0, False: 1.62k]
  ------------------
 5016|      0|      bsize = context->leftover;
 5017|      0|      leftoverblock = 1;
 5018|      0|    }
 5019|       |
 5020|       |    /* Compute start & stop for each block */
 5021|  1.62k|    startb = start * header->typesize - j * header->blocksize;
 5022|  1.62k|    stopb = stop * header->typesize - j * header->blocksize;
 5023|  1.62k|    if (stopb <= 0) {
  ------------------
  |  Branch (5023:9): [True: 0, False: 1.62k]
  ------------------
 5024|       |      // We can exit as soon as this block is beyond stop
 5025|      0|      break;
 5026|      0|    }
 5027|  1.62k|    if (startb >= header->blocksize) {
  ------------------
  |  Branch (5027:9): [True: 0, False: 1.62k]
  ------------------
 5028|      0|      continue;
 5029|      0|    }
 5030|  1.62k|    if (startb < 0) {
  ------------------
  |  Branch (5030:9): [True: 0, False: 1.62k]
  ------------------
 5031|      0|      startb = 0;
 5032|      0|    }
 5033|  1.62k|    if (stopb > header->blocksize) {
  ------------------
  |  Branch (5033:9): [True: 0, False: 1.62k]
  ------------------
 5034|      0|      stopb = header->blocksize;
 5035|      0|    }
 5036|  1.62k|    bsize2 = stopb - startb;
 5037|       |
 5038|  1.62k|#if defined(HAVE_ZFP)
 5039|  1.62k|    if (context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) {
  ------------------
  |  Branch (5039:9): [True: 0, False: 1.62k]
  ------------------
 5040|       |      // The items in this block
 5041|      0|      scontext->zfp_cell_start = startb / context->typesize;
 5042|      0|      scontext->zfp_cell_nitems = bsize2 / context->typesize;
 5043|      0|    }
 5044|  1.62k|#endif /* HAVE_ZFP */
 5045|       |
 5046|       |    /* Do the actual data copy */
 5047|       |    // Regular decompression.  Put results in tmp2.
 5048|       |    // If the items are exactly this block, decompress it in destination and avoid a copy
 5049|  1.62k|    bool get_single_block = ((ntbytes == 0) && (startb == 0) && (bsize == nitems_bytes));
  ------------------
  |  Branch (5049:30): [True: 1.62k, False: 0]
  |  Branch (5049:48): [True: 500, False: 1.12k]
  |  Branch (5049:65): [True: 50, False: 450]
  ------------------
 5050|  1.62k|    uint8_t* tmp2 = get_single_block ? dest : scontext->tmp2;
  ------------------
  |  Branch (5050:21): [True: 50, False: 1.57k]
  ------------------
 5051|       |
 5052|       |    // If memcpyed we don't have a bstarts section (because it is not needed)
 5053|  1.62k|    int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (5053:26): [True: 0, False: 1.62k]
  ------------------
 5054|  1.62k|      context->header_overhead + j * header->blocksize : sw32_(bstarts + j);
 5055|       |
 5056|  1.62k|    int32_t cbytes = blosc_d(scontext, bsize, leftoverblock, memcpyed,
 5057|  1.62k|                             src, srcsize, src_offset, j,
 5058|  1.62k|                             tmp2, 0, scontext->tmp, scontext->tmp3);
 5059|  1.62k|    if (cbytes < 0) {
  ------------------
  |  Branch (5059:9): [True: 0, False: 1.62k]
  ------------------
 5060|      0|      ntbytes = cbytes;
 5061|      0|      break;
 5062|      0|    }
 5063|  1.62k|    if (!get_single_block) {
  ------------------
  |  Branch (5063:9): [True: 1.57k, False: 50]
  ------------------
 5064|       |      /* Copy to destination.  When ZFP decoded just the requested items (a single
 5065|       |         cell), they are at the start of tmp2, else the whole block was decoded. */
 5066|  1.57k|      bool zfp_cell = (scontext->zfp_cell_nitems > 0) && (cbytes == bsize2);
  ------------------
  |  Branch (5066:23): [True: 0, False: 1.57k]
  |  Branch (5066:58): [True: 0, False: 0]
  ------------------
 5067|  1.57k|      memcpy((uint8_t *) dest + ntbytes, tmp2 + (zfp_cell ? 0 : startb), (unsigned int) bsize2);
  ------------------
  |  Branch (5067:50): [True: 0, False: 1.57k]
  ------------------
 5068|  1.57k|    }
 5069|  1.62k|    ntbytes += bsize2;
 5070|  1.62k|  }
 5071|       |
 5072|  1.62k|  scontext->zfp_cell_nitems = 0;
 5073|  1.62k|  serial_context_put(scontext);
 5074|       |
 5075|  1.62k|  if (ntbytes >= 0 && ntbytes != nitems_bytes) {
  ------------------
  |  Branch (5075:7): [True: 1.62k, False: 0]
  |  Branch (5075:23): [True: 0, False: 1.62k]
  ------------------
 5076|       |    // A partial decode must not look like a success: callers that only test for
 5077|       |    // a negative return would silently keep hold of an incompletely filled dest.
 5078|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5079|      0|                      ntbytes, nitems_bytes);
 5080|      0|    return BLOSC2_ERROR_DATA;
 5081|      0|  }
 5082|       |
 5083|  1.62k|  return ntbytes;
 5084|  1.62k|}
blosc2_getitem:
 5086|  2.64k|int blosc2_getitem(const void* src, int32_t srcsize, int start, int nitems, void* dest, int32_t destsize) {
 5087|  2.64k|  blosc2_context context;
 5088|  2.64k|  int result;
 5089|       |
 5090|       |  /* Minimally populate the context */
 5091|  2.64k|  memset(&context, 0, sizeof(blosc2_context));
 5092|       |
 5093|  2.64k|  context.schunk = g_schunk;
 5094|  2.64k|  context.nthreads = 1;  // force a serial decompression; fixes #95
 5095|       |
 5096|       |  /* Call the actual getitem function */
 5097|  2.64k|  result = blosc2_getitem_ctx(&context, src, srcsize, start, nitems, dest, destsize);
 5098|       |
 5099|       |  /* Release resources */
 5100|  2.64k|  if (context.serial_context != NULL) {
  ------------------
  |  Branch (5100:7): [True: 0, False: 2.64k]
  ------------------
 5101|      0|    free_thread_context(context.serial_context);
 5102|      0|  }
 5103|  2.64k|  return result;
 5104|  2.64k|}
blosc2_getitem_ctx:
 5148|  2.64k|    int start, int nitems, void* dest, int32_t destsize) {
 5149|  2.64k|  blosc_header header;
 5150|  2.64k|  int result = getitem_read_header(src, srcsize, &header);
 5151|  2.64k|  if (result < 0) {
  ------------------
  |  Branch (5151:7): [True: 0, False: 2.64k]
  ------------------
 5152|      0|    return result;
 5153|      0|  }
 5154|       |
 5155|  2.64k|  return getitem_with_header(context, &header, src, srcsize, start, nitems, dest, destsize);
 5156|  2.64k|}
blosc2_get_nthreads:
 6247|    441|{
 6248|    441|  int16_t nthreads;
 6249|    441|  blosc2_init();
 6250|    441|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|    441|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 6251|    441|  nthreads = g_nthreads;
 6252|    441|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|    441|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 6253|    441|  return nthreads;
 6254|    441|}
blosc2_set_nthreads:
 6256|    243|int16_t blosc2_set_nthreads(int16_t nthreads) {
 6257|    243|  int16_t ret;          /* the previous number of threads */
 6258|       |
 6259|       |  /* Check whether the library should be initialized */
 6260|    243|  blosc2_init();
 6261|       |
 6262|    243|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|    243|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 6263|    243|  ret = g_nthreads;
 6264|    243|  if (nthreads != ret) {
  ------------------
  |  Branch (6264:7): [True: 0, False: 243]
  ------------------
 6265|      0|    int16_t old_new_nthreads = g_global_context->new_nthreads;
 6266|      0|    int16_t old_nthreads = g_global_context->nthreads;
 6267|      0|    g_nthreads = nthreads;
 6268|      0|    g_global_context->new_nthreads = nthreads;
 6269|      0|    int16_t ret2 = check_nthreads(g_global_context, true);
 6270|      0|    if (ret2 < 0) {
  ------------------
  |  Branch (6270:9): [True: 0, False: 0]
  ------------------
 6271|      0|      g_nthreads = ret;
 6272|      0|      g_global_context->new_nthreads = old_new_nthreads;
 6273|      0|      g_global_context->nthreads = old_nthreads;
 6274|      0|      check_nthreads(g_global_context, true);
 6275|      0|      blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|      0|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 6276|      0|      return ret2;
 6277|      0|    }
 6278|      0|  }
 6279|    243|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|    243|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 6280|       |
 6281|    243|  return ret;
 6282|    243|}
blosc2_cbuffer_sizes:
 6399|  47.0k|int blosc2_cbuffer_sizes(const void* cbuffer, int32_t* nbytes, int32_t* cbytes, int32_t* blocksize) {
 6400|  47.0k|  blosc_header header;
 6401|  47.0k|  int rc = read_chunk_header((uint8_t *) cbuffer, BLOSC_MIN_HEADER_LENGTH, false, &header);
 6402|  47.0k|  if (rc < 0) {
  ------------------
  |  Branch (6402:7): [True: 5, False: 47.0k]
  ------------------
 6403|       |    /* Return zeros if error reading header */
 6404|      5|    memset(&header, 0, sizeof(header));
 6405|      5|  }
 6406|       |
 6407|       |  /* Read the interesting values */
 6408|  47.0k|  if (nbytes != NULL)
  ------------------
  |  Branch (6408:7): [True: 44.5k, False: 2.50k]
  ------------------
 6409|  44.5k|    *nbytes = header.nbytes;
 6410|  47.0k|  if (cbytes != NULL)
  ------------------
  |  Branch (6410:7): [True: 46.9k, False: 87]
  ------------------
 6411|  46.9k|    *cbytes = header.cbytes;
 6412|  47.0k|  if (blocksize != NULL)
  ------------------
  |  Branch (6412:7): [True: 4.84k, False: 42.1k]
  ------------------
 6413|  4.84k|    *blocksize = header.blocksize;
 6414|  47.0k|  return rc;
 6415|  47.0k|}
blosc2_init:
 6605|    927|void blosc2_init(void) {
 6606|       |  /* Return if Blosc is already initialized */
 6607|    927|  if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  142|    927|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  104|    927|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (6607:7): [True: 684, False: 243]
  ------------------
 6608|       |
 6609|    243|#if !defined(_WIN32)
 6610|       |  /* Before g_init_lock is taken: from now on a fork() waits for it */
 6611|    243|  pthread_once(&atfork_once, register_atfork);
 6612|    243|#endif
 6613|    243|  static_lock(&g_init_lock);
  ------------------
  |  |  132|    243|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6614|       |  /* Teardown drops this lock while joining prefetch workers.  Wait without
 6615|       |     holding it so the destroyer can finish; never reinitialize live globals. */
 6616|    243|  while (g_initlib == BLOSC_STATE_TEARDOWN) {
  ------------------
  |  |  105|    243|#define BLOSC_STATE_TEARDOWN      2
  ------------------
  |  Branch (6616:10): [True: 0, False: 243]
  ------------------
 6617|       |#if defined(_WIN32)
 6618|       |    SleepConditionVariableSRW(&g_init_cv, &g_init_lock, INFINITE, 0);
 6619|       |#else
 6620|      0|    pthread_cond_wait(&g_init_cv, &g_init_lock);
 6621|      0|#endif
 6622|      0|  }
 6623|       |  /* Unless another thread initialized it meanwhile */
 6624|    243|  if (g_initlib != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  104|    243|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (6624:7): [True: 243, False: 0]
  ------------------
 6625|    243|    blosc2_init_locked();
 6626|    243|  }
 6627|    243|  static_unlock(&g_init_lock);
  ------------------
  |  |  133|    243|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6628|    243|}
blosc2_tmp_malloc:
 6792|    814|void *blosc2_tmp_malloc(size_t nbytes, size_t *capacity) {
 6793|    814|  *capacity = nbytes;
 6794|    814|#if !defined(_WIN32)
 6795|    814|  tmp_cache_t *cache = nbytes >= BLOSC2_TMP_CACHE_MIN ? tmp_cache_get(false) : NULL;
  ------------------
  |  | 6659|    814|#define BLOSC2_TMP_CACHE_MIN (64 * 1024)
  ------------------
  |  Branch (6795:24): [True: 0, False: 814]
  ------------------
 6796|    814|  if (cache != NULL) {
  ------------------
  |  Branch (6796:7): [True: 0, False: 814]
  ------------------
 6797|       |    // The smallest buffer that fits, and not one far larger than needed
 6798|      0|    int best = -1;
 6799|      0|    for (int i = 0; i < BLOSC2_TMP_CACHE_SLOTS; ++i) {
  ------------------
  |  | 6658|      0|#define BLOSC2_TMP_CACHE_SLOTS 4
  ------------------
  |  Branch (6799:21): [True: 0, False: 0]
  ------------------
 6800|      0|      if (cache->ptr[i] != NULL && cache->size[i] >= nbytes && cache->size[i] / 2 <= nbytes &&
  ------------------
  |  Branch (6800:11): [True: 0, False: 0]
  |  Branch (6800:36): [True: 0, False: 0]
  |  Branch (6800:64): [True: 0, False: 0]
  ------------------
 6801|      0|          (best < 0 || cache->size[i] < cache->size[best])) {
  ------------------
  |  Branch (6801:12): [True: 0, False: 0]
  |  Branch (6801:24): [True: 0, False: 0]
  ------------------
 6802|      0|        best = i;
 6803|      0|      }
 6804|      0|    }
 6805|      0|    if (best >= 0) {
  ------------------
  |  Branch (6805:9): [True: 0, False: 0]
  ------------------
 6806|      0|      void *ptr = cache->ptr[best];
 6807|      0|      *capacity = cache->size[best];
 6808|      0|      cache->ptr[best] = NULL;
 6809|      0|      cache->size[best] = 0;
 6810|      0|      return ptr;
 6811|      0|    }
 6812|      0|  }
 6813|    814|#endif
 6814|    814|  return malloc(nbytes);
 6815|    814|}
blosc2_tmp_free:
 6817|  1.12k|void blosc2_tmp_free(void *ptr, size_t capacity) {
 6818|  1.12k|  if (ptr == NULL) {
  ------------------
  |  Branch (6818:7): [True: 306, False: 814]
  ------------------
 6819|    306|    return;
 6820|    306|  }
 6821|    814|#if !defined(_WIN32)
 6822|    814|  tmp_cache_t *cache = NULL;
 6823|    814|  if (capacity >= BLOSC2_TMP_CACHE_MIN && capacity <= BLOSC2_TMP_CACHE_MAX / 2) {
  ------------------
  |  | 6659|  1.62k|#define BLOSC2_TMP_CACHE_MIN (64 * 1024)
  ------------------
                if (capacity >= BLOSC2_TMP_CACHE_MIN && capacity <= BLOSC2_TMP_CACHE_MAX / 2) {
  ------------------
  |  | 6660|      0|#define BLOSC2_TMP_CACHE_MAX (64 * 1024 * 1024)
  ------------------
  |  Branch (6823:7): [True: 0, False: 814]
  |  Branch (6823:43): [True: 0, False: 0]
  ------------------
 6824|      0|    cache = tmp_cache_get(true);
 6825|      0|  }
 6826|    814|  if (cache != NULL) {
  ------------------
  |  Branch (6826:7): [True: 0, False: 814]
  ------------------
 6827|       |    // Make room by dropping the smallest buffers (each one smaller than this)
 6828|      0|    for (;;) {
 6829|      0|      size_t total = capacity;
 6830|      0|      int empty = -1;
 6831|      0|      int smallest = -1;
 6832|      0|      for (int i = 0; i < BLOSC2_TMP_CACHE_SLOTS; ++i) {
  ------------------
  |  | 6658|      0|#define BLOSC2_TMP_CACHE_SLOTS 4
  ------------------
  |  Branch (6832:23): [True: 0, False: 0]
  ------------------
 6833|      0|        if (cache->ptr[i] == NULL) {
  ------------------
  |  Branch (6833:13): [True: 0, False: 0]
  ------------------
 6834|      0|          empty = i;
 6835|      0|          continue;
 6836|      0|        }
 6837|      0|        total += cache->size[i];
 6838|      0|        if (smallest < 0 || cache->size[i] < cache->size[smallest]) {
  ------------------
  |  Branch (6838:13): [True: 0, False: 0]
  |  Branch (6838:29): [True: 0, False: 0]
  ------------------
 6839|      0|          smallest = i;
 6840|      0|        }
 6841|      0|      }
 6842|      0|      if (empty >= 0 && total <= BLOSC2_TMP_CACHE_MAX) {
  ------------------
  |  | 6660|      0|#define BLOSC2_TMP_CACHE_MAX (64 * 1024 * 1024)
  ------------------
  |  Branch (6842:11): [True: 0, False: 0]
  |  Branch (6842:25): [True: 0, False: 0]
  ------------------
 6843|      0|        cache->ptr[empty] = ptr;
 6844|      0|        cache->size[empty] = capacity;
 6845|      0|        return;
 6846|      0|      }
 6847|      0|      if (smallest < 0 || cache->size[smallest] >= capacity) {
  ------------------
  |  Branch (6847:11): [True: 0, False: 0]
  |  Branch (6847:27): [True: 0, False: 0]
  ------------------
 6848|      0|        break;
 6849|      0|      }
 6850|      0|      free(cache->ptr[smallest]);
 6851|      0|      cache->ptr[smallest] = NULL;
 6852|      0|      cache->size[smallest] = 0;
 6853|      0|    }
 6854|      0|  }
 6855|       |#else
 6856|       |  BLOSC_UNUSED_PARAM(capacity);
 6857|       |#endif
 6858|    814|  free(ptr);
 6859|    814|}
blosc2_tmp_cache_clear:
 6861|    486|void blosc2_tmp_cache_clear(void) {
 6862|    486|#if !defined(_WIN32)
 6863|    486|  tmp_cache_t *cache = tmp_cache_get(false);
 6864|    486|  if (cache != NULL) {
  ------------------
  |  Branch (6864:7): [True: 482, False: 4]
  ------------------
 6865|  2.41k|    for (int i = 0; i < BLOSC2_TMP_CACHE_SLOTS; ++i) {
  ------------------
  |  | 6658|  2.41k|#define BLOSC2_TMP_CACHE_SLOTS 4
  ------------------
  |  Branch (6865:21): [True: 1.92k, False: 482]
  ------------------
 6866|  1.92k|      free(cache->ptr[i]);
 6867|  1.92k|      cache->ptr[i] = NULL;
 6868|  1.92k|      cache->size[i] = 0;
 6869|  1.92k|    }
 6870|    482|    if (cache->serial != NULL && !cache->serial_busy) {
  ------------------
  |  Branch (6870:9): [True: 132, False: 350]
  |  Branch (6870:34): [True: 132, False: 0]
  ------------------
 6871|    132|      free_thread_context(cache->serial);
 6872|       |      cache->serial = NULL;
 6873|    132|    }
 6874|    482|  }
 6875|    486|#endif
 6876|    486|}
blosc2_destroy:
 6914|    243|void blosc2_destroy(void) {
 6915|       |  /* Return if Blosc is not initialized */
 6916|    243|  if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  142|    243|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  104|    243|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (6916:7): [True: 0, False: 243]
  ------------------
 6917|       |
 6918|    243|  static_lock(&g_init_lock);
  ------------------
  |  |  132|    243|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6919|    243|  if (g_initlib != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  104|    243|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (6919:7): [True: 0, False: 243]
  ------------------
 6920|      0|    static_unlock(&g_init_lock);
  ------------------
  |  |  133|      0|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6921|      0|    return;
 6922|      0|  }
 6923|    243|  store_release_int(&g_initlib, BLOSC_STATE_TEARDOWN);
  ------------------
  |  |  143|    243|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 6924|    243|  static_unlock(&g_init_lock);
  ------------------
  |  |  133|    243|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6925|       |
 6926|       |  /* Not under g_init_lock: a fork() holds the read-ahead pool's lock while it
 6927|       |     waits for g_init_lock (prefetch.c registers its fork handlers later).
 6928|       |     New prefetch operations and threads are blocked by blosc2_is_initialized(). */
 6929|    243|  prefetch_destroy();
 6930|       |
 6931|    243|  static_lock(&g_init_lock);
  ------------------
  |  |  132|    243|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6932|    243|  blosc2_destroy_locked();
 6933|    243|  store_release_int(&g_initlib, BLOSC_STATE_UNINITIALIZED);
  ------------------
  |  |  143|    243|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 6934|       |#if defined(_WIN32)
 6935|       |  WakeAllConditionVariable(&g_init_cv);
 6936|       |#else
 6937|    243|  pthread_cond_broadcast(&g_init_cv);
 6938|    243|#endif
 6939|    243|  static_unlock(&g_init_lock);
  ------------------
  |  |  133|    243|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6940|    243|}
blosc2_create_cctx:
 6946|  1.74k|blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
 6947|  1.74k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 6948|  1.74k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  1.74k|    do {                                            \
  |  |  105|  1.74k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.74k]
  |  |  ------------------
  |  |  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.74k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.74k]
  |  |  ------------------
  ------------------
 6949|       |
 6950|       |  /* Populate the context, using zeros as default values */
 6951|  1.74k|  memset(context, 0, sizeof(blosc2_context));
 6952|       |  /* Early, so that the cleanup at `failed` can always destroy it */
 6953|  1.74k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  1.74k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6954|  1.74k|  context->do_compress = 1;   /* meant for compression */
 6955|  1.74k|  context->use_dict = cparams.use_dict;
 6956|  1.74k|  if (cparams.instr_codec) {
  ------------------
  |  Branch (6956:7): [True: 0, False: 1.74k]
  ------------------
 6957|      0|    context->blosc2_flags = BLOSC2_INSTR_CODEC;
 6958|      0|  }
 6959|       |
 6960|  12.2k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (6960:19): [True: 10.4k, False: 1.74k]
  ------------------
 6961|  10.4k|    context->filters[i] = cparams.filters[i];
 6962|  10.4k|    context->filters_meta[i] = cparams.filters_meta[i];
 6963|       |
 6964|  10.4k|    if (context->filters[i] >= BLOSC_LAST_FILTER && context->filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (6964:9): [True: 133, False: 10.3k]
  |  Branch (6964:53): [True: 1, False: 132]
  ------------------
 6965|      1|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6966|      1|                        context->filters[i]);
 6967|      1|      goto failed;
 6968|      1|    }
 6969|  10.4k|    if (context->filters[i] > BLOSC_LAST_REGISTERED_FILTER && context->filters[i] <= BLOSC2_GLOBAL_REGISTERED_FILTERS_STOP) {
  ------------------
  |  Branch (6969:9): [True: 16, False: 10.4k]
  |  Branch (6969:63): [True: 0, False: 16]
  ------------------
 6970|      0|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6971|      0|                        context->filters[i]);
 6972|      0|      goto failed;
 6973|      0|    }
 6974|  10.4k|  }
 6975|       |
 6976|  1.74k|#if defined(HAVE_ZFP)
 6977|  1.74k|#include "blosc2/codecs-registry.h"
 6978|  1.74k|  if ((context->compcode >= BLOSC_CODEC_ZFP_FIXED_ACCURACY) && (context->compcode <= BLOSC_CODEC_ZFP_FIXED_RATE)) {
  ------------------
  |  Branch (6978:7): [True: 0, False: 1.74k]
  |  Branch (6978:64): [True: 0, False: 0]
  ------------------
 6979|      0|    for (int i = 0; i < BLOSC2_MAX_FILTERS; ++i) {
  ------------------
  |  Branch (6979:21): [True: 0, False: 0]
  ------------------
 6980|      0|      if ((context->filters[i] == BLOSC_SHUFFLE) || (context->filters[i] == BLOSC_BITSHUFFLE)) {
  ------------------
  |  Branch (6980:11): [True: 0, False: 0]
  |  Branch (6980:53): [True: 0, False: 0]
  ------------------
 6981|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6982|      0|        goto failed;
 6983|      0|      }
 6984|      0|    }
 6985|      0|  }
 6986|  1.74k|#endif /* HAVE_ZFP */
 6987|       |
 6988|       |  /* Check for a BLOSC_SHUFFLE environment variable */
 6989|  1.74k|  int doshuffle = -1;
 6990|  1.74k|  char* envvar = getenv("BLOSC_SHUFFLE");
 6991|  1.74k|  if (envvar != NULL) {
  ------------------
  |  Branch (6991:7): [True: 0, False: 1.74k]
  ------------------
 6992|      0|    if (strcmp(envvar, "NOSHUFFLE") == 0) {
  ------------------
  |  Branch (6992:9): [True: 0, False: 0]
  ------------------
 6993|      0|      doshuffle = BLOSC_NOSHUFFLE;
 6994|      0|    }
 6995|      0|    else if (strcmp(envvar, "SHUFFLE") == 0) {
  ------------------
  |  Branch (6995:14): [True: 0, False: 0]
  ------------------
 6996|      0|      doshuffle = BLOSC_SHUFFLE;
 6997|      0|    }
 6998|      0|    else if (strcmp(envvar, "BITSHUFFLE") == 0) {
  ------------------
  |  Branch (6998:14): [True: 0, False: 0]
  ------------------
 6999|      0|      doshuffle = BLOSC_BITSHUFFLE;
 7000|      0|    }
 7001|      0|    else {
 7002|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7003|      0|    }
 7004|      0|  }
 7005|       |  /* Check for a BLOSC_DELTA environment variable */
 7006|  1.74k|  int dodelta = BLOSC_NOFILTER;
 7007|  1.74k|  envvar = getenv("BLOSC_DELTA");
 7008|  1.74k|  if (envvar != NULL) {
  ------------------
  |  Branch (7008:7): [True: 0, False: 1.74k]
  ------------------
 7009|      0|    if (strcmp(envvar, "1") == 0) {
  ------------------
  |  Branch (7009:9): [True: 0, False: 0]
  ------------------
 7010|      0|      dodelta = BLOSC_DELTA;
 7011|      0|    } else if (strcmp(envvar, "0") == 0){
  ------------------
  |  Branch (7011:16): [True: 0, False: 0]
  ------------------
 7012|      0|      dodelta = BLOSC_NOFILTER;
 7013|      0|    }
 7014|      0|    else {
 7015|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7016|      0|    }
 7017|      0|  }
 7018|       |  /* Check for a BLOSC_TYPESIZE environment variable */
 7019|  1.74k|  context->typesize = cparams.typesize;
 7020|  1.74k|  envvar = getenv("BLOSC_TYPESIZE");
 7021|  1.74k|  if (envvar != NULL) {
  ------------------
  |  Branch (7021:7): [True: 0, False: 1.74k]
  ------------------
 7022|      0|    int32_t value;
 7023|      0|    errno = 0; /* To distinguish success/failure after call */
 7024|      0|    value = (int32_t) strtol(envvar, NULL, 10);
 7025|      0|    if ((errno != EINVAL) && (value > 0)) {
  ------------------
  |  Branch (7025:9): [True: 0, False: 0]
  |  Branch (7025:30): [True: 0, False: 0]
  ------------------
 7026|      0|      context->typesize = value;
 7027|      0|    }
 7028|      0|    else {
 7029|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7030|      0|    }
 7031|      0|  }
 7032|  1.74k|  build_filters(doshuffle, dodelta, context->typesize, context->filters);
 7033|       |
 7034|  1.74k|  context->clevel = cparams.clevel;
 7035|       |  /* Check for a BLOSC_CLEVEL environment variable */
 7036|  1.74k|  envvar = getenv("BLOSC_CLEVEL");
 7037|  1.74k|  if (envvar != NULL) {
  ------------------
  |  Branch (7037:7): [True: 0, False: 1.74k]
  ------------------
 7038|      0|    int value;
 7039|      0|    errno = 0; /* To distinguish success/failure after call */
 7040|      0|    value = (int)strtol(envvar, NULL, 10);
 7041|      0|    if ((errno != EINVAL) && (value >= 0)) {
  ------------------
  |  Branch (7041:9): [True: 0, False: 0]
  |  Branch (7041:30): [True: 0, False: 0]
  ------------------
 7042|      0|      context->clevel = value;
 7043|      0|    }
 7044|      0|    else {
 7045|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7046|      0|    }
 7047|      0|  }
 7048|       |
 7049|  1.74k|  context->compcode = cparams.compcode;
 7050|       |  /* Check for a BLOSC_COMPRESSOR environment variable */
 7051|  1.74k|  envvar = getenv("BLOSC_COMPRESSOR");
 7052|  1.74k|  if (envvar != NULL) {
  ------------------
  |  Branch (7052:7): [True: 0, False: 1.74k]
  ------------------
 7053|      0|    int codec = blosc2_compname_to_compcode(envvar);
 7054|      0|    if (codec >= BLOSC_LAST_CODEC) {
  ------------------
  |  Branch (7054:9): [True: 0, False: 0]
  ------------------
 7055|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7056|      0|      goto failed;
 7057|      0|    }
 7058|      0|    context->compcode = codec;
 7059|      0|  }
 7060|  1.74k|  context->compcode_meta = cparams.compcode_meta;
 7061|       |
 7062|  1.74k|  context->blocksize = cparams.blocksize;
 7063|       |  /* Check for a BLOSC_BLOCKSIZE environment variable */
 7064|  1.74k|  envvar = getenv("BLOSC_BLOCKSIZE");
 7065|  1.74k|  if (envvar != NULL) {
  ------------------
  |  Branch (7065:7): [True: 0, False: 1.74k]
  ------------------
 7066|      0|    int32_t blocksize;
 7067|      0|    errno = 0; /* To distinguish success/failure after call */
 7068|      0|    blocksize = (int32_t) strtol(envvar, NULL, 10);
 7069|      0|    if ((errno != EINVAL) && (blocksize > 0)) {
  ------------------
  |  Branch (7069:9): [True: 0, False: 0]
  |  Branch (7069:30): [True: 0, False: 0]
  ------------------
 7070|      0|      context->blocksize = blocksize;
 7071|      0|    }
 7072|      0|    else {
 7073|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7074|      0|    }
 7075|      0|  }
 7076|       |
 7077|  1.74k|  context->nthreads = cparams.nthreads;
 7078|       |  /* Check for a BLOSC_NTHREADS environment variable */
 7079|  1.74k|  envvar = getenv("BLOSC_NTHREADS");
 7080|  1.74k|  if (envvar != NULL) {
  ------------------
  |  Branch (7080:7): [True: 0, False: 1.74k]
  ------------------
 7081|      0|    errno = 0; /* To distinguish success/failure after call */
 7082|      0|    int16_t nthreads = (int16_t) strtol(envvar, NULL, 10);
 7083|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (7083:9): [True: 0, False: 0]
  |  Branch (7083:30): [True: 0, False: 0]
  ------------------
 7084|      0|      context->nthreads = nthreads;
 7085|      0|    }
 7086|      0|    else {
 7087|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7088|      0|    }
 7089|      0|  }
 7090|  1.74k|  context->new_nthreads = context->nthreads;
 7091|       |
 7092|  1.74k|  context->splitmode = cparams.splitmode;
 7093|       |  /* Check for a BLOSC_SPLITMODE environment variable */
 7094|  1.74k|  envvar = getenv("BLOSC_SPLITMODE");
 7095|  1.74k|  if (envvar != NULL) {
  ------------------
  |  Branch (7095:7): [True: 0, False: 1.74k]
  ------------------
 7096|      0|    int32_t splitmode = -1;
 7097|      0|    if (strcmp(envvar, "ALWAYS") == 0) {
  ------------------
  |  Branch (7097:9): [True: 0, False: 0]
  ------------------
 7098|      0|      splitmode = BLOSC_ALWAYS_SPLIT;
 7099|      0|    }
 7100|      0|    else if (strcmp(envvar, "NEVER") == 0) {
  ------------------
  |  Branch (7100:14): [True: 0, False: 0]
  ------------------
 7101|      0|      splitmode = BLOSC_NEVER_SPLIT;
 7102|      0|    }
 7103|      0|    else if (strcmp(envvar, "AUTO") == 0) {
  ------------------
  |  Branch (7103:14): [True: 0, False: 0]
  ------------------
 7104|      0|      splitmode = BLOSC_AUTO_SPLIT;
 7105|      0|    }
 7106|      0|    else if (strcmp(envvar, "FORWARD_COMPAT") == 0) {
  ------------------
  |  Branch (7106:14): [True: 0, False: 0]
  ------------------
 7107|      0|      splitmode = BLOSC_FORWARD_COMPAT_SPLIT;
 7108|      0|    }
 7109|      0|    else {
 7110|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7111|      0|    }
 7112|      0|    if (splitmode >= 0) {
  ------------------
  |  Branch (7112:9): [True: 0, False: 0]
  ------------------
 7113|      0|      context->splitmode = splitmode;
 7114|      0|    }
 7115|      0|  }
 7116|       |
 7117|  1.74k|  context->threads_started = 0;
 7118|  1.74k|  context->schunk = cparams.schunk;
 7119|       |
 7120|  1.74k|  if (cparams.prefilter != NULL) {
  ------------------
  |  Branch (7120:7): [True: 0, False: 1.74k]
  ------------------
 7121|      0|    context->prefilter = cparams.prefilter;
 7122|      0|    context->preparams = (blosc2_prefilter_params*)my_malloc(sizeof(blosc2_prefilter_params));
 7123|      0|    if (context->preparams == NULL) {
  ------------------
  |  Branch (7123:9): [True: 0, False: 0]
  ------------------
 7124|      0|      goto failed;
 7125|      0|    }
 7126|      0|    memcpy(context->preparams, cparams.preparams, sizeof(blosc2_prefilter_params));
 7127|      0|  }
 7128|       |
 7129|  1.74k|  if (cparams.tuner_id <= 0) {
  ------------------
  |  Branch (7129:7): [True: 1.74k, False: 0]
  ------------------
 7130|  1.74k|    cparams.tuner_id = g_tuner;
 7131|  1.74k|  } else {
 7132|      0|    for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (7132:21): [True: 0, False: 0]
  ------------------
 7133|      0|      if (g_tuners[i].id == cparams.tuner_id) {
  ------------------
  |  Branch (7133:11): [True: 0, False: 0]
  ------------------
 7134|      0|        if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (7134:13): [True: 0, False: 0]
  ------------------
 7135|      0|          if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (7135:15): [True: 0, False: 0]
  ------------------
 7136|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7137|      0|            goto failed;
 7138|      0|          }
 7139|      0|        }
 7140|      0|        if (g_tuners[i].init(cparams.tuner_params, context, NULL) < 0) {
  ------------------
  |  Branch (7140:13): [True: 0, False: 0]
  ------------------
 7141|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7142|      0|          goto failed;
 7143|      0|        }
 7144|      0|        goto urtunersuccess;
 7145|      0|      }
 7146|      0|    }
 7147|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7148|      0|    goto failed;
 7149|      0|  }
 7150|  1.74k|  urtunersuccess:;
 7151|       |
 7152|  1.74k|  context->tuner_id = cparams.tuner_id;
 7153|       |
 7154|  1.74k|  context->codec_params = cparams.codec_params;
 7155|  1.74k|  memcpy(context->filter_params, cparams.filter_params, BLOSC2_MAX_FILTERS * sizeof(void*));
 7156|       |
 7157|  1.74k|  return context;
 7158|       |
 7159|      1|failed:
 7160|      1|  my_free(context->preparams);
 7161|      1|  blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|      1|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7162|      1|  my_free(context);
 7163|       |  return NULL;
 7164|  1.74k|}
blosc2_create_dctx:
 7167|  1.10k|blosc2_context* blosc2_create_dctx(blosc2_dparams dparams) {
 7168|  1.10k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 7169|  1.10k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  1.10k|    do {                                            \
  |  |  105|  1.10k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.10k]
  |  |  ------------------
  |  |  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.10k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.10k]
  |  |  ------------------
  ------------------
 7170|       |
 7171|       |  /* Populate the context, using zeros as default values */
 7172|  1.10k|  memset(context, 0, sizeof(blosc2_context));
 7173|  1.10k|  context->do_compress = 0;   /* Meant for decompression */
 7174|       |
 7175|  1.10k|  context->nthreads = dparams.nthreads;
 7176|  1.10k|  char* envvar = getenv("BLOSC_NTHREADS");
 7177|  1.10k|  if (envvar != NULL) {
  ------------------
  |  Branch (7177:7): [True: 0, False: 1.10k]
  ------------------
 7178|      0|    errno = 0; /* To distinguish success/failure after call */
 7179|      0|    long nthreads = strtol(envvar, NULL, 10);
 7180|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (7180:9): [True: 0, False: 0]
  |  Branch (7180:30): [True: 0, False: 0]
  ------------------
 7181|      0|      context->nthreads = (int16_t) nthreads;
 7182|      0|    }
 7183|      0|  }
 7184|  1.10k|  context->new_nthreads = context->nthreads;
 7185|       |
 7186|  1.10k|  context->threads_started = 0;
 7187|  1.10k|  context->block_maskout = NULL;
 7188|  1.10k|  context->block_maskout_nitems = 0;
 7189|  1.10k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  1.10k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 7190|  1.10k|  context->schunk = dparams.schunk;
 7191|       |
 7192|  1.10k|  if (dparams.postfilter != NULL) {
  ------------------
  |  Branch (7192:7): [True: 0, False: 1.10k]
  ------------------
 7193|      0|    context->postfilter = dparams.postfilter;
 7194|      0|    context->postparams = (blosc2_postfilter_params*)my_malloc(sizeof(blosc2_postfilter_params));
 7195|      0|    if (context->postparams == NULL) {
  ------------------
  |  Branch (7195:9): [True: 0, False: 0]
  ------------------
 7196|      0|      blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7197|      0|      my_free(context);
 7198|      0|      return NULL;
 7199|      0|    }
 7200|      0|    memcpy(context->postparams, dparams.postparams, sizeof(blosc2_postfilter_params));
 7201|      0|  }
 7202|       |
 7203|  1.10k|  return context;
 7204|  1.10k|}
blosc2_free_ctx:
 7207|  3.09k|void blosc2_free_ctx(blosc2_context* context) {
 7208|  3.09k|  if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED ||
  ------------------
  |  |  142|  3.09k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED ||
  ------------------
  |  |  104|  6.18k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7208:7): [True: 2.84k, False: 243]
  ------------------
 7209|    243|      context->thread_backend == BLOSC_BACKEND_PER_CONTEXT ||
  ------------------
  |  |   36|  3.33k|#define BLOSC_BACKEND_PER_CONTEXT 3   /* per-context threads; used on Windows */
  ------------------
  |  Branch (7209:7): [True: 0, False: 243]
  ------------------
 7210|  2.84k|      context->thread_backend == BLOSC_BACKEND_CALLBACK) {
  ------------------
  |  |   35|    243|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (7210:7): [True: 0, False: 243]
  ------------------
 7211|  2.84k|    release_thread_backend(context);
 7212|  2.84k|  }
 7213|  3.09k|  if (context->serial_context != NULL) {
  ------------------
  |  Branch (7213:7): [True: 56, False: 3.03k]
  ------------------
 7214|     56|    free_thread_context(context->serial_context);
 7215|     56|  }
 7216|  3.09k|  blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|  3.09k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7217|  3.09k|  release_context_dict_buffer(context);
 7218|  3.09k|  if (context->dict_cdict != NULL) {
  ------------------
  |  Branch (7218:7): [True: 0, False: 3.09k]
  ------------------
 7219|      0|    if (context->compcode == BLOSC_LZ4) {
  ------------------
  |  Branch (7219:9): [True: 0, False: 0]
  ------------------
 7220|      0|      LZ4_freeStream((LZ4_stream_t*)context->dict_cdict);
 7221|      0|    } else if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (7221:16): [True: 0, False: 0]
  ------------------
 7222|      0|      LZ4_freeStreamHC((LZ4_streamHC_t*)context->dict_cdict);
 7223|      0|    }
 7224|      0|#ifdef HAVE_ZSTD
 7225|      0|    else if (context->compcode == BLOSC_ZSTD) {
  ------------------
  |  Branch (7225:14): [True: 0, False: 0]
  ------------------
 7226|      0|      ZSTD_freeCDict(context->dict_cdict);
 7227|      0|    }
 7228|      0|#endif
 7229|      0|  }
 7230|  3.09k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (7230:7): [True: 0, False: 3.09k]
  ------------------
 7231|      0|#ifdef HAVE_ZSTD
 7232|      0|    ZSTD_freeDDict(context->dict_ddict);
 7233|      0|#endif
 7234|      0|  }
 7235|  3.09k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (7235:7): [True: 0, False: 3.09k]
  ------------------
 7236|      0|    int rc;
 7237|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (7237:9): [True: 0, False: 0]
  |  Branch (7237:49): [True: 0, False: 0]
  ------------------
 7238|      0|      rc = blosc_stune_free(context);
 7239|      0|    } else {
 7240|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (7240:23): [True: 0, False: 0]
  ------------------
 7241|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (7241:13): [True: 0, False: 0]
  ------------------
 7242|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (7242:15): [True: 0, False: 0]
  ------------------
 7243|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (7243:17): [True: 0, False: 0]
  ------------------
 7244|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7245|      0|              return;
 7246|      0|            }
 7247|      0|          }
 7248|      0|          rc = g_tuners[i].free(context);
 7249|      0|          goto urtunersuccess;
 7250|      0|        }
 7251|      0|      }
 7252|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7253|      0|      return;
 7254|      0|      urtunersuccess:;
 7255|      0|    }
 7256|      0|    if (rc < 0) {
  ------------------
  |  Branch (7256:9): [True: 0, False: 0]
  ------------------
 7257|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7258|      0|      return;
 7259|      0|    }
 7260|      0|  }
 7261|       |  /* May be needed if codec_params ever contains nested objects
 7262|       |  if (context->codec_params != NULL) {
 7263|       |    int rc;
 7264|       |    for (int i = 0; i < g_ncodecs; ++i) {
 7265|       |      if (g_codecs[i].compcode == context->compcode) {
 7266|       |        if (g_codecs[i].free == NULL) {
 7267|       |          // Dynamically load codec plugin
 7268|       |          if (fill_codec(&g_codecs[i]) < 0) {
 7269|       |            BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
 7270|       |            return BLOSC2_ERROR_CODEC_SUPPORT;
 7271|       |          }
 7272|       |        }
 7273|       |        if (g_codecs[i].free == NULL){
 7274|       |          // no free func, codec_params is simple
 7275|       |          my_free(context->codec_params);
 7276|       |        }
 7277|       |        else{ // has free function for codec_params (e.g. openzl)
 7278|       |        rc = g_codecs[i].free(context->codec_params);
 7279|       |          goto urcodecsuccess;
 7280|       |        }
 7281|       |      }
 7282|       |    }
 7283|       |      BLOSC_TRACE_ERROR("User-defined compressor codec %d not found", context->compcode);
 7284|       |      return BLOSC2_ERROR_CODEC_SUPPORT;
 7285|       |    urcodecsuccess:;
 7286|       |    if (rc < 0) {
 7287|       |      BLOSC_TRACE_ERROR("Error in user-defined codec free function\n");
 7288|       |      return;
 7289|       |    }
 7290|       |  }
 7291|       |  */
 7292|  3.09k|  if (context->prefilter != NULL) {
  ------------------
  |  Branch (7292:7): [True: 0, False: 3.09k]
  ------------------
 7293|      0|    my_free(context->preparams);
 7294|      0|  }
 7295|  3.09k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (7295:7): [True: 0, False: 3.09k]
  ------------------
 7296|      0|    my_free(context->postparams);
 7297|      0|  }
 7298|       |
 7299|  3.09k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (7299:7): [True: 0, False: 3.09k]
  ------------------
 7300|      0|    free(context->block_maskout);
 7301|      0|  }
 7302|  3.09k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (7302:7): [True: 1, False: 3.09k]
  ------------------
 7303|      1|    free(context->blocknbytes);
 7304|      1|  }
 7305|  3.09k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (7305:7): [True: 1, False: 3.09k]
  ------------------
 7306|      1|    free(context->blockoffsets);
 7307|      1|  }
 7308|  3.09k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (7308:7): [True: 1, False: 3.09k]
  ------------------
 7309|      1|    free(context->blockcbytes);
 7310|      1|  }
 7311|  3.09k|  my_free(context);
 7312|  3.09k|}
blosc2_ctx_get_cparams:
 7315|  2.01k|int blosc2_ctx_get_cparams(blosc2_context *ctx, blosc2_cparams *cparams) {
 7316|  2.01k|  cparams->compcode = ctx->compcode;
 7317|  2.01k|  cparams->compcode_meta = ctx->compcode_meta;
 7318|  2.01k|  cparams->clevel = ctx->clevel;
 7319|  2.01k|  cparams->use_dict = ctx->use_dict;
 7320|  2.01k|  cparams->instr_codec = ctx->blosc2_flags & BLOSC2_INSTR_CODEC;
 7321|  2.01k|  cparams->typesize = ctx->typesize;
 7322|  2.01k|  cparams->nthreads = ctx->nthreads;
 7323|  2.01k|  cparams->blocksize = ctx->blocksize;
 7324|  2.01k|  cparams->splitmode = ctx->splitmode;
 7325|  2.01k|  cparams->schunk = ctx->schunk;
 7326|  14.0k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; ++i) {
  ------------------
  |  Branch (7326:19): [True: 12.0k, False: 2.01k]
  ------------------
 7327|  12.0k|    cparams->filters[i] = ctx->filters[i];
 7328|  12.0k|    cparams->filters_meta[i] = ctx->filters_meta[i];
 7329|  12.0k|  }
 7330|  2.01k|  cparams->prefilter = ctx->prefilter;
 7331|  2.01k|  cparams->preparams = ctx->preparams;
 7332|  2.01k|  cparams->tuner_id = ctx->tuner_id;
 7333|  2.01k|  cparams->codec_params = ctx->codec_params;
 7334|       |
 7335|  2.01k|  return BLOSC2_ERROR_SUCCESS;
 7336|  2.01k|}
blosc2_ctx_get_dparams:
 7339|  2.20k|int blosc2_ctx_get_dparams(blosc2_context *ctx, blosc2_dparams *dparams) {
 7340|  2.20k|  dparams->nthreads = ctx->nthreads;
 7341|  2.20k|  dparams->schunk = ctx->schunk;
 7342|  2.20k|  dparams->postfilter = ctx->postfilter;
 7343|  2.20k|  dparams->postparams = ctx->postparams;
 7344|  2.20k|  dparams->typesize = ctx->typesize;
 7345|       |
 7346|  2.20k|  return BLOSC2_ERROR_SUCCESS;
 7347|  2.20k|}
blosc2_set_maskout:
 7360|  1.17k|int blosc2_set_maskout(blosc2_context *ctx, bool *maskout, int nblocks) {
 7361|       |  // Get rid of a possible mask here (also if the allocation below fails)
 7362|  1.17k|  ctx_clear_maskout(ctx);
 7363|       |
 7364|  1.17k|  bool *maskout_ = malloc(nblocks);
 7365|  1.17k|  BLOSC_ERROR_NULL(maskout_, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|  1.17k|    do {                                            \
  |  |  105|  1.17k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.17k]
  |  |  ------------------
  |  |  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.17k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.17k]
  |  |  ------------------
  ------------------
 7366|  1.17k|  memcpy(maskout_, maskout, nblocks);
 7367|  1.17k|  ctx->block_maskout = maskout_;
 7368|  1.17k|  ctx->block_maskout_nitems = nblocks;
 7369|       |
 7370|  1.17k|  return 0;
 7371|  1.17k|}
blosc2_chunk_zeros:
 7375|    746|int blosc2_chunk_zeros(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 7376|    746|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (7376:7): [True: 0, False: 746]
  ------------------
 7377|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7378|      0|    return BLOSC2_ERROR_DATA;
 7379|      0|  }
 7380|       |
 7381|    746|  if ((nbytes > 0) && (nbytes % cparams.typesize)) {
  ------------------
  |  Branch (7381:7): [True: 746, False: 0]
  |  Branch (7381:23): [True: 0, False: 746]
  ------------------
 7382|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7383|      0|    return BLOSC2_ERROR_DATA;
 7384|      0|  }
 7385|       |
 7386|    746|  blosc_header header;
 7387|    746|  blosc2_context* context = blosc2_create_cctx(cparams);
 7388|    746|  if (context == NULL) {
  ------------------
  |  Branch (7388:7): [True: 0, False: 746]
  ------------------
 7389|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7390|      0|    return BLOSC2_ERROR_NULL_POINTER;
 7391|      0|  }
 7392|       |
 7393|    746|  int error = initialize_context_compression(
 7394|    746|          context, NULL, nbytes, dest, destsize,
 7395|    746|          context->clevel, context->filters, context->filters_meta,
 7396|    746|          context->typesize, context->compcode, context->blocksize,
 7397|    746|          context->new_nthreads, context->nthreads, context->splitmode,
 7398|    746|          context->tuner_id, context->tuner_params, context->schunk);
 7399|    746|  if (error <= 0) {
  ------------------
  |  Branch (7399:7): [True: 0, False: 746]
  ------------------
 7400|      0|    blosc2_free_ctx(context);
 7401|      0|    return error;
 7402|      0|  }
 7403|       |
 7404|    746|  memset(&header, 0, sizeof(header));
 7405|    746|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 7406|    746|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 7407|    746|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 7408|    746|  header.typesize = context->typesize;
 7409|    746|  header.nbytes = (int32_t)nbytes;
 7410|    746|  header.blocksize = context->blocksize;
 7411|    746|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 7412|    746|  header.blosc2_flags = BLOSC2_SPECIAL_ZERO << 4;  // mark chunk as all zeros
 7413|    746|  memcpy((uint8_t *)dest, &header, sizeof(header));
 7414|       |
 7415|    746|  blosc2_free_ctx(context);
 7416|       |
 7417|    746|  return BLOSC_EXTENDED_HEADER_LENGTH;
 7418|    746|}
blosc2_chunk_repeatval:
 7516|     87|                           void* dest, int32_t destsize, const void* repeatval) {
 7517|     87|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH + cparams.typesize) {
  ------------------
  |  Branch (7517:7): [True: 0, False: 87]
  ------------------
 7518|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7519|      0|    return BLOSC2_ERROR_DATA;
 7520|      0|  }
 7521|       |
 7522|     87|  if (nbytes % cparams.typesize) {
  ------------------
  |  Branch (7522:7): [True: 0, False: 87]
  ------------------
 7523|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7524|      0|    return BLOSC2_ERROR_DATA;
 7525|      0|  }
 7526|       |
 7527|     87|  blosc_header header;
 7528|     87|  blosc2_context* context = blosc2_create_cctx(cparams);
 7529|     87|  if (context == NULL) {
  ------------------
  |  Branch (7529:7): [True: 0, False: 87]
  ------------------
 7530|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7531|      0|    return BLOSC2_ERROR_NULL_POINTER;
 7532|      0|  }
 7533|       |
 7534|     87|  int error = initialize_context_compression(
 7535|     87|          context, NULL, nbytes, dest, destsize,
 7536|     87|          context->clevel, context->filters, context->filters_meta,
 7537|     87|          context->typesize, context->compcode, context->blocksize,
 7538|     87|          context->new_nthreads, context->nthreads, context->splitmode,
 7539|     87|          context->tuner_id, context->tuner_params, context->schunk);
 7540|     87|  if (error <= 0) {
  ------------------
  |  Branch (7540:7): [True: 0, False: 87]
  ------------------
 7541|      0|    blosc2_free_ctx(context);
 7542|      0|    return error;
 7543|      0|  }
 7544|       |
 7545|     87|  memset(&header, 0, sizeof(header));
 7546|     87|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 7547|     87|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 7548|     87|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 7549|     87|  header.typesize = context->typesize;
 7550|     87|  header.nbytes = (int32_t)nbytes;
 7551|     87|  header.blocksize = context->blocksize;
 7552|     87|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH + cparams.typesize;
 7553|     87|  header.blosc2_flags = BLOSC2_SPECIAL_VALUE << 4;  // mark chunk as all repeated value
 7554|     87|  memcpy((uint8_t *)dest, &header, sizeof(header));
 7555|     87|  memcpy((uint8_t *)dest + sizeof(header), repeatval, cparams.typesize);
 7556|       |
 7557|     87|  blosc2_free_ctx(context);
 7558|       |
 7559|     87|  return BLOSC_EXTENDED_HEADER_LENGTH + cparams.typesize;
 7560|     87|}
register_filter_private:
 7565|  1.21k|int register_filter_private(blosc2_filter *filter) {
 7566|  1.21k|    BLOSC_ERROR_NULL(filter, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  1.21k|    do {                                            \
  |  |  105|  1.21k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 1.21k]
  |  |  ------------------
  |  |  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.21k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 1.21k]
  |  |  ------------------
  ------------------
 7567|  1.21k|    if (g_nfilters == UINT8_MAX) {
  ------------------
  |  Branch (7567:9): [True: 0, False: 1.21k]
  ------------------
 7568|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7569|      0|        return BLOSC2_ERROR_CODEC_SUPPORT;
 7570|      0|    }
 7571|  1.21k|    if (filter->id < BLOSC2_GLOBAL_REGISTERED_FILTERS_START) {
  ------------------
  |  Branch (7571:9): [True: 0, False: 1.21k]
  ------------------
 7572|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7573|      0|        return BLOSC2_ERROR_FAILURE;
 7574|      0|    }
 7575|       |    /* This condition can never be fulfilled
 7576|       |    if (filter->id > BLOSC2_USER_REGISTERED_FILTERS_STOP) {
 7577|       |        BLOSC_TRACE_ERROR("The id must be less than or equal to %d", BLOSC2_USER_REGISTERED_FILTERS_STOP);
 7578|       |        return BLOSC2_ERROR_FAILURE;
 7579|       |    }
 7580|       |    */
 7581|       |
 7582|  3.64k|    for (uint64_t i = 0; i < g_nfilters; ++i) {
  ------------------
  |  Branch (7582:26): [True: 2.43k, False: 1.21k]
  ------------------
 7583|  2.43k|      if (g_filters[i].id == filter->id) {
  ------------------
  |  Branch (7583:11): [True: 0, False: 2.43k]
  ------------------
 7584|      0|        if (strcmp(g_filters[i].name, filter->name) != 0) {
  ------------------
  |  Branch (7584:13): [True: 0, False: 0]
  ------------------
 7585|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7586|      0|                            "  Choose another one !", filter->id, g_filters[i].name);
 7587|      0|          return BLOSC2_ERROR_FAILURE;
 7588|      0|        }
 7589|      0|        else {
 7590|       |          // Already registered, so no more actions needed
 7591|      0|          return BLOSC2_ERROR_SUCCESS;
 7592|      0|        }
 7593|      0|      }
 7594|  2.43k|    }
 7595|       |
 7596|  1.21k|    blosc2_filter *filter_new = &g_filters[g_nfilters++];
 7597|  1.21k|    memcpy(filter_new, filter, sizeof(blosc2_filter));
 7598|       |
 7599|  1.21k|    return BLOSC2_ERROR_SUCCESS;
 7600|  1.21k|}
register_codec_private:
 7615|  2.18k|int register_codec_private(blosc2_codec *codec) {
 7616|  2.18k|    BLOSC_ERROR_NULL(codec, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  2.18k|    do {                                            \
  |  |  105|  2.18k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 2.18k]
  |  |  ------------------
  |  |  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|  2.18k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 2.18k]
  |  |  ------------------
  ------------------
 7617|  2.18k|    if (g_ncodecs == UINT8_MAX) {
  ------------------
  |  Branch (7617:9): [True: 0, False: 2.18k]
  ------------------
 7618|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7619|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 7620|      0|    }
 7621|  2.18k|    if (codec->compcode < BLOSC2_GLOBAL_REGISTERED_CODECS_START) {
  ------------------
  |  Branch (7621:9): [True: 0, False: 2.18k]
  ------------------
 7622|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7623|      0|      return BLOSC2_ERROR_FAILURE;
 7624|      0|    }
 7625|       |    /* This condition can never be fulfilled
 7626|       |    if (codec->compcode > BLOSC2_USER_REGISTERED_CODECS_STOP) {
 7627|       |      BLOSC_TRACE_ERROR("The id must be less or equal to %d", BLOSC2_USER_REGISTERED_CODECS_STOP);
 7628|       |      return BLOSC2_ERROR_FAILURE;
 7629|       |    }
 7630|       |     */
 7631|       |
 7632|  10.9k|    for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (7632:21): [True: 8.74k, False: 2.18k]
  ------------------
 7633|  8.74k|      if (g_codecs[i].compcode == codec->compcode) {
  ------------------
  |  Branch (7633:11): [True: 0, False: 8.74k]
  ------------------
 7634|      0|        if (strcmp(g_codecs[i].compname, codec->compname) != 0) {
  ------------------
  |  Branch (7634:13): [True: 0, False: 0]
  ------------------
 7635|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7636|      0|                            "  Choose another one !", codec->compcode, codec->compname);
 7637|      0|          return BLOSC2_ERROR_CODEC_PARAM;
 7638|      0|        }
 7639|      0|        else {
 7640|       |          // Already registered, so no more actions needed
 7641|      0|          return BLOSC2_ERROR_SUCCESS;
 7642|      0|        }
 7643|      0|      }
 7644|  8.74k|    }
 7645|       |
 7646|  2.18k|    blosc2_codec *codec_new = &g_codecs[g_ncodecs++];
 7647|  2.18k|    memcpy(codec_new, codec, sizeof(blosc2_codec));
 7648|       |
 7649|  2.18k|    return BLOSC2_ERROR_SUCCESS;
 7650|  2.18k|}
register_tuner_private:
 7665|    243|int register_tuner_private(blosc2_tuner *tuner) {
 7666|    243|  BLOSC_ERROR_NULL(tuner, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|    243|    do {                                            \
  |  |  105|    243|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 243]
  |  |  ------------------
  |  |  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|    243|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 243]
  |  |  ------------------
  ------------------
 7667|    243|  if (g_ntuners == UINT8_MAX) {
  ------------------
  |  Branch (7667:7): [True: 0, False: 243]
  ------------------
 7668|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7669|      0|    return BLOSC2_ERROR_CODEC_SUPPORT;
 7670|      0|  }
 7671|    243|  if (tuner->id < BLOSC2_GLOBAL_REGISTERED_TUNER_START) {
  ------------------
  |  Branch (7671:7): [True: 0, False: 243]
  ------------------
 7672|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7673|      0|    return BLOSC2_ERROR_FAILURE;
 7674|      0|  }
 7675|       |
 7676|    243|  for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (7676:19): [True: 0, False: 243]
  ------------------
 7677|      0|    if (g_tuners[i].id == tuner->id) {
  ------------------
  |  Branch (7677:9): [True: 0, False: 0]
  ------------------
 7678|      0|      if (strcmp(g_tuners[i].name, tuner->name) != 0) {
  ------------------
  |  Branch (7678:11): [True: 0, False: 0]
  ------------------
 7679|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7680|      0|                          "  Choose another one !", tuner->id, g_tuners[i].name);
 7681|      0|        return BLOSC2_ERROR_FAILURE;
 7682|      0|      }
 7683|      0|      else {
 7684|       |        // Already registered, so no more actions needed
 7685|      0|        return BLOSC2_ERROR_SUCCESS;
 7686|      0|      }
 7687|      0|    }
 7688|      0|  }
 7689|       |
 7690|    243|  blosc2_tuner *tuner_new = &g_tuners[g_ntuners++];
 7691|    243|  memcpy(tuner_new, tuner, sizeof(blosc2_tuner));
 7692|       |
 7693|    243|  return BLOSC2_ERROR_SUCCESS;
 7694|    243|}
_blosc2_register_io_cb:
 7707|    486|int _blosc2_register_io_cb(const blosc2_io_cb *io) {
 7708|       |
 7709|    729|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (7709:24): [True: 727, False: 2]
  ------------------
 7710|    727|    if (g_ios[i].id == io->id) {
  ------------------
  |  Branch (7710:9): [True: 484, False: 243]
  ------------------
 7711|    484|      if (strcmp(g_ios[i].name, io->name) != 0) {
  ------------------
  |  Branch (7711:11): [True: 0, False: 484]
  ------------------
 7712|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7713|      0|                          "  Choose another one !", io->id, g_ios[i].name);
 7714|      0|        return BLOSC2_ERROR_PLUGIN_IO;
 7715|      0|      }
 7716|    484|      else {
 7717|       |        // Already registered, so no more actions needed
 7718|    484|        return BLOSC2_ERROR_SUCCESS;
 7719|    484|      }
 7720|    484|    }
 7721|    727|  }
 7722|       |
 7723|      2|  blosc2_io_cb *io_new = &g_ios[g_nio++];
 7724|      2|  memcpy(io_new, io, sizeof(blosc2_io_cb));
 7725|       |
 7726|      2|  return BLOSC2_ERROR_SUCCESS;
 7727|    486|}
blosc2_get_io_cb:
 7744|  8.89k|blosc2_io_cb *blosc2_get_io_cb(uint8_t id) {
 7745|       |  // If g_initlib is not set by blosc2_init() this function will try to read
 7746|       |  // uninitialized memory. We should therefore always return NULL in that case
 7747|  8.89k|  if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  142|  8.89k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  104|  8.89k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7747:7): [True: 0, False: 8.89k]
  ------------------
 7748|      0|    return NULL;
 7749|      0|  }
 7750|  8.89k|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (7750:24): [True: 8.89k, False: 0]
  ------------------
 7751|  8.89k|    if (g_ios[i].id == id) {
  ------------------
  |  Branch (7751:9): [True: 8.89k, False: 0]
  ------------------
 7752|  8.89k|      return &g_ios[i];
 7753|  8.89k|    }
 7754|  8.89k|  }
 7755|      0|  if (id == BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (7755:7): [True: 0, False: 0]
  ------------------
 7756|      0|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS) < 0) {
  ------------------
  |  Branch (7756:9): [True: 0, False: 0]
  ------------------
 7757|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7758|      0|      return NULL;
 7759|      0|    }
 7760|      0|    return blosc2_get_io_cb(id);
 7761|      0|  }
 7762|      0|  else if (id == BLOSC2_IO_FILESYSTEM_MMAP) {
  ------------------
  |  Branch (7762:12): [True: 0, False: 0]
  ------------------
 7763|      0|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP) < 0) {
  ------------------
  |  Branch (7763:9): [True: 0, False: 0]
  ------------------
 7764|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7765|      0|      return NULL;
 7766|      0|    }
 7767|      0|    return blosc2_get_io_cb(id);
 7768|      0|  }
 7769|      0|  return NULL;
 7770|      0|}
blosc2_unidim_to_multidim:
 7772|  78.1k|void blosc2_unidim_to_multidim(uint8_t ndim, int64_t *shape, int64_t i, int64_t *index) {
 7773|  78.1k|  if (ndim == 0) {
  ------------------
  |  Branch (7773:7): [True: 0, False: 78.1k]
  ------------------
 7774|      0|    return;
 7775|      0|  }
 7776|  78.1k|  assert(ndim <= B2ND_MAX_DIM);
 7777|  78.1k|  int64_t strides[B2ND_MAX_DIM];
 7778|       |
 7779|  78.1k|  strides[ndim - 1] = 1;
 7780|   288k|  for (int j = ndim - 2; j >= 0; --j) {
  ------------------
  |  Branch (7780:26): [True: 210k, False: 78.1k]
  ------------------
 7781|   210k|      strides[j] = shape[j + 1] * strides[j + 1];
 7782|   210k|  }
 7783|       |
 7784|  78.1k|  index[0] = i / strides[0];
 7785|   288k|  for (int j = 1; j < ndim; ++j) {
  ------------------
  |  Branch (7785:19): [True: 210k, False: 78.1k]
  ------------------
 7786|   210k|      index[j] = (i % strides[j - 1]) / strides[j];
 7787|   210k|  }
 7788|  78.1k|}
blosc2_multidim_to_unidim:
 7790|  3.02k|void blosc2_multidim_to_unidim(const int64_t *index, int8_t ndim, const int64_t *strides, int64_t *i) {
 7791|  3.02k|  *i = 0;
 7792|  14.4k|  for (int j = 0; j < ndim; ++j) {
  ------------------
  |  Branch (7792:19): [True: 11.4k, False: 3.02k]
  ------------------
 7793|  11.4k|    *i += index[j] * strides[j];
 7794|  11.4k|  }
 7795|  3.02k|}
blosc2_error_string:
 7842|      9|const char *blosc2_error_string(int error_code) {
 7843|      9|  switch (error_code) {
 7844|      8|    case BLOSC2_ERROR_FAILURE:
  ------------------
  |  Branch (7844:5): [True: 8, False: 1]
  ------------------
 7845|      8|      return "Generic failure";
 7846|      0|    case BLOSC2_ERROR_STREAM:
  ------------------
  |  Branch (7846:5): [True: 0, False: 9]
  ------------------
 7847|      0|      return "Bad stream";
 7848|      1|    case BLOSC2_ERROR_DATA:
  ------------------
  |  Branch (7848:5): [True: 1, False: 8]
  ------------------
 7849|      1|      return "Invalid data";
 7850|      0|    case BLOSC2_ERROR_MEMORY_ALLOC:
  ------------------
  |  Branch (7850:5): [True: 0, False: 9]
  ------------------
 7851|      0|      return "Memory alloc/realloc failure";
 7852|      0|    case BLOSC2_ERROR_READ_BUFFER:
  ------------------
  |  Branch (7852:5): [True: 0, False: 9]
  ------------------
 7853|      0|      return "Not enough space to read";
 7854|      0|    case BLOSC2_ERROR_WRITE_BUFFER:
  ------------------
  |  Branch (7854:5): [True: 0, False: 9]
  ------------------
 7855|      0|      return "Not enough space to write";
 7856|      0|    case BLOSC2_ERROR_CODEC_SUPPORT:
  ------------------
  |  Branch (7856:5): [True: 0, False: 9]
  ------------------
 7857|      0|      return "Codec not supported";
 7858|      0|    case BLOSC2_ERROR_CODEC_PARAM:
  ------------------
  |  Branch (7858:5): [True: 0, False: 9]
  ------------------
 7859|      0|      return "Invalid parameter supplied to codec";
 7860|      0|    case BLOSC2_ERROR_CODEC_DICT:
  ------------------
  |  Branch (7860:5): [True: 0, False: 9]
  ------------------
 7861|      0|      return "Codec dictionary error";
 7862|      0|    case BLOSC2_ERROR_VERSION_SUPPORT:
  ------------------
  |  Branch (7862:5): [True: 0, False: 9]
  ------------------
 7863|      0|      return "Version not supported";
 7864|      0|    case BLOSC2_ERROR_INVALID_HEADER:
  ------------------
  |  Branch (7864:5): [True: 0, False: 9]
  ------------------
 7865|      0|      return "Invalid value in header";
 7866|      0|    case BLOSC2_ERROR_INVALID_PARAM:
  ------------------
  |  Branch (7866:5): [True: 0, False: 9]
  ------------------
 7867|      0|      return "Invalid parameter supplied to function";
 7868|      0|    case BLOSC2_ERROR_FILE_READ:
  ------------------
  |  Branch (7868:5): [True: 0, False: 9]
  ------------------
 7869|      0|      return "File read failure";
 7870|      0|    case BLOSC2_ERROR_FILE_WRITE:
  ------------------
  |  Branch (7870:5): [True: 0, False: 9]
  ------------------
 7871|      0|      return "File write failure";
 7872|      0|    case BLOSC2_ERROR_FILE_OPEN:
  ------------------
  |  Branch (7872:5): [True: 0, False: 9]
  ------------------
 7873|      0|      return "File open failure";
 7874|      0|    case BLOSC2_ERROR_NOT_FOUND:
  ------------------
  |  Branch (7874:5): [True: 0, False: 9]
  ------------------
 7875|      0|      return "Not found";
 7876|      0|    case BLOSC2_ERROR_RUN_LENGTH:
  ------------------
  |  Branch (7876:5): [True: 0, False: 9]
  ------------------
 7877|      0|      return "Bad run length encoding";
 7878|      0|    case BLOSC2_ERROR_FILTER_PIPELINE:
  ------------------
  |  Branch (7878:5): [True: 0, False: 9]
  ------------------
 7879|      0|      return "Filter pipeline error";
 7880|      0|    case BLOSC2_ERROR_CHUNK_INSERT:
  ------------------
  |  Branch (7880:5): [True: 0, False: 9]
  ------------------
 7881|      0|      return "Chunk insert failure";
 7882|      0|    case BLOSC2_ERROR_CHUNK_APPEND:
  ------------------
  |  Branch (7882:5): [True: 0, False: 9]
  ------------------
 7883|      0|      return "Chunk append failure";
 7884|      0|    case BLOSC2_ERROR_CHUNK_UPDATE:
  ------------------
  |  Branch (7884:5): [True: 0, False: 9]
  ------------------
 7885|      0|      return "Chunk update failure";
 7886|      0|    case BLOSC2_ERROR_2GB_LIMIT:
  ------------------
  |  Branch (7886:5): [True: 0, False: 9]
  ------------------
 7887|      0|      return "Sizes larger than 2gb not supported";
 7888|      0|    case BLOSC2_ERROR_SCHUNK_COPY:
  ------------------
  |  Branch (7888:5): [True: 0, False: 9]
  ------------------
 7889|      0|      return "Super-chunk copy failure";
 7890|      0|    case BLOSC2_ERROR_FRAME_TYPE:
  ------------------
  |  Branch (7890:5): [True: 0, False: 9]
  ------------------
 7891|      0|      return "Wrong type for frame";
 7892|      0|    case BLOSC2_ERROR_FILE_TRUNCATE:
  ------------------
  |  Branch (7892:5): [True: 0, False: 9]
  ------------------
 7893|      0|      return "File truncate failure";
 7894|      0|    case BLOSC2_ERROR_LOCK:
  ------------------
  |  Branch (7894:5): [True: 0, False: 9]
  ------------------
 7895|      0|      return "Frame lock failure";
 7896|      0|    case BLOSC2_ERROR_THREAD_CREATE:
  ------------------
  |  Branch (7896:5): [True: 0, False: 9]
  ------------------
 7897|      0|      return "Thread or thread context creation failure";
 7898|      0|    case BLOSC2_ERROR_POSTFILTER:
  ------------------
  |  Branch (7898:5): [True: 0, False: 9]
  ------------------
 7899|      0|      return "Postfilter failure";
 7900|      0|    case BLOSC2_ERROR_FRAME_SPECIAL:
  ------------------
  |  Branch (7900:5): [True: 0, False: 9]
  ------------------
 7901|      0|      return "Special frame failure";
 7902|      0|    case BLOSC2_ERROR_SCHUNK_SPECIAL:
  ------------------
  |  Branch (7902:5): [True: 0, False: 9]
  ------------------
 7903|      0|      return "Special super-chunk failure";
 7904|      0|    case BLOSC2_ERROR_PLUGIN_IO:
  ------------------
  |  Branch (7904:5): [True: 0, False: 9]
  ------------------
 7905|      0|      return "IO plugin error";
 7906|      0|    case BLOSC2_ERROR_FILE_REMOVE:
  ------------------
  |  Branch (7906:5): [True: 0, False: 9]
  ------------------
 7907|      0|      return "Remove file failure";
 7908|      0|    case BLOSC2_ERROR_NULL_POINTER:
  ------------------
  |  Branch (7908:5): [True: 0, False: 9]
  ------------------
 7909|      0|      return "Pointer is null";
 7910|      0|    case BLOSC2_ERROR_INVALID_INDEX:
  ------------------
  |  Branch (7910:5): [True: 0, False: 9]
  ------------------
 7911|      0|      return "Invalid index";
 7912|      0|    case BLOSC2_ERROR_METALAYER_NOT_FOUND:
  ------------------
  |  Branch (7912:5): [True: 0, False: 9]
  ------------------
 7913|      0|      return "Metalayer has not been found";
 7914|      0|    case BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED:
  ------------------
  |  Branch (7914:5): [True: 0, False: 9]
  ------------------
 7915|      0|      return "Maximum buffersize exceeded";
 7916|      0|    case BLOSC2_ERROR_TUNER:
  ------------------
  |  Branch (7916:5): [True: 0, False: 9]
  ------------------
 7917|      0|      return "Tuner failure";
 7918|      0|    default:
  ------------------
  |  Branch (7918:5): [True: 0, False: 9]
  ------------------
 7919|      0|      return "Unknown error";
 7920|      9|  }
 7921|      9|}
blosc2.c:shuffle_size:
  773|  22.0k|static int32_t shuffle_size(const blosc2_context* context, int i) {
  774|  22.0k|  return context->filters_meta[i] == 0 ? context->typesize : context->filters_meta[i];
  ------------------
  |  Branch (774:10): [True: 12.1k, False: 9.90k]
  ------------------
  775|  22.0k|}
blosc2.c:flags_to_filters:
  857|  47.1k|static void flags_to_filters(const uint8_t flags, uint8_t* filters) {
  858|       |  /* Initialize the filter pipeline */
  859|  47.1k|  memset(filters, 0, BLOSC2_MAX_FILTERS);
  860|       |  /* Fill the filter pipeline */
  861|  47.1k|  if (flags & BLOSC_DOSHUFFLE)
  ------------------
  |  Branch (861:7): [True: 46.7k, False: 435]
  ------------------
  862|  46.7k|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
  863|  47.1k|  if (flags & BLOSC_DOBITSHUFFLE)
  ------------------
  |  Branch (863:7): [True: 46.9k, False: 285]
  ------------------
  864|  46.9k|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
  865|  47.1k|  if (flags & BLOSC_DODELTA)
  ------------------
  |  Branch (865:7): [True: 18.0k, False: 29.1k]
  ------------------
  866|  18.0k|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
  867|  47.1k|}
blosc2.c:_cycle_buffers_forward:
 1293|  13.6k|                                   const uint8_t *input) {
 1294|  13.6k|  uint8_t *prev_src = *src;
 1295|  13.6k|  *src = *dest;
 1296|  13.6k|  *dest = (prev_src == input) ? *tmp : prev_src;
  ------------------
  |  Branch (1296:11): [True: 7.63k, False: 5.98k]
  ------------------
 1297|  13.6k|}
blosc2.c:fused_shuffle_bytedelta_size:
  781|  18.5k|static int fused_shuffle_bytedelta_size(const blosc2_context *context, int i) {
  782|  18.5k|  if (i < 0 || i + 1 >= BLOSC2_MAX_FILTERS || context->filters[i] != BLOSC_SHUFFLE ||
  ------------------
  |  Branch (782:7): [True: 0, False: 18.5k]
  |  Branch (782:16): [True: 7.63k, False: 10.9k]
  |  Branch (782:47): [True: 10.9k, False: 0]
  ------------------
  783|  18.5k|      context->filters[i + 1] != BLOSC_FILTER_BYTEDELTA) {
  ------------------
  |  Branch (783:7): [True: 0, False: 0]
  ------------------
  784|  18.5k|    return 0;
  785|  18.5k|  }
  786|      0|  int delta_size = context->filters_meta[i + 1];
  787|      0|  if (delta_size == 0 && context->schunk != NULL) {
  ------------------
  |  Branch (787:7): [True: 0, False: 0]
  |  Branch (787:26): [True: 0, False: 0]
  ------------------
  788|      0|    delta_size = context->schunk->typesize;
  789|      0|  }
  790|      0|  int size = shuffle_size(context, i);
  791|      0|  return (size == 2 || size == 4 || size == 8) && size == delta_size &&
  ------------------
  |  Branch (791:11): [True: 0, False: 0]
  |  Branch (791:24): [True: 0, False: 0]
  |  Branch (791:37): [True: 0, False: 0]
  |  Branch (791:51): [True: 0, False: 0]
  ------------------
  792|      0|         shuffle_bytedelta_available() ? size : 0;
  ------------------
  |  Branch (792:10): [True: 0, False: 0]
  ------------------
  793|  18.5k|}
blosc2.c:bitshuffle_scratch:
 1304|  6.96k|static uint8_t* bitshuffle_scratch(struct thread_context* thread_context, int32_t bsize) {
 1305|  6.96k|  size_t offset = (size_t)(thread_context->tmp4 - thread_context->tmp);
 1306|  6.96k|  size_t shift = (16 - ((uintptr_t)thread_context->tmp4 & 15)) & 15;
 1307|  6.96k|  if (offset + shift + (size_t)bsize <= thread_context->tmp_nbytes) {
  ------------------
  |  Branch (1307:7): [True: 6.95k, False: 1]
  ------------------
 1308|  6.95k|    return thread_context->tmp4 + shift;
 1309|  6.95k|  }
 1310|      1|  if (offset + (size_t)bsize <= thread_context->tmp_nbytes) {
  ------------------
  |  Branch (1310:7): [True: 1, False: 0]
  ------------------
 1311|      1|    return thread_context->tmp4;
 1312|      1|  }
 1313|      0|  return NULL;
 1314|      1|}
blosc2.c:destroy_thread_context:
 2629|    188|static void destroy_thread_context(struct thread_context* thread_context) {
 2630|    188|  my_free(thread_context->tmp);
 2631|    188|  free(thread_context->blosclz_state);
 2632|    188|#if defined(HAVE_ZSTD)
 2633|    188|  if (thread_context->zstd_cctx != NULL) {
  ------------------
  |  Branch (2633:7): [True: 38, False: 150]
  ------------------
 2634|     38|    ZSTD_freeCCtx(thread_context->zstd_cctx);
 2635|     38|  }
 2636|    188|  if (thread_context->zstd_dctx != NULL) {
  ------------------
  |  Branch (2636:7): [True: 61, False: 127]
  ------------------
 2637|     61|    ZSTD_freeDCtx(thread_context->zstd_dctx);
 2638|     61|  }
 2639|    188|#endif
 2640|    188|  if (thread_context->lz4_cstream != NULL) {
  ------------------
  |  Branch (2640:7): [True: 4, False: 184]
  ------------------
 2641|      4|    LZ4_freeStream((LZ4_stream_t*)thread_context->lz4_cstream);
 2642|      4|  }
 2643|    188|  if (thread_context->lz4hc_cstream != NULL) {
  ------------------
  |  Branch (2643:7): [True: 0, False: 188]
  ------------------
 2644|      0|    LZ4_freeStreamHC((LZ4_streamHC_t*)thread_context->lz4hc_cstream);
 2645|      0|  }
 2646|    188|}
blosc2.c:my_free:
  394|  3.48k|static void my_free(void* block) {
  395|       |#if defined(_WIN32)
  396|       |  _aligned_free(block);
  397|       |#else
  398|  3.48k|  free(block);
  399|  3.48k|#endif  /* _WIN32 */
  400|  3.48k|}
blosc2.c:initialize_context_compression:
 2819|  2.04k|        blosc2_schunk* schunk) {
 2820|       |
 2821|       |  /* The block size and the filters divide by the typesize */
 2822|  2.04k|  if (typesize <= 0) {
  ------------------
  |  Branch (2822:7): [True: 0, False: 2.04k]
  ------------------
 2823|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2824|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2825|      0|  }
 2826|       |
 2827|       |  /* Check typesize limits */
 2828|  2.04k|  if (typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (2828:7): [True: 0, False: 2.04k]
  ------------------
 2829|       |    // If typesize is too large for Blosc2, return an error
 2830|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2831|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2832|      0|  }
 2833|       |  /* Now, cap typesize so that blosc2 split machinery can continue to work.  This has to be
 2834|       |     done before the tuner chooses the block size, which depends on the typesize: a buffer
 2835|       |     with a larger typesize is a plain stream of bytes and is blocked as one. */
 2836|  2.04k|  if (typesize > BLOSC_MAX_TYPESIZE) {
  ------------------
  |  Branch (2836:7): [True: 0, False: 2.04k]
  ------------------
 2837|       |    /* If typesize is too large, treat buffer as an 1-byte stream. */
 2838|      0|    typesize = 1;
 2839|      0|  }
 2840|       |
 2841|       |  /* Set parameters */
 2842|  2.04k|  context->do_compress = 1;
 2843|  2.04k|  context->src = (const uint8_t*)src;
 2844|  2.04k|  context->srcsize = srcsize;
 2845|  2.04k|  context->dest = (uint8_t*)dest;
 2846|  2.04k|  context->output_bytes = 0;
 2847|  2.04k|  context->destsize = destsize;
 2848|  2.04k|  context->sourcesize = srcsize;
 2849|  2.04k|  context->typesize = typesize;
 2850|  2.04k|  context->filter_flags = filters_to_flags(filters);
 2851|  14.3k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (2851:19): [True: 12.2k, False: 2.04k]
  ------------------
 2852|  12.2k|    context->filters[i] = filters[i];
 2853|  12.2k|    context->filters_meta[i] = filters_meta[i];
 2854|  12.2k|  }
 2855|  2.04k|  context->compcode = compressor;
 2856|  2.04k|  context->nthreads = nthreads;
 2857|  2.04k|  context->new_nthreads = new_nthreads;
 2858|  2.04k|  context->clevel = clevel;
 2859|  2.04k|  context->schunk = schunk;
 2860|  2.04k|  context->tuner_params = tuner_params;
 2861|  2.04k|  context->tuner_id = tuner_id;
 2862|  2.04k|  context->splitmode = splitmode;
 2863|  2.04k|  context->blosc2_flags2 = 0;
 2864|  2.04k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (2864:7): [True: 0, False: 2.04k]
  ------------------
 2865|      0|    free(context->blocknbytes);
 2866|      0|    context->blocknbytes = NULL;
 2867|      0|  }
 2868|  2.04k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (2868:7): [True: 0, False: 2.04k]
  ------------------
 2869|      0|    free(context->blockoffsets);
 2870|      0|    context->blockoffsets = NULL;
 2871|      0|  }
 2872|  2.04k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (2872:7): [True: 0, False: 2.04k]
  ------------------
 2873|      0|    free(context->blockcbytes);
 2874|      0|    context->blockcbytes = NULL;
 2875|      0|  }
 2876|  2.04k|  context->vlblock_sources = NULL;
 2877|  2.04k|  context->vlblock_dests = NULL;
 2878|       |  /* tuner some compression parameters */
 2879|  2.04k|  context->blocksize = (int32_t)blocksize;
 2880|  2.04k|  int rc = 0;
 2881|  2.04k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (2881:7): [True: 0, False: 2.04k]
  ------------------
 2882|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2882:9): [True: 0, False: 0]
  |  Branch (2882:49): [True: 0, False: 0]
  ------------------
 2883|      0|      if (blosc_stune_next_cparams(context) < 0) {
  ------------------
  |  Branch (2883:11): [True: 0, False: 0]
  ------------------
 2884|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2885|      0|        return BLOSC2_ERROR_TUNER;
 2886|      0|      }
 2887|      0|    } else {
 2888|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2888:23): [True: 0, False: 0]
  ------------------
 2889|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2889:13): [True: 0, False: 0]
  ------------------
 2890|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2890:15): [True: 0, False: 0]
  ------------------
 2891|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2891:17): [True: 0, False: 0]
  ------------------
 2892|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2893|      0|              return BLOSC2_ERROR_FAILURE;
 2894|      0|            }
 2895|      0|          }
 2896|      0|          if (g_tuners[i].next_cparams(context) < 0) {
  ------------------
  |  Branch (2896:15): [True: 0, False: 0]
  ------------------
 2897|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2898|      0|            return BLOSC2_ERROR_TUNER;
 2899|      0|          }
 2900|      0|          if (g_tuners[i].id == BLOSC_BTUNE && context->blocksize == 0) {
  ------------------
  |  Branch (2900:15): [True: 0, False: 0]
  |  Branch (2900:48): [True: 0, False: 0]
  ------------------
 2901|       |            // Call stune for initializing blocksize
 2902|      0|            if (blosc_stune_next_blocksize(context) < 0) {
  ------------------
  |  Branch (2902:17): [True: 0, False: 0]
  ------------------
 2903|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2904|      0|              return BLOSC2_ERROR_TUNER;
 2905|      0|            }
 2906|      0|          }
 2907|      0|          goto urtunersuccess;
 2908|      0|        }
 2909|      0|      }
 2910|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2911|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2912|      0|    }
 2913|  2.04k|  } else {
 2914|  2.04k|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|  2.04k|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2914:9): [True: 2.04k, False: 0]
  |  Branch (2914:49): [True: 2.04k, False: 0]
  ------------------
 2915|  2.04k|      rc = blosc_stune_next_blocksize(context);
 2916|  2.04k|    } else {
 2917|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2917:23): [True: 0, False: 0]
  ------------------
 2918|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2918:13): [True: 0, False: 0]
  ------------------
 2919|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2919:15): [True: 0, False: 0]
  ------------------
 2920|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2920:17): [True: 0, False: 0]
  ------------------
 2921|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2922|      0|              return BLOSC2_ERROR_FAILURE;
 2923|      0|            }
 2924|      0|          }
 2925|      0|          rc = g_tuners[i].next_blocksize(context);
 2926|      0|          goto urtunersuccess;
 2927|      0|        }
 2928|      0|      }
 2929|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2930|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2931|      0|    }
 2932|  2.04k|  }
 2933|  2.04k|  urtunersuccess:;
 2934|  2.04k|  if (rc < 0) {
  ------------------
  |  Branch (2934:7): [True: 0, False: 2.04k]
  ------------------
 2935|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2936|      0|    return BLOSC2_ERROR_TUNER;
 2937|      0|  }
 2938|       |  /* The header must record the block size that the tuner settled on (it rounds a requested
 2939|       |     one to a multiple of the typesize, for instance), not the one that was asked for: a reader
 2940|       |     splits the chunk into blocks of the size in the header.  Variable-length block chunks
 2941|       |     store something else there and set it themselves. */
 2942|  2.04k|  context->header_blocksize = context->blocksize;
 2943|       |
 2944|       |
 2945|       |  /* Check buffer size limits */
 2946|  2.04k|  if (srcsize > BLOSC2_MAX_BUFFERSIZE) {
  ------------------
  |  Branch (2946:7): [True: 0, False: 2.04k]
  ------------------
 2947|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2948|      0|                      BLOSC2_MAX_BUFFERSIZE);
 2949|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 2950|      0|  }
 2951|       |
 2952|  2.04k|  if (destsize < BLOSC2_MAX_OVERHEAD) {
  ------------------
  |  Branch (2952:7): [True: 0, False: 2.04k]
  ------------------
 2953|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2954|      0|                      BLOSC2_MAX_OVERHEAD);
 2955|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 2956|      0|  }
 2957|       |
 2958|       |  /* Compression level */
 2959|  2.04k|  if (clevel < 0 || clevel > 9) {
  ------------------
  |  Branch (2959:7): [True: 0, False: 2.04k]
  |  Branch (2959:21): [True: 0, False: 2.04k]
  ------------------
 2960|       |    /* If clevel not in 0..9, print an error */
 2961|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2962|      0|    return BLOSC2_ERROR_CODEC_PARAM;
 2963|      0|  }
 2964|       |
 2965|       |  /* Dictionary support is only available for ZSTD, LZ4, and LZ4HC.
 2966|       |   * Skip the check when src is NULL (special-value chunks): no compression
 2967|       |   * will actually happen, so codec compatibility is irrelevant. */
 2968|  2.04k|  if (src != NULL && context->use_dict && context->compcode != BLOSC_ZSTD &&
  ------------------
  |  Branch (2968:7): [True: 1.21k, False: 833]
  |  Branch (2968:22): [True: 0, False: 1.21k]
  |  Branch (2968:43): [True: 0, False: 0]
  ------------------
 2969|      0|      context->compcode != BLOSC_LZ4 && context->compcode != BLOSC_LZ4HC) {
  ------------------
  |  Branch (2969:7): [True: 0, False: 0]
  |  Branch (2969:41): [True: 0, False: 0]
  ------------------
 2970|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2971|      0|    return BLOSC2_ERROR_CODEC_PARAM;
 2972|      0|  }
 2973|       |
 2974|  2.04k|  blosc2_calculate_blocks(context);
 2975|       |
 2976|  2.04k|  return 1;
 2977|  2.04k|}
blosc2.c:filters_to_flags:
  834|  6.60k|static uint8_t filters_to_flags(const uint8_t* filters) {
  835|  6.60k|  uint8_t flags = 0;
  836|       |
  837|  46.2k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (837:19): [True: 39.6k, False: 6.60k]
  ------------------
  838|  39.6k|    switch (filters[i]) {
  839|  4.87k|      case BLOSC_SHUFFLE:
  ------------------
  |  Branch (839:7): [True: 4.87k, False: 34.7k]
  ------------------
  840|  4.87k|        flags |= BLOSC_DOSHUFFLE;
  841|  4.87k|        break;
  842|    659|      case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (842:7): [True: 659, False: 38.9k]
  ------------------
  843|    659|        flags |= BLOSC_DOBITSHUFFLE;
  844|    659|        break;
  845|    241|      case BLOSC_DELTA:
  ------------------
  |  Branch (845:7): [True: 241, False: 39.3k]
  ------------------
  846|    241|        flags |= BLOSC_DODELTA;
  847|    241|        break;
  848|  33.8k|      default :
  ------------------
  |  Branch (848:7): [True: 33.8k, False: 5.77k]
  ------------------
  849|  33.8k|        break;
  850|  39.6k|    }
  851|  39.6k|  }
  852|  6.60k|  return flags;
  853|  6.60k|}
blosc2.c:blosc2_calculate_blocks:
 1024|  6.69k|static inline void blosc2_calculate_blocks(blosc2_context* context) {
 1025|       |  /* Compute number of blocks in buffer */
 1026|  6.69k|  context->nblocks = context->sourcesize / context->blocksize;
 1027|  6.69k|  context->leftover = context->sourcesize % context->blocksize;
 1028|  6.69k|  context->nblocks = (context->leftover > 0) ?
  ------------------
  |  Branch (1028:22): [True: 35, False: 6.65k]
  ------------------
 1029|  6.65k|                     (context->nblocks + 1) : context->nblocks;
 1030|  6.69k|}
blosc2.c:blosc1_format_check:
 3612|  1.21k|static int blosc1_format_check(const blosc2_context* context) {
 3613|  1.21k|  if (!context->blosc1_format) {
  ------------------
  |  Branch (3613:7): [True: 1.21k, False: 0]
  ------------------
 3614|  1.21k|    return BLOSC2_ERROR_SUCCESS;
 3615|  1.21k|  }
 3616|      0|  switch (context->compcode) {
 3617|      0|    case BLOSC_BLOSCLZ:
  ------------------
  |  Branch (3617:5): [True: 0, False: 0]
  ------------------
 3618|      0|    case BLOSC_LZ4:
  ------------------
  |  Branch (3618:5): [True: 0, False: 0]
  ------------------
 3619|      0|    case BLOSC_LZ4HC:
  ------------------
  |  Branch (3619:5): [True: 0, False: 0]
  ------------------
 3620|      0|    case BLOSC_ZLIB:
  ------------------
  |  Branch (3620:5): [True: 0, False: 0]
  ------------------
 3621|      0|    case BLOSC_ZSTD:
  ------------------
  |  Branch (3621:5): [True: 0, False: 0]
  ------------------
 3622|      0|      break;
 3623|      0|    default:
  ------------------
  |  Branch (3623:5): [True: 0, False: 0]
  ------------------
 3624|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3625|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 3626|      0|  }
 3627|       |  /* The Blosc1 header only has flags for a shuffle or a bitshuffle, so the pipeline can have
 3628|       |     one of those and nothing else, in any of its slots. */
 3629|      0|  int nfilters = 0;
 3630|      0|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (3630:19): [True: 0, False: 0]
  ------------------
 3631|      0|    uint8_t filter = context->filters[i];
 3632|      0|    if (filter == BLOSC_NOFILTER) {
  ------------------
  |  Branch (3632:9): [True: 0, False: 0]
  ------------------
 3633|      0|      continue;
 3634|      0|    }
 3635|      0|    bool plain_shuffle = (filter == BLOSC_SHUFFLE || filter == BLOSC_BITSHUFFLE) &&
  ------------------
  |  Branch (3635:27): [True: 0, False: 0]
  |  Branch (3635:54): [True: 0, False: 0]
  ------------------
 3636|      0|                         context->filters_meta[i] == 0;
  ------------------
  |  Branch (3636:26): [True: 0, False: 0]
  ------------------
 3637|      0|    if (!plain_shuffle || ++nfilters > 1) {
  ------------------
  |  Branch (3637:9): [True: 0, False: 0]
  |  Branch (3637:27): [True: 0, False: 0]
  ------------------
 3638|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3639|      0|      return BLOSC2_ERROR_FILTER_PIPELINE;
 3640|      0|    }
 3641|      0|  }
 3642|      0|  if (context->use_dict || (context->blosc2_flags2 & BLOSC2_VL_BLOCKS)) {
  ------------------
  |  Branch (3642:7): [True: 0, False: 0]
  |  Branch (3642:28): [True: 0, False: 0]
  ------------------
 3643|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3644|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3645|      0|  }
 3646|      0|  return BLOSC2_ERROR_SUCCESS;
 3647|      0|}
blosc2.c:write_compression_header:
 3384|  1.21k|static int write_compression_header(blosc2_context* context, bool extended_header) {
 3385|  1.21k|  blosc_header header;
 3386|  1.21k|  int dont_split;
 3387|  1.21k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 3388|       |
 3389|  1.21k|  if (context->clevel == 0) {
  ------------------
  |  Branch (3389:7): [True: 7, False: 1.20k]
  ------------------
 3390|       |    /* Compression level 0 means no compression — dicts serve no purpose here */
 3391|      7|    context->use_dict = 0;
 3392|      7|  }
 3393|       |
 3394|  1.21k|  int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (3394:23): [True: 0, False: 1.21k]
  |  Branch (3394:44): [True: 0, False: 0]
  ------------------
 3395|       |
 3396|  1.21k|  context->header_flags = 0;
 3397|       |
 3398|  1.21k|  if (!vlblocks && context->clevel == 0) {
  ------------------
  |  Branch (3398:7): [True: 1.21k, False: 0]
  |  Branch (3398:20): [True: 7, False: 1.20k]
  ------------------
 3399|       |    /* Compression level 0 means buffer to be memcpy'ed */
 3400|      7|    context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
 3401|      7|  }
 3402|  1.21k|  if (!vlblocks && context->sourcesize < BLOSC_MIN_BUFFERSIZE) {
  ------------------
  |  Branch (3402:7): [True: 1.21k, False: 0]
  |  Branch (3402:20): [True: 54, False: 1.15k]
  ------------------
 3403|       |    /* Buffer is too small.  Try memcpy'ing. */
 3404|     54|    context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
 3405|     54|  }
 3406|       |
 3407|  1.21k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 3408|  1.21k|  if (extended_header) {
  ------------------
  |  Branch (3408:7): [True: 1.21k, False: 0]
  ------------------
 3409|       |    /* Indicate that we are building an extended header */
 3410|  1.21k|    context->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 3411|  1.21k|    context->header_flags |= (BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE);
 3412|       |    /* Store filter pipeline info at the end of the header */
 3413|  1.21k|    if (dict_training || memcpyed) {
  ------------------
  |  Branch (3413:9): [True: 0, False: 1.21k]
  |  Branch (3413:26): [True: 54, False: 1.15k]
  ------------------
 3414|     54|      context->bstarts = NULL;
 3415|     54|      context->output_bytes = context->header_overhead;
 3416|  1.15k|    } else {
 3417|  1.15k|      context->bstarts = (int32_t*)(context->dest + context->header_overhead);
 3418|  1.15k|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3419|  1.15k|    }
 3420|  1.21k|  } else {
 3421|       |    // Regular header
 3422|      0|    context->header_overhead = BLOSC_MIN_HEADER_LENGTH;
 3423|      0|    if (memcpyed) {
  ------------------
  |  Branch (3423:9): [True: 0, False: 0]
  ------------------
 3424|      0|      context->bstarts = NULL;
 3425|      0|      context->output_bytes = context->header_overhead;
 3426|      0|    } else {
 3427|      0|      context->bstarts = (int32_t *) (context->dest + context->header_overhead);
 3428|      0|      context->output_bytes = context->header_overhead + (int32_t)sizeof(int32_t) * context->nblocks;
 3429|      0|    }
 3430|      0|  }
 3431|       |
 3432|       |  /* If the header + block starts don't fit in destsize, fall back to memcpy */
 3433|  1.21k|  if (!memcpyed && context->output_bytes > context->destsize) {
  ------------------
  |  Branch (3433:7): [True: 1.15k, False: 54]
  |  Branch (3433:20): [True: 0, False: 1.15k]
  ------------------
 3434|      0|    context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
 3435|      0|    memcpyed = true;
 3436|      0|    context->bstarts = NULL;
 3437|      0|    context->output_bytes = context->header_overhead;
 3438|      0|  }
 3439|       |
 3440|       |  // when memcpyed bit is set, there is no point in dealing with others
 3441|  1.21k|  if (!memcpyed) {
  ------------------
  |  Branch (3441:7): [True: 1.15k, False: 54]
  ------------------
 3442|  1.15k|    if (context->filter_flags & BLOSC_DOSHUFFLE) {
  ------------------
  |  Branch (3442:9): [True: 707, False: 449]
  ------------------
 3443|       |      /* Byte-shuffle is active */
 3444|    707|      context->header_flags |= BLOSC_DOSHUFFLE;
 3445|    707|    }
 3446|       |
 3447|  1.15k|    if (context->filter_flags & BLOSC_DOBITSHUFFLE) {
  ------------------
  |  Branch (3447:9): [True: 205, False: 951]
  ------------------
 3448|       |      /* Bit-shuffle is active */
 3449|    205|      context->header_flags |= BLOSC_DOBITSHUFFLE;
 3450|    205|    }
 3451|       |
 3452|  1.15k|    if (context->filter_flags & BLOSC_DODELTA) {
  ------------------
  |  Branch (3452:9): [True: 74, False: 1.08k]
  ------------------
 3453|       |      /* Delta is active */
 3454|     74|      context->header_flags |= BLOSC_DODELTA;
 3455|     74|    }
 3456|       |
 3457|  1.15k|    dont_split = vlblocks || !split_block(context, context->typesize,
  ------------------
  |  Branch (3457:18): [True: 0, False: 1.15k]
  |  Branch (3457:30): [True: 1.15k, False: 0]
  ------------------
 3458|  1.15k|                                          context->blocksize);
 3459|       |
 3460|       |    /* dont_split is in bit 4 */
 3461|  1.15k|    context->header_flags |= dont_split << 4;
 3462|       |    /* codec starts at bit 5 */
 3463|  1.15k|    uint8_t compformat = compcode_to_compformat(context->compcode);
 3464|  1.15k|    context->header_flags |= compformat << 5;
 3465|  1.15k|  }
 3466|       |
 3467|       |  // Create blosc header and store to dest
 3468|  1.21k|  blosc2_initialize_header_from_context(context, &header, extended_header);
 3469|       |
 3470|  1.21k|  memcpy(context->dest, &header, (extended_header) ?
  ------------------
  |  Branch (3470:34): [True: 1.21k, False: 0]
  ------------------
 3471|  1.21k|    BLOSC_EXTENDED_HEADER_LENGTH : BLOSC_MIN_HEADER_LENGTH);
 3472|       |
 3473|  1.21k|  return 1;
 3474|  1.21k|}
blosc2.c:compcode_to_compformat:
  518|  1.15k|static int compcode_to_compformat(int compcode) {
  519|  1.15k|  switch (compcode) {
  520|    632|    case BLOSC_BLOSCLZ: return BLOSC_BLOSCLZ_FORMAT;
  ------------------
  |  Branch (520:5): [True: 632, False: 524]
  ------------------
  521|     53|    case BLOSC_LZ4:     return BLOSC_LZ4_FORMAT;
  ------------------
  |  Branch (521:5): [True: 53, False: 1.10k]
  ------------------
  522|      0|    case BLOSC_LZ4HC:   return BLOSC_LZ4HC_FORMAT;
  ------------------
  |  Branch (522:5): [True: 0, False: 1.15k]
  ------------------
  523|       |
  524|      0|#if defined(HAVE_ZLIB)
  525|      0|    case BLOSC_ZLIB:    return BLOSC_ZLIB_FORMAT;
  ------------------
  |  Branch (525:5): [True: 0, False: 1.15k]
  ------------------
  526|      0|#endif /*  HAVE_ZLIB */
  527|       |
  528|      0|#if defined(HAVE_ZSTD)
  529|    334|    case BLOSC_ZSTD:    return BLOSC_ZSTD_FORMAT;
  ------------------
  |  Branch (529:5): [True: 334, False: 822]
  ------------------
  530|      0|      break;
  531|      0|#endif /*  HAVE_ZSTD */
  532|    137|    default:
  ------------------
  |  Branch (532:5): [True: 137, False: 1.01k]
  ------------------
  533|    137|      return BLOSC_UDCODEC_FORMAT;
  534|  1.15k|  }
  535|      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]
  |  |  ------------------
  ------------------
  536|      0|}
blosc2.c:blosc2_initialize_header_from_context:
 1238|  1.21k|static int blosc2_initialize_header_from_context(blosc2_context* context, blosc_header* header, bool extended_header) {
 1239|  1.21k|  int32_t header_blocksize = (int32_t)(context->header_blocksize > 0 ? context->header_blocksize : context->blocksize);
  ------------------
  |  Branch (1239:40): [True: 1.21k, False: 0]
  ------------------
 1240|  1.21k|  if ((context->blosc2_flags2 & BLOSC2_VL_BLOCKS) == 0 &&
  ------------------
  |  Branch (1240:7): [True: 1.21k, False: 0]
  ------------------
 1241|  1.21k|      context->sourcesize > 0 && header_blocksize > context->sourcesize) {
  ------------------
  |  Branch (1241:7): [True: 1.21k, False: 0]
  |  Branch (1241:34): [True: 0, False: 1.21k]
  ------------------
 1242|      0|    header_blocksize = (int32_t)context->sourcesize;
 1243|      0|  }
 1244|  1.21k|  memset(header, 0, sizeof(blosc_header));
 1245|       |
 1246|  1.21k|  header->version = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) ?
  ------------------
  |  Branch (1246:21): [True: 0, False: 1.21k]
  ------------------
 1247|      0|                    BLOSC2_VERSION_FORMAT_VL_BLOCKS :
 1248|  1.21k|                    BLOSC2_VERSION_FORMAT_STABLE;
 1249|  1.21k|  if (context->blosc1_format) {
  ------------------
  |  Branch (1249:7): [True: 0, False: 1.21k]
  ------------------
 1250|      0|    header->version = BLOSC1_VERSION_FORMAT;
 1251|      0|  }
 1252|  1.21k|  header->versionlz = compcode_to_compversion(context->compcode);
 1253|  1.21k|  header->flags = context->header_flags;
 1254|  1.21k|  header->typesize = (uint8_t)context->typesize;
 1255|  1.21k|  header->nbytes = (int32_t)context->sourcesize;
 1256|  1.21k|  header->blocksize = header_blocksize;
 1257|       |
 1258|  1.21k|  int little_endian = is_little_endian();
 1259|  1.21k|  if (!little_endian) {
  ------------------
  |  Branch (1259:7): [True: 0, False: 1.21k]
  ------------------
 1260|      0|    header->nbytes = bswap32_(header->nbytes);
 1261|      0|    header->blocksize = bswap32_(header->blocksize);
 1262|       |    // cbytes written after compression
 1263|      0|  }
 1264|       |
 1265|  1.21k|  if (extended_header) {
  ------------------
  |  Branch (1265:7): [True: 1.21k, False: 0]
  ------------------
 1266|       |    /* Store filter pipeline info at the end of the header */
 1267|  8.47k|    for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (1267:21): [True: 7.26k, False: 1.21k]
  ------------------
 1268|  7.26k|      header->filters[i] = context->filters[i];
 1269|  7.26k|      header->filters_meta[i] = context->filters_meta[i];
 1270|  7.26k|    }
 1271|  1.21k|    header->udcompcode = context->compcode;
 1272|  1.21k|    header->compcode_meta = context->compcode_meta;
 1273|  1.21k|    header->blosc2_flags2 = context->blosc2_flags2;
 1274|       |
 1275|  1.21k|    if (!little_endian) {
  ------------------
  |  Branch (1275:9): [True: 0, False: 1.21k]
  ------------------
 1276|      0|      header->blosc2_flags |= BLOSC2_BIGENDIAN;
 1277|      0|    }
 1278|  1.21k|    if (context->use_dict) {
  ------------------
  |  Branch (1278:9): [True: 0, False: 1.21k]
  ------------------
 1279|      0|      header->blosc2_flags |= BLOSC2_USEDICT;
 1280|      0|    }
 1281|  1.21k|    if (context->blosc2_flags & BLOSC2_INSTR_CODEC) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 1.21k]
  ------------------
 1282|      0|      header->blosc2_flags |= BLOSC2_INSTR_CODEC;
 1283|      0|    }
 1284|  1.21k|  }
 1285|       |
 1286|  1.21k|  return 0;
 1287|  1.21k|}
blosc2.c:compcode_to_compversion:
  540|  1.21k|static int compcode_to_compversion(int compcode) {
  541|       |  /* Write compressor format */
  542|  1.21k|  switch (compcode) {
  543|    671|    case BLOSC_BLOSCLZ:
  ------------------
  |  Branch (543:5): [True: 671, False: 539]
  ------------------
  544|    671|      return BLOSC_BLOSCLZ_VERSION_FORMAT;
  545|     53|    case BLOSC_LZ4:
  ------------------
  |  Branch (545:5): [True: 53, False: 1.15k]
  ------------------
  546|     53|      return BLOSC_LZ4_VERSION_FORMAT;
  547|      0|    case BLOSC_LZ4HC:
  ------------------
  |  Branch (547:5): [True: 0, False: 1.21k]
  ------------------
  548|      0|      return BLOSC_LZ4HC_VERSION_FORMAT;
  549|       |
  550|      0|#if defined(HAVE_ZLIB)
  551|      0|    case BLOSC_ZLIB:
  ------------------
  |  Branch (551:5): [True: 0, False: 1.21k]
  ------------------
  552|      0|      return BLOSC_ZLIB_VERSION_FORMAT;
  553|      0|      break;
  554|      0|#endif /*  HAVE_ZLIB */
  555|       |
  556|      0|#if defined(HAVE_ZSTD)
  557|    334|    case BLOSC_ZSTD:
  ------------------
  |  Branch (557:5): [True: 334, False: 876]
  ------------------
  558|    334|      return BLOSC_ZSTD_VERSION_FORMAT;
  559|      0|      break;
  560|      0|#endif /*  HAVE_ZSTD */
  561|    152|    default:
  ------------------
  |  Branch (561:5): [True: 152, False: 1.05k]
  ------------------
  562|    442|      for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (562:23): [True: 442, False: 0]
  ------------------
  563|    442|        if (compcode == g_codecs[i].compcode) {
  ------------------
  |  Branch (563:13): [True: 152, False: 290]
  ------------------
  564|    152|          return g_codecs[i].version;
  565|    152|        }
  566|    442|      }
  567|  1.21k|  }
  568|      0|  return BLOSC2_ERROR_FAILURE;
  569|  1.21k|}
blosc2.c:blosc_compress_context:
 3477|  1.21k|static int blosc_compress_context(blosc2_context* context) {
 3478|  1.21k|  int ntbytes = 0;
 3479|  1.21k|  blosc_timestamp_t last, current;
 3480|  1.21k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 3481|       |
 3482|  1.21k|  blosc_set_timestamp(&last);
 3483|       |
 3484|  1.21k|  if (!memcpyed) {
  ------------------
  |  Branch (3484:7): [True: 1.15k, False: 54]
  ------------------
 3485|       |    /* Do the actual compression */
 3486|  1.15k|    ntbytes = do_job(context);
 3487|  1.15k|    if (ntbytes < 0) {
  ------------------
  |  Branch (3487:9): [True: 2, False: 1.15k]
  ------------------
 3488|      2|      return ntbytes;
 3489|      2|    }
 3490|  1.15k|    if (ntbytes == 0) {
  ------------------
  |  Branch (3490:9): [True: 305, False: 849]
  ------------------
 3491|       |      // Try out with a memcpy later on (last chance for fitting src buffer in dest).
 3492|    305|      context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
 3493|    305|      memcpyed = true;
 3494|    305|    }
 3495|  1.15k|  }
 3496|       |
 3497|  1.20k|  int dont_split = (context->header_flags & 0x10) >> 4;
 3498|  1.20k|  int nstreams = context->nblocks;
 3499|  1.20k|  if (!dont_split) {
  ------------------
  |  Branch (3499:7): [True: 54, False: 1.15k]
  ------------------
 3500|       |    // When splitting, the number of streams is computed differently
 3501|     54|    if (context->leftover) {
  ------------------
  |  Branch (3501:9): [True: 0, False: 54]
  ------------------
 3502|      0|      nstreams = (context->nblocks - 1) * context->typesize + 1;
 3503|      0|    }
 3504|     54|    else {
 3505|     54|      nstreams *= context->typesize;
 3506|     54|    }
 3507|     54|  }
 3508|       |
 3509|  1.20k|  if (memcpyed) {
  ------------------
  |  Branch (3509:7): [True: 359, False: 849]
  ------------------
 3510|    359|    if (context->sourcesize + context->header_overhead > context->destsize) {
  ------------------
  |  Branch (3510:9): [True: 0, False: 359]
  ------------------
 3511|       |      /* We are exceeding maximum output size */
 3512|      0|      ntbytes = 0;
 3513|      0|    }
 3514|    359|    else {
 3515|    359|      context->output_bytes = context->header_overhead;
 3516|    359|      ntbytes = do_job(context);
 3517|    359|      if (ntbytes < 0) {
  ------------------
  |  Branch (3517:11): [True: 0, False: 359]
  ------------------
 3518|      0|        return ntbytes;
 3519|      0|      }
 3520|       |      // Success!  update the memcpy bit in header
 3521|    359|      context->dest[BLOSC2_CHUNK_FLAGS] = context->header_flags;
 3522|    359|      if (context->dict_cdict != NULL) {
  ------------------
  |  Branch (3522:11): [True: 0, False: 359]
  ------------------
 3523|       |        // The copy overwrote the dictionary that this pass was going to use
 3524|      0|        context->dest[BLOSC2_CHUNK_BLOSC2_FLAGS] &= ~(uint8_t)BLOSC2_USEDICT;
 3525|      0|      }
 3526|       |      // and clear the memcpy bit in context (for next reuse)
 3527|    359|      context->header_flags &= ~(uint8_t)BLOSC_MEMCPYED;
 3528|    359|    }
 3529|    359|  }
 3530|    849|  else {
 3531|       |    // Check whether we have a run for the whole chunk
 3532|    849|    int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (3532:25): [True: 0, False: 849]
  |  Branch (3532:46): [True: 0, False: 0]
  ------------------
 3533|    849|    int start_csizes = context->header_overhead + 4 * context->nblocks;
 3534|    849|    if (!dict_training && ntbytes == (int)(start_csizes + nstreams * sizeof(int32_t))) {
  ------------------
  |  Branch (3534:9): [True: 849, False: 0]
  |  Branch (3534:27): [True: 0, False: 849]
  ------------------
 3535|       |      // The streams are all zero runs (by construction).  Encode it...
 3536|      0|      context->dest[BLOSC2_CHUNK_BLOSC2_FLAGS] |= BLOSC2_SPECIAL_ZERO << 4;
 3537|       |      // ...and assign the new chunk length
 3538|      0|      ntbytes = context->header_overhead;
 3539|      0|    }
 3540|    849|  }
 3541|       |
 3542|       |  /* Set the number of compressed bytes in header */
 3543|  1.20k|  _sw32(context->dest + BLOSC2_CHUNK_CBYTES, ntbytes);
 3544|  1.20k|  if (context->blosc2_flags & BLOSC2_INSTR_CODEC) {
  ------------------
  |  Branch (3544:7): [True: 0, False: 1.20k]
  ------------------
 3545|      0|    dont_split = (context->header_flags & 0x10) >> 4;
 3546|      0|    int32_t blocksize = dont_split ? (int32_t)sizeof(blosc2_instr) : (int32_t)sizeof(blosc2_instr) * context->typesize;
  ------------------
  |  Branch (3546:25): [True: 0, False: 0]
  ------------------
 3547|      0|    _sw32(context->dest + BLOSC2_CHUNK_NBYTES, nstreams * (int32_t)sizeof(blosc2_instr));
 3548|      0|    _sw32(context->dest + BLOSC2_CHUNK_BLOCKSIZE, blocksize);
 3549|      0|  }
 3550|       |
 3551|       |  /* Set the number of bytes in dest buffer (might be useful for tuner) */
 3552|  1.20k|  context->destsize = ntbytes;
 3553|       |
 3554|  1.20k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (3554:7): [True: 0, False: 1.20k]
  ------------------
 3555|      0|    blosc_set_timestamp(&current);
 3556|      0|    double ctime = blosc_elapsed_secs(last, current);
 3557|      0|    int rc;
 3558|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (3558:9): [True: 0, False: 0]
  |  Branch (3558:49): [True: 0, False: 0]
  ------------------
 3559|      0|      rc = blosc_stune_update(context, ctime);
 3560|      0|    } else {
 3561|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (3561:23): [True: 0, False: 0]
  ------------------
 3562|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (3562:13): [True: 0, False: 0]
  ------------------
 3563|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (3563:15): [True: 0, False: 0]
  ------------------
 3564|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (3564:17): [True: 0, False: 0]
  ------------------
 3565|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3566|      0|              return BLOSC2_ERROR_FAILURE;
 3567|      0|            }
 3568|      0|          }
 3569|      0|          rc = g_tuners[i].update(context, ctime);
 3570|      0|          goto urtunersuccess;
 3571|      0|        }
 3572|      0|      }
 3573|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3574|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 3575|      0|      urtunersuccess:;
 3576|      0|    }
 3577|      0|    if (rc < 0) {
  ------------------
  |  Branch (3577:9): [True: 0, False: 0]
  ------------------
 3578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3579|      0|      return BLOSC2_ERROR_TUNER;
 3580|      0|    }
 3581|      0|  }
 3582|       |
 3583|  1.20k|  return ntbytes;
 3584|  1.20k|}
blosc2.c:blosc_run_decompression_with_context:
 4453|  2.00k|                                                void* dest, int32_t destsize) {
 4454|  2.00k|  blosc_header header;
 4455|  2.00k|  int32_t ntbytes;
 4456|  2.00k|  int rc;
 4457|       |
 4458|  2.00k|  rc = read_chunk_header(src, srcsize, true, &header);
 4459|  2.00k|  if (rc < 0) {
  ------------------
  |  Branch (4459:7): [True: 0, False: 2.00k]
  ------------------
 4460|      0|    return rc;
 4461|      0|  }
 4462|       |
 4463|  2.00k|  if (header.nbytes > destsize) {
  ------------------
  |  Branch (4463:7): [True: 0, False: 2.00k]
  ------------------
 4464|       |    // Not enough space for writing into the destination
 4465|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 4466|      0|  }
 4467|       |
 4468|  2.00k|  rc = initialize_context_decompression(context, &header, src, srcsize, dest, destsize);
 4469|  2.00k|  if (rc < 0) {
  ------------------
  |  Branch (4469:7): [True: 8, False: 1.99k]
  ------------------
 4470|      8|    return rc;
 4471|      8|  }
 4472|       |
 4473|       |  /* Do the actual decompression */
 4474|  1.99k|  ntbytes = do_job(context);
 4475|  1.99k|  if (ntbytes < 0) {
  ------------------
  |  Branch (4475:7): [True: 69, False: 1.92k]
  ------------------
 4476|     69|    return ntbytes;
 4477|     69|  }
 4478|       |
 4479|  1.99k|  assert(ntbytes <= (int32_t)destsize);
 4480|  1.92k|  return ntbytes;
 4481|  1.99k|}
blosc2.c:initialize_context_decompression:
 3146|  2.00k|                                            int32_t srcsize, void* dest, int32_t destsize) {
 3147|  2.00k|  int32_t bstarts_end;
 3148|  2.00k|  bool vlblocks;
 3149|       |
 3150|  2.00k|  context->do_compress = 0;
 3151|  2.00k|  context->src = (const uint8_t*)src;
 3152|  2.00k|  context->srcsize = srcsize;
 3153|  2.00k|  context->dest = (uint8_t*)dest;
 3154|  2.00k|  context->destsize = destsize;
 3155|  2.00k|  context->output_bytes = 0;
 3156|  2.00k|  context->vlblock_sources = NULL;
 3157|  2.00k|  context->vlblock_dests = NULL;
 3158|  2.00k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (3158:7): [True: 0, False: 2.00k]
  ------------------
 3159|      0|    free(context->blocknbytes);
 3160|      0|    context->blocknbytes = NULL;
 3161|      0|  }
 3162|  2.00k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (3162:7): [True: 0, False: 2.00k]
  ------------------
 3163|      0|    free(context->blockoffsets);
 3164|      0|    context->blockoffsets = NULL;
 3165|      0|  }
 3166|  2.00k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (3166:7): [True: 0, False: 2.00k]
  ------------------
 3167|      0|    free(context->blockcbytes);
 3168|      0|    context->blockcbytes = NULL;
 3169|      0|  }
 3170|       |
 3171|  2.00k|  int rc = blosc2_initialize_context_from_header(context, header);
 3172|  2.00k|  if (rc < 0) {
  ------------------
  |  Branch (3172:7): [True: 0, False: 2.00k]
  ------------------
 3173|      0|    return rc;
 3174|      0|  }
 3175|  2.00k|  clear_context_decompression_dict(context);
 3176|  2.00k|  vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 3177|  2.00k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (3177:19): [True: 1.91k, False: 88]
  ------------------
 3178|  1.91k|                  (context->blosc2_flags & 0x08u));
  ------------------
  |  Branch (3178:19): [True: 12, False: 1.90k]
  ------------------
 3179|       |
 3180|       |  /* Check that we have enough space to decompress */
 3181|  2.00k|  if (context->sourcesize > (int32_t)context->destsize) {
  ------------------
  |  Branch (3181:7): [True: 0, False: 2.00k]
  ------------------
 3182|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 3183|      0|  }
 3184|       |
 3185|  2.00k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (3185:7): [True: 1.17k, False: 830]
  ------------------
 3186|  1.17k|    if (context->block_maskout_nitems != context->nblocks) {
  ------------------
  |  Branch (3186:9): [True: 0, False: 1.17k]
  ------------------
 3187|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3188|      0|                        " of blocks in chunk (%d).",
 3189|      0|                        context->block_maskout_nitems, context->nblocks);
 3190|      0|      return BLOSC2_ERROR_DATA;
 3191|      0|    }
 3192|  1.17k|    if (filters_contain(context->filters, BLOSC_DELTA)) {
  ------------------
  |  Branch (3192:9): [True: 148, False: 1.02k]
  ------------------
 3193|    148|      bool any_needed = false;
 3194|    148|      for (int i = 0; i < context->block_maskout_nitems; ++i) {
  ------------------
  |  Branch (3194:23): [True: 148, False: 0]
  ------------------
 3195|    148|        if (!context->block_maskout[i]) {
  ------------------
  |  Branch (3195:13): [True: 148, False: 0]
  ------------------
 3196|    148|          any_needed = true;
 3197|    148|          break;
 3198|    148|        }
 3199|    148|      }
 3200|    148|      if (any_needed) {
  ------------------
  |  Branch (3200:11): [True: 148, False: 0]
  ------------------
 3201|       |        // Delta filter encodes subsequent blocks relative to block 0; block 0 must be unmasked.
 3202|    148|        context->block_maskout[0] = false;
 3203|    148|      }
 3204|    148|    }
 3205|  1.17k|  }
 3206|       |
 3207|  2.00k|  context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
 3208|  2.00k|  if (context->special_type > BLOSC2_SPECIAL_LASTID) {
  ------------------
  |  Branch (3208:7): [True: 0, False: 2.00k]
  ------------------
 3209|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3210|      0|                      context->special_type);
 3211|      0|    return BLOSC2_ERROR_DATA;
 3212|      0|  }
 3213|       |
 3214|  2.00k|  int memcpyed = (context->header_flags & (uint8_t) BLOSC_MEMCPYED);
 3215|  2.00k|  if (memcpyed && (header->cbytes != header->nbytes + context->header_overhead)) {
  ------------------
  |  Branch (3215:7): [True: 517, False: 1.48k]
  |  Branch (3215:19): [True: 0, False: 517]
  ------------------
 3216|      0|    BLOSC_TRACE_ERROR("Wrong header info for this memcpyed 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3217|      0|    return BLOSC2_ERROR_DATA;
 3218|      0|  }
 3219|       |
 3220|  2.00k|  if ((header->nbytes == 0) && (header->cbytes == context->header_overhead) &&
  ------------------
  |  Branch (3220:7): [True: 0, False: 2.00k]
  |  Branch (3220:32): [True: 0, False: 0]
  ------------------
 3221|      0|      !context->special_type) {
  ------------------
  |  Branch (3221:7): [True: 0, False: 0]
  ------------------
 3222|       |    // A compressed buffer with only a header can only contain a zero-length buffer
 3223|      0|    return 0;
 3224|      0|  }
 3225|       |
 3226|  2.00k|  context->bstarts = (int32_t *) (context->src + context->header_overhead);
 3227|  2.00k|  bstarts_end = context->header_overhead;
 3228|  2.00k|  if (!context->special_type && !memcpyed) {
  ------------------
  |  Branch (3228:7): [True: 1.90k, False: 102]
  |  Branch (3228:33): [True: 1.38k, False: 517]
  ------------------
 3229|  1.38k|    size_t bstarts_end_tmp;
 3230|  1.38k|    size_t bstarts_nbytes;
 3231|  1.38k|    if (context->nblocks < 0 ||
  ------------------
  |  Branch (3231:9): [True: 0, False: 1.38k]
  ------------------
 3232|  1.38k|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (3232:9): [True: 0, False: 1.38k]
  ------------------
 3233|  1.38k|        !blosc2_checked_add_size((size_t)context->header_overhead, bstarts_nbytes, &bstarts_end_tmp) ||
  ------------------
  |  Branch (3233:9): [True: 0, False: 1.38k]
  ------------------
 3234|  1.38k|        bstarts_end_tmp > (size_t)INT32_MAX) {
  ------------------
  |  Branch (3234:9): [True: 0, False: 1.38k]
  ------------------
 3235|      0|      BLOSC_TRACE_ERROR("Invalid bstarts size in 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3236|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3237|      0|    }
 3238|       |    /* If chunk is not special or a memcpyed, we do have a bstarts section */
 3239|  1.38k|    bstarts_end = (int32_t)bstarts_end_tmp;
 3240|  1.38k|  }
 3241|       |
 3242|  2.00k|  if (srcsize < bstarts_end) {
  ------------------
  |  Branch (3242:7): [True: 4, False: 2.00k]
  ------------------
 3243|      4|    BLOSC_TRACE_ERROR("`bstarts` exceeds length of source buffer.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3244|      4|    return BLOSC2_ERROR_READ_BUFFER;
 3245|      4|  }
 3246|       |
 3247|  2.00k|  if (vlblocks && is_lazy && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (3247:7): [True: 1, False: 2.00k]
  |  Branch (3247:19): [True: 0, False: 1]
  |  Branch (3247:30): [True: 0, False: 0]
  |  Branch (3247:56): [True: 0, False: 0]
  ------------------
 3248|      0|    size_t block_csizes_nbytes;
 3249|      0|    size_t trailer_meta_nbytes;
 3250|      0|    size_t lazy_trailer_end;
 3251|      0|    if (context->srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (3251:9): [True: 0, False: 0]
  |  Branch (3251:33): [True: 0, False: 0]
  ------------------
 3252|      0|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (3252:9): [True: 0, False: 0]
  ------------------
 3253|      0|        !blosc2_checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (3253:9): [True: 0, False: 0]
  ------------------
 3254|      0|        !blosc2_checked_add_size((size_t)bstarts_end, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (3254:9): [True: 0, False: 0]
  ------------------
 3255|      0|        (size_t)context->srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (3255:9): [True: 0, False: 0]
  ------------------
 3256|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3257|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3258|      0|    }
 3259|      0|  }
 3260|  2.00k|  srcsize -= bstarts_end;
 3261|       |
 3262|       |  /* Read optional dictionary if flag set.  A memcpyed chunk has none, even if the flag says so
 3263|       |     (older versions left it on chunks with a dictionary that did not compress) */
 3264|  2.00k|  if ((context->blosc2_flags & BLOSC2_USEDICT) && !memcpyed && !is_lazy) {
  ------------------
  |  Branch (3264:7): [True: 3, False: 1.99k]
  |  Branch (3264:51): [True: 3, False: 0]
  |  Branch (3264:64): [True: 0, False: 3]
  ------------------
 3265|      0|    context->use_dict = 1;
 3266|       |    // The dictionary section is after the bstarts block: [int32 size | raw bytes]
 3267|      0|    if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (3267:9): [True: 0, False: 0]
  ------------------
 3268|      0|      BLOSC_TRACE_ERROR("Not enough space to read size of dictionary.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3269|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3270|      0|    }
 3271|      0|    srcsize -= sizeof(int32_t);
 3272|       |    // Read dictionary size
 3273|      0|    context->dict_size = sw32_(context->src + bstarts_end);
 3274|      0|    if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (3274:9): [True: 0, False: 0]
  |  Branch (3274:36): [True: 0, False: 0]
  ------------------
 3275|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3276|      0|      return BLOSC2_ERROR_CODEC_DICT;
 3277|      0|    }
 3278|      0|    if (srcsize < (int32_t)context->dict_size) {
  ------------------
  |  Branch (3278:9): [True: 0, False: 0]
  ------------------
 3279|      0|      BLOSC_TRACE_ERROR("Not enough space to read entire dictionary.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3280|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3281|      0|    }
 3282|      0|    srcsize -= context->dict_size;
 3283|       |    // dict_buffer points directly into the source chunk — no copy needed
 3284|      0|    context->dict_buffer = (void*)(context->src + bstarts_end + sizeof(int32_t));
 3285|      0|    context->dict_buffer_owned = false;
 3286|      0|#if defined(HAVE_ZSTD)
 3287|       |    // context->compcode during decompression holds the format code (flags >> 5),
 3288|       |    // so compare against BLOSC_ZSTD_FORMAT (not BLOSC_ZSTD).
 3289|      0|    if (context->compcode == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (3289:9): [True: 0, False: 0]
  ------------------
 3290|      0|      context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 3291|      0|      if (context->dict_ddict == NULL) {
  ------------------
  |  Branch (3291:11): [True: 0, False: 0]
  ------------------
 3292|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3293|      0|        return BLOSC2_ERROR_CODEC_DICT;
 3294|      0|      }
 3295|      0|    }
 3296|      0|#endif   // HAVE_ZSTD
 3297|       |    // For LZ4/LZ4HC: dict_buffer and dict_size are sufficient; no digested object needed.
 3298|      0|  }
 3299|  2.00k|  else if ((context->blosc2_flags & BLOSC2_USEDICT) && !memcpyed && is_lazy) {
  ------------------
  |  Branch (3299:12): [True: 3, False: 1.99k]
  |  Branch (3299:56): [True: 3, False: 0]
  |  Branch (3299:69): [True: 3, False: 0]
  ------------------
 3300|      3|    rc = load_lazy_chunk_dict(context, header, bstarts_end);
 3301|      3|    if (rc < 0) {
  ------------------
  |  Branch (3301:9): [True: 3, False: 0]
  ------------------
 3302|      3|      return rc;
 3303|      3|    }
 3304|      3|  }
 3305|       |
 3306|  1.99k|  if (vlblocks && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (3306:7): [True: 1, False: 1.99k]
  |  Branch (3306:19): [True: 1, False: 0]
  |  Branch (3306:45): [True: 1, False: 0]
  ------------------
 3307|      1|    context->blocknbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 3308|      1|    BLOSC_ERROR_NULL(context->blocknbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 3309|      1|    context->blockoffsets = malloc((size_t)context->nblocks * sizeof(int32_t));
 3310|      1|    BLOSC_ERROR_NULL(context->blockoffsets, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 3311|      1|    context->blockcbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 3312|      1|    BLOSC_ERROR_NULL(context->blockcbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 3313|       |
 3314|      1|    if (is_lazy) {
  ------------------
  |  Branch (3314:9): [True: 0, False: 1]
  ------------------
 3315|       |      // Lazy VL: block data is on disk, so blocknbytes is unknown at this point.
 3316|       |      // Populate blockcbytes from bstarts differences; blocksize gets max(blockcbytes)
 3317|       |      // as a safe upper bound so tmp buffers are large enough for the lazy block read.
 3318|      0|      int32_t max_csize = 0;
 3319|      0|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (3319:27): [True: 0, False: 0]
  ------------------
 3320|      0|        int32_t bstart = sw32_(context->bstarts + i);
 3321|      0|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (3321:31): [True: 0, False: 0]
  ------------------
 3322|      0|            sw32_(context->bstarts + i + 1) : header->cbytes;
 3323|      0|        if (bstart < bstarts_end || next_bstart <= bstart ||
  ------------------
  |  Branch (3323:13): [True: 0, False: 0]
  |  Branch (3323:37): [True: 0, False: 0]
  ------------------
 3324|      0|            next_bstart > header->cbytes) {
  ------------------
  |  Branch (3324:13): [True: 0, False: 0]
  ------------------
 3325|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3326|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 3327|      0|        }
 3328|      0|        context->blocknbytes[i] = 0;   // unknown until block is read from disk
 3329|      0|        context->blockoffsets[i] = 0;  // unknown
 3330|      0|        context->blockcbytes[i] = next_bstart - bstart;
 3331|      0|        if (context->blockcbytes[i] > max_csize) {
  ------------------
  |  Branch (3331:13): [True: 0, False: 0]
  ------------------
 3332|      0|          max_csize = context->blockcbytes[i];
 3333|      0|        }
 3334|      0|      }
 3335|      0|      context->blocksize = max_csize;
 3336|      0|      context->leftover = 0;
 3337|      0|    }
 3338|      1|    else {
 3339|      1|      int32_t max_blocksize = 0;
 3340|      1|      int64_t total_nbytes = 0;
 3341|      1|      int32_t prev_bstart = 0;
 3342|      1|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (3342:27): [True: 1, False: 0]
  ------------------
 3343|      1|        int32_t bstart = sw32_(context->bstarts + i);
 3344|      1|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (3344:31): [True: 1, False: 0]
  ------------------
 3345|      1|            sw32_(context->bstarts + i + 1) : header->cbytes;
 3346|      1|        if (bstart < bstarts_end || bstart <= prev_bstart || next_bstart <= bstart ||
  ------------------
  |  Branch (3346:13): [True: 0, False: 1]
  |  Branch (3346:37): [True: 0, False: 1]
  |  Branch (3346:62): [True: 0, False: 1]
  ------------------
 3347|      1|            next_bstart > header->cbytes || bstart > context->srcsize - (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (3347:13): [True: 1, False: 0]
  |  Branch (3347:45): [True: 0, False: 0]
  ------------------
 3348|      1|          BLOSC_TRACE_ERROR("Invalid VL-block offsets in 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3349|      1|          return BLOSC2_ERROR_INVALID_HEADER;
 3350|      1|        }
 3351|      0|        context->blocknbytes[i] = sw32_(context->src + bstart);
 3352|      0|        context->blockcbytes[i] = next_bstart - bstart;
 3353|      0|        if (context->blocknbytes[i] <= 0) {
  ------------------
  |  Branch (3353:13): [True: 0, False: 0]
  ------------------
 3354|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3355|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 3356|      0|        }
 3357|      0|        if (total_nbytes > INT32_MAX) {
  ------------------
  |  Branch (3357:13): [True: 0, False: 0]
  ------------------
 3358|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3359|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 3360|      0|        }
 3361|      0|        context->blockoffsets[i] = (int32_t)total_nbytes;
 3362|      0|        total_nbytes += context->blocknbytes[i];
 3363|      0|        if (total_nbytes > context->sourcesize) {
  ------------------
  |  Branch (3363:13): [True: 0, False: 0]
  ------------------
 3364|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3365|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 3366|      0|        }
 3367|      0|        if (context->blocknbytes[i] > max_blocksize) {
  ------------------
  |  Branch (3367:13): [True: 0, False: 0]
  ------------------
 3368|      0|          max_blocksize = context->blocknbytes[i];
 3369|      0|        }
 3370|      0|        prev_bstart = bstart;
 3371|      0|      }
 3372|      0|      if (total_nbytes != context->sourcesize) {
  ------------------
  |  Branch (3372:11): [True: 0, False: 0]
  ------------------
 3373|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3374|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 3375|      0|      }
 3376|      0|      context->blocksize = max_blocksize;
 3377|      0|      context->leftover = 0;
 3378|      0|    }
 3379|      1|  }
 3380|       |
 3381|  1.99k|  return 0;
 3382|  1.99k|}
blosc2.c:load_lazy_chunk_dict:
 3092|      3|static int load_lazy_chunk_dict(blosc2_context* context, blosc_header* header, int32_t bstarts_end) {
 3093|      3|  int32_t dict_offset = bstarts_end;
 3094|      3|  if (header->cbytes < dict_offset + (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (3094:7): [True: 0, False: 3]
  ------------------
 3095|      0|    BLOSC_TRACE_ERROR("Lazy chunk dictionary header 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3096|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3097|      0|  }
 3098|       |
 3099|      3|  uint8_t dict_size_buf[sizeof(int32_t)];
 3100|      3|  int rc = read_lazy_chunk_bytes(context, dict_offset, dict_size_buf, (int32_t)sizeof(dict_size_buf),
 3101|      3|                                 "Cannot open frame file for lazy chunk dictionary read.",
 3102|      3|                                 "Cannot read lazy chunk dictionary size from disk.");
 3103|      3|  if (rc < 0) {
  ------------------
  |  Branch (3103:7): [True: 3, False: 0]
  ------------------
 3104|      3|    return rc;
 3105|      3|  }
 3106|       |
 3107|      0|  context->dict_size = sw32_(dict_size_buf);
 3108|      0|  if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (3108:7): [True: 0, False: 0]
  |  Branch (3108:34): [True: 0, False: 0]
  ------------------
 3109|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3110|      0|    return BLOSC2_ERROR_CODEC_DICT;
 3111|      0|  }
 3112|      0|  if (header->cbytes < dict_offset + (int32_t)sizeof(int32_t) + context->dict_size) {
  ------------------
  |  Branch (3112:7): [True: 0, False: 0]
  ------------------
 3113|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3114|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3115|      0|  }
 3116|       |
 3117|      0|  context->dict_buffer = malloc((size_t)context->dict_size);
 3118|      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]
  |  |  ------------------
  ------------------
 3119|      0|  context->dict_buffer_owned = true;
 3120|      0|  rc = read_lazy_chunk_bytes(context, dict_offset + (int32_t)sizeof(int32_t),
 3121|      0|                             context->dict_buffer, context->dict_size,
 3122|      0|                             "Cannot open frame file for lazy chunk dictionary read.",
 3123|      0|                             "Cannot read lazy chunk dictionary from disk.");
 3124|      0|  if (rc < 0) {
  ------------------
  |  Branch (3124:7): [True: 0, False: 0]
  ------------------
 3125|      0|    release_context_dict_buffer(context);
 3126|      0|    return rc;
 3127|      0|  }
 3128|       |
 3129|      0|  context->use_dict = 1;
 3130|      0|#if defined(HAVE_ZSTD)
 3131|      0|  if (context->compcode == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (3131:7): [True: 0, False: 0]
  ------------------
 3132|      0|    context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 3133|      0|    if (context->dict_ddict == NULL) {
  ------------------
  |  Branch (3133:9): [True: 0, False: 0]
  ------------------
 3134|      0|      release_context_dict_buffer(context);
 3135|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3136|      0|      return BLOSC2_ERROR_CODEC_DICT;
 3137|      0|    }
 3138|      0|  }
 3139|      0|#endif
 3140|       |
 3141|      0|  return 0;
 3142|      0|}
blosc2.c:do_job:
 2776|  3.51k|static int do_job(blosc2_context* context) {
 2777|  3.51k|  int32_t ntbytes;
 2778|       |
 2779|       |  /* Set sentinels */
 2780|  3.51k|  context->dref_not_init = 1;
 2781|       |
 2782|       |  /* Apply thread-count changes before deciding whether this operation actually
 2783|       |     needs a parallel backend.  POSIX defers backend startup for serial jobs.
 2784|       |     Windows keeps its existing per-context thread lifecycle and starts/rebinds
 2785|       |     the backend eagerly. */
 2786|       |#if defined(_WIN32)
 2787|       |  int rc = check_nthreads(context, true);
 2788|       |#else
 2789|  3.51k|  int rc = check_nthreads(context, false);
 2790|  3.51k|#endif
 2791|       |
 2792|       |  /* Run serially with one thread, with fewer than two full blocks of source
 2793|       |     data, or if thread configuration/backend setup fails. */
 2794|  3.51k|  if (context->nthreads == 1 || (context->sourcesize / context->blocksize) <= 1 || rc < 0) {
  ------------------
  |  Branch (2794:7): [True: 2.74k, False: 772]
  |  Branch (2794:33): [True: 772, False: 0]
  |  Branch (2794:84): [True: 0, False: 0]
  ------------------
 2795|  3.51k|    ntbytes = run_serial_job(context);
 2796|  3.51k|  }
 2797|      0|  else {
 2798|      0|    rc = check_nthreads(context, true);
 2799|      0|    if (rc < 0) {
  ------------------
  |  Branch (2799:9): [True: 0, False: 0]
  ------------------
 2800|       |      /* Backend startup failed; run serially and retry on the next parallel job. */
 2801|      0|      ntbytes = run_serial_job(context);
 2802|      0|    }
 2803|      0|    else {
 2804|      0|      ntbytes = parallel_blosc(context);
 2805|      0|    }
 2806|      0|  }
 2807|       |
 2808|  3.51k|  return ntbytes;
 2809|  3.51k|}
blosc2.c:run_serial_job:
 2764|  3.51k|static int run_serial_job(blosc2_context* context) {
 2765|  3.51k|  struct thread_context* thread_context = serial_context_get(context);
 2766|  3.51k|  if (thread_context == NULL) {
  ------------------
  |  Branch (2766:7): [True: 0, False: 3.51k]
  ------------------
 2767|      0|    return BLOSC2_ERROR_THREAD_CREATE;
 2768|      0|  }
 2769|  3.51k|  int ntbytes = serial_blosc(thread_context);
 2770|  3.51k|  serial_context_put(thread_context);
 2771|  3.51k|  return ntbytes;
 2772|  3.51k|}
blosc2.c:serial_blosc:
 2511|  3.51k|static int serial_blosc(struct thread_context* thread_context) {
 2512|  3.51k|  blosc2_context* context = thread_context->parent_context;
 2513|  3.51k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2514|  3.51k|  int32_t j, bsize, leftoverblock;
 2515|  3.51k|  int32_t cbytes;
 2516|  3.51k|  int32_t ntbytes = context->output_bytes;
 2517|  3.51k|  int32_t* bstarts = context->bstarts;
 2518|  3.51k|  uint8_t* tmp = thread_context->tmp;
 2519|  3.51k|  uint8_t* tmp2 = thread_context->tmp2;
 2520|  3.51k|  int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (2520:23): [True: 0, False: 3.51k]
  |  Branch (2520:44): [True: 0, False: 0]
  ------------------
 2521|  3.51k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 2522|  3.51k|  if (!context->do_compress && context->special_type) {
  ------------------
  |  Branch (2522:7): [True: 1.99k, False: 1.51k]
  |  Branch (2522:32): [True: 99, False: 1.89k]
  ------------------
 2523|       |    // Fake a runlen as if it was a memcpyed chunk
 2524|     99|    memcpyed = true;
 2525|     99|  }
 2526|       |
 2527|  51.1k|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (2527:15): [True: 47.9k, False: 3.13k]
  ------------------
 2528|  47.9k|    if (context->do_compress && !memcpyed && !dict_training) {
  ------------------
  |  Branch (2528:9): [True: 9.92k, False: 38.0k]
  |  Branch (2528:33): [True: 7.63k, False: 2.28k]
  |  Branch (2528:46): [True: 7.63k, False: 0]
  ------------------
 2529|  7.63k|      _sw32(bstarts + j, ntbytes);
 2530|  7.63k|    }
 2531|  47.9k|    bsize = vlblocks ? context->blocknbytes[j] : context->blocksize;
  ------------------
  |  Branch (2531:13): [True: 0, False: 47.9k]
  ------------------
 2532|  47.9k|    leftoverblock = 0;
 2533|  47.9k|    if (!vlblocks && (j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (2533:9): [True: 47.9k, False: 0]
  |  Branch (2533:22): [True: 3.47k, False: 44.5k]
  |  Branch (2533:53): [True: 15, False: 3.46k]
  ------------------
 2534|     15|      bsize = context->leftover;
 2535|     15|      leftoverblock = 1;
 2536|     15|    }
 2537|  47.9k|    if (context->do_compress) {
  ------------------
  |  Branch (2537:9): [True: 9.92k, False: 38.0k]
  ------------------
 2538|  9.92k|      if (memcpyed && !context->prefilter) {
  ------------------
  |  Branch (2538:11): [True: 2.28k, False: 7.63k]
  |  Branch (2538:23): [True: 221, False: 2.06k]
  ------------------
 2539|       |        /* We want to memcpy only */
 2540|    221|        memcpy(context->dest + context->header_overhead + j * context->blocksize,
 2541|    221|               context->src + j * context->blocksize, (unsigned int)bsize);
 2542|    221|        cbytes = (int32_t)bsize;
 2543|    221|      }
 2544|  9.70k|      else {
 2545|       |        /* Regular compression */
 2546|  9.70k|        cbytes = blosc_c(thread_context, bsize, leftoverblock, ntbytes,
 2547|  9.70k|                         context->destsize,
 2548|  9.70k|                         vlblocks ? context->vlblock_sources[j] : context->src,
  ------------------
  |  Branch (2548:26): [True: 0, False: 9.70k]
  ------------------
 2549|  9.70k|                         vlblocks ? 0 : j * context->blocksize,
  ------------------
  |  Branch (2549:26): [True: 0, False: 9.70k]
  ------------------
 2550|  9.70k|                         context->dest + ntbytes, tmp, tmp2);
 2551|  9.70k|        if (cbytes == 0) {
  ------------------
  |  Branch (2551:13): [True: 305, False: 9.39k]
  ------------------
 2552|    305|          ntbytes = 0;              /* incompressible data */
 2553|    305|          break;
 2554|    305|        }
 2555|  9.70k|      }
 2556|  9.92k|    }
 2557|  38.0k|    else {
 2558|       |      /* Regular decompression */
 2559|       |      // If memcpyed we don't have a bstarts section (because it is not needed)
 2560|  38.0k|      int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (2560:28): [True: 27.4k, False: 10.6k]
  ------------------
 2561|  27.4k|          context->header_overhead + j * context->blocksize : sw32_(bstarts + j);
 2562|  38.0k|      uint8_t *dest_block = (vlblocks && context->vlblock_dests != NULL) ? context->vlblock_dests[j] : context->dest;
  ------------------
  |  Branch (2562:30): [True: 0, False: 38.0k]
  |  Branch (2562:42): [True: 0, False: 0]
  ------------------
 2563|  38.0k|      int32_t dest_offset = (vlblocks && context->vlblock_dests != NULL) ? 0 :
  ------------------
  |  Branch (2563:30): [True: 0, False: 38.0k]
  |  Branch (2563:42): [True: 0, False: 0]
  ------------------
 2564|  38.0k|                            (vlblocks ? context->blockoffsets[j] : j * context->blocksize);
  ------------------
  |  Branch (2564:30): [True: 0, False: 38.0k]
  ------------------
 2565|  38.0k|      cbytes = blosc_d(thread_context, bsize, leftoverblock, memcpyed,
 2566|  38.0k|                       context->src, context->srcsize, src_offset, j,
 2567|  38.0k|                       dest_block, dest_offset, tmp, tmp2);
 2568|  38.0k|    }
 2569|       |
 2570|  47.6k|    if (cbytes < 0) {
  ------------------
  |  Branch (2570:9): [True: 71, False: 47.6k]
  ------------------
 2571|     71|      ntbytes = cbytes;         /* error in blosc_c or blosc_d */
 2572|     71|      break;
 2573|     71|    }
 2574|  47.6k|    ntbytes += cbytes;
 2575|  47.6k|  }
 2576|       |
 2577|  3.51k|  return ntbytes;
 2578|  3.51k|}
blosc2.c:blosc_c:
 1518|  9.70k|                   uint8_t* tmp, uint8_t* tmp2) {
 1519|  9.70k|  blosc2_context* context = thread_context->parent_context;
 1520|  9.70k|  int dont_split = (context->header_flags & 0x10) >> 4;
 1521|  9.70k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 1522|  9.70k|  int dict_training = context->use_dict && context->dict_cdict == NULL;
  ------------------
  |  Branch (1522:23): [True: 0, False: 9.70k]
  |  Branch (1522:44): [True: 0, False: 0]
  ------------------
 1523|  9.70k|  int32_t j, neblock, nstreams;
 1524|  9.70k|  int32_t cbytes;                   /* number of compressed bytes in split */
 1525|  9.70k|  int32_t ctbytes = 0;              /* number of compressed bytes in block */
 1526|  9.70k|  int32_t maxout;
 1527|  9.70k|  int32_t typesize = context->typesize;
 1528|  9.70k|  bool output_is_disposable = (context->preparams != NULL) ? context->preparams->output_is_disposable : false;
  ------------------
  |  Branch (1528:31): [True: 8.05k, False: 1.65k]
  ------------------
 1529|  9.70k|  const char* compname;
 1530|  9.70k|  int accel;
 1531|  9.70k|  const uint8_t* _src;
 1532|  9.70k|  uint8_t *_tmp = tmp, *_tmp2 = tmp2;
 1533|  9.70k|  int last_filter_index = last_filter(context, 'c');
 1534|  9.70k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 1535|  9.70k|  bool instr_codec = context->blosc2_flags & BLOSC2_INSTR_CODEC;
 1536|  9.70k|  blosc_timestamp_t last, current;
 1537|  9.70k|  float filter_time = 0.f;
 1538|       |
 1539|  9.70k|  if (instr_codec) {
  ------------------
  |  Branch (1539:7): [True: 0, False: 9.70k]
  ------------------
 1540|      0|    blosc_set_timestamp(&last);
 1541|      0|  }
 1542|       |
 1543|       |  // See whether we have a run here
 1544|  9.70k|  if (last_filter_index >= 0 || context->prefilter != NULL) {
  ------------------
  |  Branch (1544:7): [True: 9.70k, False: 4]
  |  Branch (1544:33): [True: 4, False: 0]
  ------------------
 1545|       |    /* Apply the filter pipeline just for the prefilter */
 1546|  9.70k|    if (memcpyed && context->prefilter != NULL) {
  ------------------
  |  Branch (1546:9): [True: 2.06k, False: 7.63k]
  |  Branch (1546:21): [True: 2.06k, False: 0]
  ------------------
 1547|       |      // We only need the prefilter output
 1548|  2.06k|      _src = pipeline_forward(thread_context, bsize, src, offset, dest, _tmp2);
 1549|  2.06k|      if (_src == NULL) {
  ------------------
  |  Branch (1549:11): [True: 0, False: 2.06k]
  ------------------
 1550|      0|        return BLOSC2_ERROR_FILTER_PIPELINE;
 1551|      0|      }
 1552|  2.06k|      return bsize;
 1553|  2.06k|    }
 1554|       |    /* Apply regular filter pipeline */
 1555|  7.63k|    _src = pipeline_forward(thread_context, bsize, src, offset, _tmp, _tmp2);
 1556|  7.63k|    if (_src == NULL) {
  ------------------
  |  Branch (1556:9): [True: 2, False: 7.63k]
  ------------------
 1557|      2|      return BLOSC2_ERROR_FILTER_PIPELINE;
 1558|      2|    }
 1559|  7.63k|  } else {
 1560|      0|    _src = src + offset;
 1561|      0|  }
 1562|       |
 1563|  7.63k|  if (instr_codec) {
  ------------------
  |  Branch (1563:7): [True: 0, False: 7.63k]
  ------------------
 1564|      0|    blosc_set_timestamp(&current);
 1565|      0|    filter_time = (float) blosc_elapsed_secs(last, current);
 1566|      0|    last = current;
 1567|      0|  }
 1568|       |
 1569|  7.63k|  assert(context->clevel > 0);
 1570|       |
 1571|       |  /* Calculate acceleration for different compressors */
 1572|  7.63k|  accel = get_accel(context);
 1573|       |
 1574|       |  /* The number of compressed data streams for this block */
 1575|  7.63k|  if (!dont_split && !leftoverblock && !dict_training) {
  ------------------
  |  Branch (1575:7): [True: 0, False: 7.63k]
  |  Branch (1575:22): [True: 0, False: 0]
  |  Branch (1575:40): [True: 0, False: 0]
  ------------------
 1576|      0|    nstreams = (int32_t)typesize;
 1577|      0|  }
 1578|  7.63k|  else {
 1579|  7.63k|    nstreams = 1;
 1580|  7.63k|  }
 1581|  7.63k|  neblock = bsize / nstreams;
 1582|  14.9k|  for (j = 0; j < nstreams; j++) {
  ------------------
  |  Branch (1582:15): [True: 7.63k, False: 7.33k]
  ------------------
 1583|  7.63k|    if (instr_codec) {
  ------------------
  |  Branch (1583:9): [True: 0, False: 7.63k]
  ------------------
 1584|      0|      blosc_set_timestamp(&last);
 1585|      0|    }
 1586|  7.63k|    if (!dict_training) {
  ------------------
  |  Branch (1586:9): [True: 7.63k, False: 0]
  ------------------
 1587|  7.63k|      dest += sizeof(int32_t);
 1588|  7.63k|      ntbytes += sizeof(int32_t);
 1589|  7.63k|      ctbytes += sizeof(int32_t);
 1590|       |
 1591|  7.63k|      if (!vlblocks && context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH && output_is_disposable) {
  ------------------
  |  Branch (1591:11): [True: 7.63k, False: 0]
  |  Branch (1591:24): [True: 7.63k, False: 0]
  |  Branch (1591:84): [True: 0, False: 7.63k]
  ------------------
 1592|       |        // Simulate a run of 0s
 1593|      0|        BLOSC_TRACE_INFO("Output is disposable, simulating a run of 0s");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1594|      0|        memset(dest - 4, 0, sizeof(int32_t));
 1595|      0|        continue;
 1596|      0|      }
 1597|       |
 1598|  7.63k|      const uint8_t *ip = (uint8_t *) _src + j * neblock;
 1599|  7.63k|      const uint8_t *ipbound = (uint8_t *) _src + (j + 1) * neblock;
 1600|       |
 1601|  7.63k|      if (!vlblocks && context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH && get_run(ip, ipbound)) {
  ------------------
  |  Branch (1601:11): [True: 7.63k, False: 0]
  |  Branch (1601:24): [True: 7.63k, False: 0]
  |  Branch (1601:84): [True: 571, False: 7.06k]
  ------------------
 1602|       |        // A run
 1603|    571|        int32_t value = _src[j * neblock];
 1604|    571|        if (ntbytes > destsize) {
  ------------------
  |  Branch (1604:13): [True: 0, False: 571]
  ------------------
 1605|      0|          return 0;    /* Non-compressible data */
 1606|      0|        }
 1607|       |
 1608|    571|        if (instr_codec) {
  ------------------
  |  Branch (1608:13): [True: 0, False: 571]
  ------------------
 1609|      0|          blosc_set_timestamp(&current);
 1610|      0|          int32_t instr_size = sizeof(blosc2_instr);
 1611|      0|          ntbytes += instr_size;
 1612|      0|          ctbytes += instr_size;
 1613|      0|          if (ntbytes > destsize) {
  ------------------
  |  Branch (1613:15): [True: 0, False: 0]
  ------------------
 1614|      0|            return 0;    /* Non-compressible data */
 1615|      0|          }
 1616|      0|          _sw32(dest - 4, instr_size);
 1617|      0|          blosc2_instr *desti = (blosc2_instr *)dest;
 1618|      0|          memset(desti, 0, sizeof(blosc2_instr));
 1619|       |          // Special values have an overhead of about 1 int32
 1620|      0|          int32_t ssize = value == 0 ? sizeof(int32_t) : sizeof(int32_t) + 1;
  ------------------
  |  Branch (1620:27): [True: 0, False: 0]
  ------------------
 1621|      0|          desti->cratio = (float) neblock / (float) ssize;
 1622|      0|          float ctime = (float) blosc_elapsed_secs(last, current);
 1623|      0|          desti->cspeed = (float) neblock / ctime;
 1624|      0|          desti->filter_speed = (float) neblock / filter_time;
 1625|      0|          desti->flags[0] = 1;    // mark a runlen
 1626|      0|          dest += instr_size;
 1627|      0|          continue;
 1628|      0|        }
 1629|       |
 1630|       |        // Encode the repeated byte in the first (LSB) byte of the length of the split.
 1631|    571|        _sw32(dest - 4, -value);    // write the value in two's complement
 1632|    571|        if (value > 0) {
  ------------------
  |  Branch (1632:13): [True: 210, False: 361]
  ------------------
 1633|       |          // Mark encoding as a run-length (== 0 is always a 0's run)
 1634|    210|          ntbytes += 1;
 1635|    210|          ctbytes += 1;
 1636|    210|          if (ntbytes > destsize) {
  ------------------
  |  Branch (1636:15): [True: 0, False: 210]
  ------------------
 1637|      0|            return 0;    /* Non-compressible data */
 1638|      0|          }
 1639|       |          // Set MSB bit (sign) to 1 (not really necessary here, but for demonstration purposes)
 1640|       |          // dest[-1] |= 0x80;
 1641|    210|          dest[0] = 0x1;   // set run-length bit (0) in token
 1642|    210|          dest += 1;
 1643|    210|        }
 1644|    571|        continue;
 1645|    571|      }
 1646|  7.63k|    }
 1647|       |
 1648|  7.06k|    maxout = neblock;
 1649|  7.06k|    if (ntbytes + maxout > destsize && !instr_codec) {
  ------------------
  |  Branch (1649:9): [True: 844, False: 6.22k]
  |  Branch (1649:40): [True: 844, False: 0]
  ------------------
 1650|       |      /* avoid buffer * overrun */
 1651|    844|      maxout = destsize - ntbytes;
 1652|    844|      if (maxout <= 0) {
  ------------------
  |  Branch (1652:11): [True: 31, False: 813]
  ------------------
 1653|     31|        return 0;                  /* non-compressible block */
 1654|     31|      }
 1655|    844|    }
 1656|  7.03k|    if (dict_training) {
  ------------------
  |  Branch (1656:9): [True: 0, False: 7.03k]
  ------------------
 1657|       |      // We are in the build dict state, so don't compress
 1658|       |      // TODO: copy only a percentage for sampling
 1659|      0|      memcpy(dest, _src + j * neblock, (unsigned int)neblock);
 1660|      0|      cbytes = (int32_t)neblock;
 1661|      0|    }
 1662|  7.03k|    else if (context->compcode == BLOSC_BLOSCLZ) {
  ------------------
  |  Branch (1662:14): [True: 1.24k, False: 5.79k]
  ------------------
 1663|  1.24k|      if (thread_context->blosclz_state == NULL) {
  ------------------
  |  Branch (1663:11): [True: 52, False: 1.19k]
  ------------------
 1664|     52|        thread_context->blosclz_state = calloc(1, sizeof(blosclz_state));
 1665|     52|      }
 1666|  1.24k|      cbytes = thread_context->blosclz_state != NULL ?
  ------------------
  |  Branch (1666:16): [True: 1.24k, False: 0]
  ------------------
 1667|  1.24k|               blosclz_compress_state(context->clevel, _src + j * neblock, (int)neblock,
 1668|  1.24k|                                      dest, maxout, thread_context->blosclz_state) :
 1669|  1.24k|               blosclz_compress(context->clevel, _src + j * neblock, (int)neblock,
 1670|      0|                                dest, maxout, context);
 1671|  1.24k|    }
 1672|  5.79k|    else if (context->compcode == BLOSC_LZ4) {
  ------------------
  |  Branch (1672:14): [True: 654, False: 5.13k]
  ------------------
 1673|    654|      cbytes = lz4_wrap_compress((char*)_src + j * neblock, (size_t)neblock,
 1674|    654|                                 (char*)dest, (size_t)maxout, accel,
 1675|    654|                                 thread_context);
 1676|    654|    }
 1677|  5.13k|    else if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (1677:14): [True: 0, False: 5.13k]
  ------------------
 1678|      0|      cbytes = lz4hc_wrap_compress((char*)_src + j * neblock, (size_t)neblock,
 1679|      0|                                   (char*)dest, (size_t)maxout, context->clevel,
 1680|      0|                                   thread_context);
 1681|      0|    }
 1682|  5.13k|  #if defined(HAVE_ZLIB)
 1683|  5.13k|    else if (context->compcode == BLOSC_ZLIB) {
  ------------------
  |  Branch (1683:14): [True: 0, False: 5.13k]
  ------------------
 1684|      0|      cbytes = zlib_wrap_compress((char*)_src + j * neblock, (size_t)neblock,
 1685|      0|                                  (char*)dest, (size_t)maxout, context->clevel);
 1686|      0|    }
 1687|  5.13k|  #endif /* HAVE_ZLIB */
 1688|  5.13k|  #if defined(HAVE_ZSTD)
 1689|  5.13k|    else if (context->compcode == BLOSC_ZSTD) {
  ------------------
  |  Branch (1689:14): [True: 5.00k, False: 136]
  ------------------
 1690|  5.00k|      cbytes = zstd_wrap_compress(thread_context,
 1691|  5.00k|                                  (char*)_src + j * neblock, (size_t)neblock,
 1692|  5.00k|                                  (char*)dest, (size_t)maxout, context->clevel);
 1693|  5.00k|    }
 1694|    136|  #endif /* HAVE_ZSTD */
 1695|    136|    else if (context->compcode > BLOSC2_DEFINED_CODECS_STOP) {
  ------------------
  |  Branch (1695:14): [True: 136, False: 0]
  ------------------
 1696|    426|      for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (1696:23): [True: 426, False: 0]
  ------------------
 1697|    426|        if (g_codecs[i].compcode == context->compcode) {
  ------------------
  |  Branch (1697:13): [True: 136, False: 290]
  ------------------
 1698|    136|          if (load_acquire_ptr(&g_codecs[i].decoder) == NULL) {
  ------------------
  |  |  144|    136|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (1698:15): [True: 0, False: 136]
  ------------------
 1699|       |            // Dynamically load codec plugin
 1700|      0|            if (fill_codec(&g_codecs[i]) < 0) {
  ------------------
  |  Branch (1700:17): [True: 0, False: 0]
  ------------------
 1701|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1702|      0|              return BLOSC2_ERROR_CODEC_SUPPORT;
 1703|      0|            }
 1704|      0|          }
 1705|    136|          blosc2_cparams cparams;
 1706|    136|          blosc2_ctx_get_cparams(context, &cparams);
 1707|    136|          cbytes = g_codecs[i].encoder(_src + j * neblock,
 1708|    136|                                        neblock,
 1709|    136|                                        dest,
 1710|    136|                                        maxout,
 1711|    136|                                        context->compcode_meta,
 1712|    136|                                        &cparams,
 1713|    136|                                        context->src);
 1714|    136|          goto urcodecsuccess;
 1715|    136|        }
 1716|    426|      }
 1717|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1718|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 1719|    136|    urcodecsuccess:
 1720|    136|      ;
 1721|    136|    } else {
 1722|      0|      blosc2_compcode_to_compname(context->compcode, &compname);
 1723|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1724|      0|                        "Please use one having it.", compname);
 1725|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 1726|      0|    }
 1727|       |
 1728|  7.03k|    if (cbytes > maxout) {
  ------------------
  |  Branch (1728:9): [True: 0, False: 7.03k]
  ------------------
 1729|       |      /* Buffer overrun caused by compression (should never happen) */
 1730|      0|      return BLOSC2_ERROR_WRITE_BUFFER;
 1731|      0|    }
 1732|  7.03k|    if (cbytes < 0) {
  ------------------
  |  Branch (1732:9): [True: 0, False: 7.03k]
  ------------------
 1733|       |      /* cbytes should never be negative */
 1734|      0|      return BLOSC2_ERROR_DATA;
 1735|      0|    }
 1736|  7.03k|    if (cbytes == 0) {
  ------------------
  |  Branch (1736:9): [True: 2.13k, False: 4.90k]
  ------------------
 1737|       |      // When cbytes is 0, the compressor has not been able to compress anything
 1738|  2.13k|      cbytes = neblock;
 1739|  2.13k|    }
 1740|       |
 1741|  7.03k|    if (instr_codec) {
  ------------------
  |  Branch (1741:9): [True: 0, False: 7.03k]
  ------------------
 1742|      0|      blosc_set_timestamp(&current);
 1743|      0|      int32_t instr_size = sizeof(blosc2_instr);
 1744|      0|      ntbytes += instr_size;
 1745|      0|      ctbytes += instr_size;
 1746|      0|      if (ntbytes > destsize) {
  ------------------
  |  Branch (1746:11): [True: 0, False: 0]
  ------------------
 1747|      0|        return 0;    /* Non-compressible data */
 1748|      0|      }
 1749|      0|      _sw32(dest - 4, vlblocks ? neblock : instr_size);
  ------------------
  |  Branch (1749:23): [True: 0, False: 0]
  ------------------
 1750|      0|      float ctime = (float)blosc_elapsed_secs(last, current);
 1751|      0|      blosc2_instr *desti = (blosc2_instr *)dest;
 1752|      0|      memset(desti, 0, sizeof(blosc2_instr));
 1753|       |      // cratio is computed having into account 1 additional int (csize)
 1754|      0|      desti->cratio = (float)neblock / (float)(cbytes + sizeof(int32_t));
 1755|      0|      desti->cspeed = (float)neblock / ctime;
 1756|      0|      desti->filter_speed = (float) neblock / filter_time;
 1757|      0|      dest += instr_size;
 1758|      0|      continue;
 1759|      0|    }
 1760|       |
 1761|  7.03k|    if (!dict_training) {
  ------------------
  |  Branch (1761:9): [True: 7.03k, False: 0]
  ------------------
 1762|  7.03k|      if (cbytes == neblock) {
  ------------------
  |  Branch (1762:11): [True: 2.13k, False: 4.89k]
  ------------------
 1763|       |        /* The compressor has been unable to compress data at all. */
 1764|       |        /* Before doing the copy, check that we are not running into a
 1765|       |           buffer overflow. */
 1766|  2.13k|        if ((ntbytes + neblock) > destsize) {
  ------------------
  |  Branch (1766:13): [True: 274, False: 1.86k]
  ------------------
 1767|    274|          return 0;    /* Non-compressible data */
 1768|    274|        }
 1769|  1.86k|        memcpy(dest, _src + j * neblock, (unsigned int)neblock);
 1770|  1.86k|        cbytes = neblock;
 1771|  1.86k|      }
 1772|  6.75k|      _sw32(dest - 4, vlblocks ? neblock : cbytes);
  ------------------
  |  Branch (1772:23): [True: 0, False: 6.75k]
  ------------------
 1773|  6.75k|    }
 1774|  6.75k|    dest += cbytes;
 1775|  6.75k|    ntbytes += cbytes;
 1776|  6.75k|    ctbytes += cbytes;
 1777|  6.75k|  }  /* Closes j < nstreams */
 1778|       |
 1779|  7.33k|  return ctbytes;
 1780|  7.63k|}
blosc2.c:get_accel:
  759|  7.63k|static int get_accel(const blosc2_context* context) {
  760|  7.63k|  int clevel = context->clevel;
  761|       |
  762|  7.63k|  if (context->compcode == BLOSC_LZ4) {
  ------------------
  |  Branch (762:7): [True: 784, False: 6.85k]
  ------------------
  763|       |    /* This acceleration setting based on discussions held in:
  764|       |     * https://groups.google.com/forum/#!topic/lz4c/zosy90P8MQw
  765|       |     */
  766|    784|    return (10 - clevel);
  767|    784|  }
  768|  6.85k|  return 1;
  769|  7.63k|}
blosc2.c:get_run:
 1460|  7.63k|static bool get_run(const uint8_t* ip, const uint8_t* ip_bound) {
 1461|  7.63k|  uint8_t x = *ip;
 1462|  7.63k|  int64_t value, value2;
 1463|       |  /* Broadcast the value for every byte in a 64-bit register */
 1464|  7.63k|  memset(&value, x, 8);
 1465|  7.63k|#if defined(BLOSC_RUN_SSE2) || defined(BLOSC_RUN_NEON)
 1466|  7.63k|  if (ip_bound - ip >= 64) {
  ------------------
  |  Branch (1466:7): [True: 6.96k, False: 675]
  ------------------
 1467|       |    /* Streams that are not runs mostly differ in their first bytes */
 1468|  6.96k|    memcpy(&value2, ip, 8);
 1469|  6.96k|    if (value != value2) {
  ------------------
  |  Branch (1469:9): [True: 5.62k, False: 1.33k]
  ------------------
 1470|  5.62k|      return false;
 1471|  5.62k|    }
 1472|  6.96k|  }
 1473|  2.01k|#endif
 1474|  2.01k|#if defined(BLOSC_RUN_SSE2)
 1475|  2.01k|  const __m128i vx = _mm_set1_epi8((char)x);
 1476|  2.95k|  while (ip_bound - ip >= 64) {
  ------------------
  |  Branch (1476:10): [True: 1.76k, False: 1.19k]
  ------------------
 1477|  1.76k|    const __m128i* p = (const __m128i*)ip;
 1478|  1.76k|    __m128i eq01 = _mm_and_si128(_mm_cmpeq_epi8(_mm_loadu_si128(p), vx),
 1479|  1.76k|                                 _mm_cmpeq_epi8(_mm_loadu_si128(p + 1), vx));
 1480|  1.76k|    __m128i eq23 = _mm_and_si128(_mm_cmpeq_epi8(_mm_loadu_si128(p + 2), vx),
 1481|  1.76k|                                 _mm_cmpeq_epi8(_mm_loadu_si128(p + 3), vx));
 1482|  1.76k|    if (_mm_movemask_epi8(_mm_and_si128(eq01, eq23)) != 0xFFFF) {
  ------------------
  |  Branch (1482:9): [True: 818, False: 943]
  ------------------
 1483|    818|      return false;
 1484|    818|    }
 1485|    943|    ip += 64;
 1486|    943|  }
 1487|       |#elif defined(BLOSC_RUN_NEON)
 1488|       |  const uint8x16_t vx = vdupq_n_u8(x);
 1489|       |  while (ip_bound - ip >= 64) {
 1490|       |    uint8x16_t diff01 = vorrq_u8(veorq_u8(vld1q_u8(ip), vx), veorq_u8(vld1q_u8(ip + 16), vx));
 1491|       |    uint8x16_t diff23 = vorrq_u8(veorq_u8(vld1q_u8(ip + 32), vx), veorq_u8(vld1q_u8(ip + 48), vx));
 1492|       |    if (vmaxvq_u32(vreinterpretq_u32_u8(vorrq_u8(diff01, diff23))) != 0) {
 1493|       |      return false;
 1494|       |    }
 1495|       |    ip += 64;
 1496|       |  }
 1497|       |#endif
 1498|  1.49k|  while (ip < (ip_bound - 8)) {
  ------------------
  |  Branch (1498:10): [True: 907, False: 590]
  ------------------
 1499|    907|    memcpy(&value2, ip, 8);
 1500|    907|    if (value != value2) {
  ------------------
  |  Branch (1500:9): [True: 604, False: 303]
  ------------------
 1501|       |      // Values differ.  We don't have a run.
 1502|    604|      return false;
 1503|    604|    }
 1504|    303|    else {
 1505|    303|      ip += 8;
 1506|    303|    }
 1507|    907|  }
 1508|       |  /* Look into the remainder */
 1509|  1.07k|  while ((ip < ip_bound) && (*ip == x)) ip++;
  ------------------
  |  Branch (1509:10): [True: 502, False: 571]
  |  Branch (1509:29): [True: 483, False: 19]
  ------------------
 1510|    590|  return ip == ip_bound ? true : false;
  ------------------
  |  Branch (1510:10): [True: 571, False: 19]
  ------------------
 1511|  1.19k|}
blosc2.c:lz4_wrap_compress:
  574|    654|                             struct thread_context* thread_context) {
  575|    654|  int cbytes;
  576|    654|  blosc2_context* context = thread_context->parent_context;
  577|    654|  if (context->use_dict && context->dict_cdict != NULL) {
  ------------------
  |  Branch (577:7): [True: 0, False: 654]
  |  Branch (577:28): [True: 0, False: 0]
  ------------------
  578|      0|    if (thread_context->lz4_cstream == NULL) {
  ------------------
  |  Branch (578:9): [True: 0, False: 0]
  ------------------
  579|      0|      thread_context->lz4_cstream = LZ4_createStream();
  580|      0|      if (thread_context->lz4_cstream == NULL) {
  ------------------
  |  Branch (580:11): [True: 0, False: 0]
  ------------------
  581|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
  582|      0|      }
  583|      0|    }
  584|       |    // Reset the thread stream to dict-only context before each block so that
  585|       |    // each compressed block references only the dictionary (not prior blocks).
  586|       |    // This ensures independent decompressibility with LZ4_decompress_safe_usingDict.
  587|      0|    LZ4_loadDict((LZ4_stream_t*)thread_context->lz4_cstream,
  588|      0|                 (const char*)context->dict_buffer, (int)context->dict_size);
  589|      0|    cbytes = LZ4_compress_fast_continue((LZ4_stream_t*)thread_context->lz4_cstream,
  590|      0|                                        input, output, (int)input_length, (int)maxout, accel);
  591|    654|  } else {
  592|    654|#ifdef BLOSC_LZ4_FAST_RESET
  593|    654|    if (thread_context->lz4_cstream == NULL) {
  ------------------
  |  Branch (593:9): [True: 4, False: 650]
  ------------------
  594|      4|      thread_context->lz4_cstream = LZ4_createStream();
  595|      4|      if (thread_context->lz4_cstream == NULL) {
  ------------------
  |  Branch (595:11): [True: 0, False: 4]
  ------------------
  596|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
  597|      0|      }
  598|      4|    }
  599|       |    // Keep the same independent-block compressor and its small-input table
  600|       |    // selection, but retain worker-local state instead of clearing a new table
  601|       |    // for every stream. The streaming API chooses a different table for small
  602|       |    // inputs, so keep the independent-block entry point here.
  603|    654|    cbytes = LZ4_compress_fast_extState_fastReset(thread_context->lz4_cstream,
  604|    654|        input, output, (int)input_length, (int)maxout, accel);
  605|       |#else
  606|       |    cbytes = LZ4_compress_fast(input, output, (int)input_length, (int)maxout, accel);
  607|       |#endif
  608|    654|  }
  609|    654|  return cbytes;
  610|    654|}
blosc2.c:zstd_wrap_compress:
  702|  5.00k|                              char* output, size_t maxout, int clevel) {
  703|  5.00k|  size_t code;
  704|  5.00k|  blosc2_context* context = thread_context->parent_context;
  705|       |
  706|  5.00k|  clevel = (clevel < 9) ? clevel * 2 - 1 : ZSTD_maxCLevel();
  ------------------
  |  Branch (706:12): [True: 4.47k, False: 528]
  ------------------
  707|       |  /* Make the level 8 close enough to maxCLevel */
  708|  5.00k|  if (clevel == 8) clevel = ZSTD_maxCLevel() - 2;
  ------------------
  |  Branch (708:7): [True: 0, False: 5.00k]
  ------------------
  709|       |
  710|  5.00k|  if (thread_context->zstd_cctx == NULL) {
  ------------------
  |  Branch (710:7): [True: 38, False: 4.96k]
  ------------------
  711|     38|    thread_context->zstd_cctx = ZSTD_createCCtx();
  712|     38|  }
  713|       |
  714|  5.00k|  if (context->use_dict) {
  ------------------
  |  Branch (714:7): [True: 0, False: 5.00k]
  ------------------
  715|      0|    assert(context->dict_cdict != NULL);
  716|      0|    code = ZSTD_compress_usingCDict(
  717|      0|            thread_context->zstd_cctx, (void*)output, maxout, (void*)input,
  718|      0|            input_length, context->dict_cdict);
  719|  5.00k|  } else {
  720|  5.00k|    code = ZSTD_compressCCtx(thread_context->zstd_cctx,
  721|  5.00k|        (void*)output, maxout, (void*)input, input_length, clevel);
  722|  5.00k|  }
  723|  5.00k|  if (ZSTD_isError(code) != ZSTD_error_no_error) {
  ------------------
  |  Branch (723:7): [True: 1.84k, False: 3.15k]
  ------------------
  724|       |    // Blosc will just memcpy this buffer
  725|  1.84k|    return 0;
  726|  1.84k|  }
  727|  3.15k|  return (int)code;
  728|  5.00k|}
blosc2.c:fit_thread_context:
 2704|  4.95k|static int fit_thread_context(struct thread_context* thread_context, blosc2_context* context) {
 2705|  4.95k|  int32_t ebsize = context->blocksize + context->typesize * (int32_t)sizeof(int32_t);
 2706|  4.95k|  if ((size_t)4 * ebsize <= thread_context->tmp_nbytes) {
  ------------------
  |  Branch (2706:7): [True: 4.93k, False: 16]
  ------------------
 2707|  4.93k|    return 0;
 2708|  4.93k|  }
 2709|     16|  my_free(thread_context->tmp);
 2710|     16|  thread_context->tmp = my_malloc((size_t)4 * ebsize);
 2711|     16|  if (thread_context->tmp == NULL) {
  ------------------
  |  Branch (2711:7): [True: 0, False: 16]
  ------------------
 2712|      0|    thread_context->tmp_nbytes = 0;
 2713|      0|    thread_context->tmp_blocksize = 0;
 2714|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2715|      0|  }
 2716|     16|  thread_context->tmp_nbytes = (size_t)4 * ebsize;
 2717|     16|  thread_context->tmp2 = thread_context->tmp + ebsize;
 2718|     16|  thread_context->tmp3 = thread_context->tmp2 + ebsize;
 2719|     16|  thread_context->tmp4 = thread_context->tmp3 + ebsize;
 2720|     16|  thread_context->tmp_blocksize = context->blocksize;
 2721|     16|  return 0;
 2722|     16|}
blosc2.c:read_lazy_chunk_bytes:
 3004|      3|                                 const char* open_error, const char* read_error) {
 3005|      3|  int32_t chunk_cbytes;
 3006|      3|  if (context->src == NULL || context->srcsize < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3006:7): [True: 0, False: 3]
  |  Branch (3006:31): [True: 0, False: 3]
  ------------------
 3007|      3|      offset < 0 || nbytes < 0 || context->nblocks <= 0 ||
  ------------------
  |  Branch (3007:7): [True: 0, False: 3]
  |  Branch (3007:21): [True: 0, False: 3]
  |  Branch (3007:35): [True: 0, False: 3]
  ------------------
 3008|      3|      blosc2_cbuffer_sizes(context->src, NULL, &chunk_cbytes, NULL) < 0 ||
  ------------------
  |  Branch (3008:7): [True: 0, False: 3]
  ------------------
 3009|      3|      offset > chunk_cbytes || nbytes > chunk_cbytes - offset) {
  ------------------
  |  Branch (3009:7): [True: 0, False: 3]
  |  Branch (3009:32): [True: 0, False: 3]
  ------------------
 3010|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3011|      0|  }
 3012|      3|  int64_t trailer_end = BLOSC_EXTENDED_HEADER_LENGTH +
 3013|      3|      (int64_t)context->nblocks * sizeof(int32_t) + sizeof(int32_t) + sizeof(int64_t);
 3014|      3|  if (trailer_end > context->srcsize) return BLOSC2_ERROR_READ_BUFFER;
  ------------------
  |  Branch (3014:7): [True: 3, False: 0]
  ------------------
 3015|      0|  if (context->schunk == NULL || context->schunk->frame == NULL) {
  ------------------
  |  Branch (3015:7): [True: 0, False: 0]
  |  Branch (3015:34): [True: 0, False: 0]
  ------------------
 3016|      0|    BLOSC_TRACE_ERROR("Lazy chunk needs an associated super-chunk with 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3017|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3018|      0|  }
 3019|       |
 3020|      0|  blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 3021|      0|  blosc2_io_cb* io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 3022|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (3022:7): [True: 0, False: 0]
  ------------------
 3023|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3024|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 3025|      0|  }
 3026|       |
 3027|      0|  int32_t trailer_offset = BLOSC_EXTENDED_HEADER_LENGTH +
 3028|      0|                           context->nblocks * (int32_t)sizeof(int32_t);
 3029|      0|  int32_t nchunk_lazy;
 3030|      0|  int64_t chunk_offset;
 3031|      0|  memcpy(&nchunk_lazy, context->src + trailer_offset, sizeof(nchunk_lazy));
 3032|      0|  memcpy(&chunk_offset, context->src + trailer_offset + (int32_t)sizeof(int32_t), sizeof(chunk_offset));
 3033|      0|  if (nchunk_lazy < 0 || chunk_offset < 0 || frame->file_offset < 0 ||
  ------------------
  |  Branch (3033:7): [True: 0, False: 0]
  |  Branch (3033:26): [True: 0, False: 0]
  |  Branch (3033:46): [True: 0, False: 0]
  ------------------
 3034|      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 (3034:8): [True: 0, False: 0]
  |  Branch (3034:27): [True: 0, False: 0]
  ------------------
 3035|      0|       chunk_offset > frame->len || chunk_cbytes > frame->len - chunk_offset))) {
  ------------------
  |  Branch (3035:8): [True: 0, False: 0]
  |  Branch (3035:37): [True: 0, False: 0]
  ------------------
 3036|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3037|      0|  }
 3038|       |
 3039|      0|  void* fp = NULL;
 3040|      0|  int64_t io_pos;
 3041|      0|  if (frame->sframe) {
  ------------------
  |  Branch (3041:7): [True: 0, False: 0]
  ------------------
 3042|      0|    fp = sframe_open_chunk(frame->urlpath, nchunk_lazy, "rb", context->schunk->storage->io);
 3043|      0|    io_pos = offset;
 3044|      0|  }
 3045|      0|  else {
 3046|      0|    if (chunk_offset < 0 || offset < 0) {
  ------------------
  |  Branch (3046:9): [True: 0, False: 0]
  |  Branch (3046:29): [True: 0, False: 0]
  ------------------
 3047|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3048|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3049|      0|    }
 3050|      0|    fp = frame_reader_acquire(frame, context->schunk->storage->io);
 3051|      0|    if (!blosc2_checked_add_i64(frame->file_offset, chunk_offset, &io_pos)) {
  ------------------
  |  Branch (3051:9): [True: 0, False: 0]
  ------------------
 3052|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3053|      0|      if (fp != NULL) {
  ------------------
  |  Branch (3053:11): [True: 0, False: 0]
  ------------------
 3054|      0|        frame_reader_release(frame, io_cb, fp);
 3055|      0|      }
 3056|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3057|      0|    }
 3058|      0|    if (!blosc2_checked_add_i64(io_pos, offset, &io_pos)) {
  ------------------
  |  Branch (3058:9): [True: 0, False: 0]
  ------------------
 3059|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3060|      0|      if (fp != NULL) {
  ------------------
  |  Branch (3060:11): [True: 0, False: 0]
  ------------------
 3061|      0|        frame_reader_release(frame, io_cb, fp);
 3062|      0|      }
 3063|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3064|      0|    }
 3065|      0|  }
 3066|      0|  if (fp == NULL) {
  ------------------
  |  Branch (3066:7): [True: 0, False: 0]
  ------------------
 3067|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3068|      0|    return BLOSC2_ERROR_FILE_OPEN;
 3069|      0|  }
 3070|      0|  if (!blosc2_checked_add_i64(io_pos, nbytes, NULL)) {
  ------------------
  |  Branch (3070:7): [True: 0, False: 0]
  ------------------
 3071|      0|    frame_reader_release(frame, io_cb, fp);
 3072|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3073|      0|  }
 3074|       |
 3075|      0|  uint8_t* read_buffer = buffer;
 3076|      0|  int64_t rbytes = io_cb->read((void**)&read_buffer, 1, nbytes, io_pos, fp);
 3077|      0|  bool complete = rbytes == nbytes && read_buffer != NULL;
  ------------------
  |  Branch (3077:19): [True: 0, False: 0]
  |  Branch (3077:39): [True: 0, False: 0]
  ------------------
 3078|      0|  if (complete && read_buffer != buffer) {
  ------------------
  |  Branch (3078:7): [True: 0, False: 0]
  |  Branch (3078:19): [True: 0, False: 0]
  ------------------
 3079|       |    // An io that hands out its own memory (mmap) keeps owning it
 3080|      0|    memcpy(buffer, read_buffer, (size_t)nbytes);
 3081|      0|  }
 3082|      0|  frame_reader_release(frame, io_cb, fp);
 3083|      0|  if (!complete) {
  ------------------
  |  Branch (3083:7): [True: 0, False: 0]
  ------------------
 3084|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3085|      0|    return BLOSC2_ERROR_FILE_READ;
 3086|      0|  }
 3087|       |
 3088|      0|  return 0;
 3089|      0|}
blosc2.c:serial_context_get:
 2736|  5.13k|static struct thread_context* serial_context_get(blosc2_context* context) {
 2737|  5.13k|  struct thread_context* thread_context = NULL;
 2738|  5.13k|  if (context->serial_context == NULL) {
  ------------------
  |  Branch (2738:7): [True: 5.13k, False: 0]
  ------------------
 2739|  5.13k|    thread_context = serial_context_take_tls(context);
 2740|  5.13k|  }
 2741|  5.13k|  if (thread_context == NULL) {
  ------------------
  |  Branch (2741:7): [True: 56, False: 5.08k]
  ------------------
 2742|     56|    if (context->serial_context != NULL &&
  ------------------
  |  Branch (2742:9): [True: 0, False: 56]
  ------------------
 2743|      0|        context->serial_context->tmp_blocksize != context->blocksize) {
  ------------------
  |  Branch (2743:9): [True: 0, False: 0]
  ------------------
 2744|      0|      free_thread_context(context->serial_context);
 2745|      0|      context->serial_context = NULL;
 2746|      0|    }
 2747|     56|    if (context->serial_context == NULL) {
  ------------------
  |  Branch (2747:9): [True: 56, False: 0]
  ------------------
 2748|     56|      context->serial_context = create_thread_context(context, 0);
 2749|     56|      if (context->serial_context == NULL) {
  ------------------
  |  Branch (2749:11): [True: 0, False: 56]
  ------------------
 2750|      0|        return NULL;
 2751|      0|      }
 2752|     56|    }
 2753|      0|    else if (fit_thread_context(context->serial_context, context) < 0) {
  ------------------
  |  Branch (2753:14): [True: 0, False: 0]
  ------------------
 2754|      0|      return NULL;
 2755|      0|    }
 2756|     56|    thread_context = context->serial_context;
 2757|     56|  }
 2758|  5.13k|  thread_context->parent_context = context;
 2759|  5.13k|  thread_context->tid = 0;
 2760|       |  thread_context->serial = true;
 2761|  5.13k|  return thread_context;
 2762|  5.13k|}
blosc2.c:serial_context_take_tls:
 6741|  5.13k|static struct thread_context* serial_context_take_tls(blosc2_context* context) {
 6742|  5.13k|#if !defined(_WIN32)
 6743|  5.13k|  int32_t ebsize = context->blocksize + context->typesize * (int32_t)sizeof(int32_t);
 6744|  5.13k|  if ((size_t)4 * ebsize > BLOSC2_SERIAL_TLS_MAX) {
  ------------------
  |  | 6664|  5.13k|#define BLOSC2_SERIAL_TLS_MAX (16 * 1024 * 1024)
  ------------------
  |  Branch (6744:7): [True: 56, False: 5.08k]
  ------------------
 6745|     56|    return NULL;
 6746|     56|  }
 6747|  5.08k|  tmp_cache_t *cache = tmp_cache_get(true);
 6748|  5.08k|  if (cache == NULL || cache->serial_busy) {
  ------------------
  |  Branch (6748:7): [True: 0, False: 5.08k]
  |  Branch (6748:24): [True: 0, False: 5.08k]
  ------------------
 6749|      0|    return NULL;
 6750|      0|  }
 6751|  5.08k|  if (cache->serial == NULL) {
  ------------------
  |  Branch (6751:7): [True: 132, False: 4.95k]
  ------------------
 6752|    132|    cache->serial = create_thread_context(context, 0);
 6753|    132|    if (cache->serial == NULL) {
  ------------------
  |  Branch (6753:9): [True: 0, False: 132]
  ------------------
 6754|      0|      return NULL;
 6755|      0|    }
 6756|    132|  }
 6757|  4.95k|  else if (fit_thread_context(cache->serial, context) < 0) {
  ------------------
  |  Branch (6757:12): [True: 0, False: 4.95k]
  ------------------
 6758|      0|    return NULL;
 6759|      0|  }
 6760|  5.08k|  cache->serial_busy = true;
 6761|  5.08k|  return cache->serial;
 6762|       |#else
 6763|       |  BLOSC_UNUSED_PARAM(context);
 6764|       |  return NULL;
 6765|       |#endif
 6766|  5.08k|}
blosc2.c:create_thread_context:
 2616|    188|create_thread_context(blosc2_context* context, int32_t tid) {
 2617|    188|  struct thread_context* thread_context;
 2618|    188|  thread_context = (struct thread_context*)my_malloc(sizeof(struct thread_context));
 2619|    188|  BLOSC_ERROR_NULL(thread_context, NULL);
  ------------------
  |  |  104|    188|    do {                                            \
  |  |  105|    188|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 188]
  |  |  ------------------
  |  |  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|    188|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 188]
  |  |  ------------------
  ------------------
 2620|    188|  int rc = init_thread_context(thread_context, context, tid);
 2621|    188|  if (rc < 0) {
  ------------------
  |  Branch (2621:7): [True: 0, False: 188]
  ------------------
 2622|      0|    my_free(thread_context);
 2623|      0|    return NULL;
 2624|      0|  }
 2625|    188|  return thread_context;
 2626|    188|}
blosc2.c:init_thread_context:
 2584|    188|{
 2585|    188|  int32_t ebsize;
 2586|       |
 2587|    188|  thread_context->parent_context = context;
 2588|    188|  thread_context->owner_pool = NULL;
 2589|    188|  thread_context->tid = tid;
 2590|    188|  thread_context->serial = false;
 2591|    188|  thread_context->blosclz_state = NULL;
 2592|       |
 2593|    188|  int32_t blocksize = context != NULL ? context->blocksize : 0;
  ------------------
  |  Branch (2593:23): [True: 188, False: 0]
  ------------------
 2594|    188|  int32_t typesize = context != NULL ? context->typesize : 0;
  ------------------
  |  Branch (2594:22): [True: 188, False: 0]
  ------------------
 2595|    188|  ebsize = blocksize + typesize * (signed)sizeof(int32_t);
 2596|    188|  thread_context->tmp_nbytes = (size_t)4 * ebsize;
 2597|    188|  thread_context->tmp = my_malloc(thread_context->tmp_nbytes);
 2598|    188|  BLOSC_ERROR_NULL(thread_context->tmp, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    188|    do {                                            \
  |  |  105|    188|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 188]
  |  |  ------------------
  |  |  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|    188|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 188]
  |  |  ------------------
  ------------------
 2599|    188|  thread_context->tmp2 = thread_context->tmp + ebsize;
 2600|    188|  thread_context->tmp3 = thread_context->tmp2 + ebsize;
 2601|    188|  thread_context->tmp4 = thread_context->tmp3 + ebsize;
 2602|    188|  thread_context->tmp_blocksize = blocksize;
 2603|    188|  thread_context->zfp_cell_nitems = 0;
 2604|    188|  thread_context->zfp_cell_start = 0;
 2605|    188|  #if defined(HAVE_ZSTD)
 2606|    188|  thread_context->zstd_cctx = NULL;
 2607|    188|  thread_context->zstd_dctx = NULL;
 2608|    188|  #endif
 2609|    188|  thread_context->lz4_cstream = NULL;
 2610|    188|  thread_context->lz4hc_cstream = NULL;
 2611|       |
 2612|    188|  return 0;
 2613|    188|}
blosc2.c:blosc_d:
 2062|  39.6k|    int32_t nblock, uint8_t* dest, int32_t dest_offset, uint8_t* tmp, uint8_t* tmp2) {
 2063|  39.6k|  blosc2_context* context = thread_context->parent_context;
 2064|  39.6k|  uint8_t *tmp3 = thread_context->tmp4;
 2065|  39.6k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2066|  39.6k|  int32_t compformat = (context->header_flags & (uint8_t)0xe0) >> 5u;
 2067|  39.6k|  int dont_split = (context->header_flags & 0x10) >> 4;
 2068|  39.6k|  int32_t chunk_nbytes;
 2069|  39.6k|  int32_t chunk_cbytes;
 2070|  39.6k|  int nstreams;
 2071|  39.6k|  int32_t neblock;
 2072|  39.6k|  int32_t nbytes;                /* number of decompressed bytes in split */
 2073|  39.6k|  int32_t cbytes;                /* number of compressed bytes in split */
 2074|       |  // int32_t ctbytes = 0;           /* number of compressed bytes in block */
 2075|  39.6k|  int32_t ntbytes = 0;           /* number of uncompressed bytes in block */
 2076|  39.6k|  uint8_t* _dest;
 2077|  39.6k|  int32_t typesize = context->typesize;
 2078|  39.6k|  bool instr_codec = context->blosc2_flags & BLOSC2_INSTR_CODEC;
 2079|  39.6k|  const char* compname;
 2080|  39.6k|  int rc;
 2081|       |
 2082|  39.6k|  if (context->block_maskout != NULL && context->block_maskout[nblock]) {
  ------------------
  |  Branch (2082:7): [True: 14.2k, False: 25.4k]
  |  Branch (2082:41): [True: 1.19k, False: 13.0k]
  ------------------
 2083|       |    // Do not decompress, but act as if we successfully decompressed everything
 2084|  1.19k|    return bsize;
 2085|  1.19k|  }
 2086|       |
 2087|  38.5k|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 2088|  38.5k|  if (rc < 0) {
  ------------------
  |  Branch (2088:7): [True: 0, False: 38.5k]
  ------------------
 2089|      0|    return rc;
 2090|      0|  }
 2091|  38.5k|  if (context->special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (2091:7): [True: 7.94k, False: 30.5k]
  ------------------
 2092|       |    // We need the actual typesize in this case, but it cannot be encoded in the header, so derive it from cbytes
 2093|  7.94k|    typesize = chunk_cbytes - context->header_overhead;
 2094|  7.94k|  }
 2095|       |
 2096|       |  // In some situations (lazychunks) the context can arrive uninitialized
 2097|       |  // (but BITSHUFFLE needs it for accessing the format of the chunk)
 2098|  38.5k|  if (context->src == NULL) {
  ------------------
  |  Branch (2098:7): [True: 0, False: 38.5k]
  ------------------
 2099|      0|    context->src = src;
 2100|      0|  }
 2101|       |
 2102|       |  // Chunks with special values cannot be lazy
 2103|  38.5k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (2103:19): [True: 38.4k, False: 93]
  ------------------
 2104|  38.4k|          (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (2104:11): [True: 15.3k, False: 23.0k]
  |  Branch (2104:46): [True: 0, False: 15.3k]
  ------------------
 2105|  38.5k|  if (is_lazy) {
  ------------------
  |  Branch (2105:7): [True: 0, False: 38.5k]
  ------------------
 2106|       |    // The chunk is on disk, so just lazily load the block
 2107|      0|    if (context->schunk == NULL) {
  ------------------
  |  Branch (2107:9): [True: 0, False: 0]
  ------------------
 2108|      0|      BLOSC_TRACE_ERROR("Lazy chunk needs an associated 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2109|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2110|      0|    }
 2111|      0|    if (context->schunk->frame == NULL) {
  ------------------
  |  Branch (2111:9): [True: 0, False: 0]
  ------------------
 2112|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2113|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2114|      0|    }
 2115|      0|    blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 2116|      0|    size_t bstarts_nbytes;
 2117|      0|    size_t trailer_offset;
 2118|      0|    size_t block_csizes_nbytes;
 2119|      0|    size_t trailer_meta_nbytes;
 2120|      0|    size_t lazy_trailer_end;
 2121|      0|    if (srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (2121:9): [True: 0, False: 0]
  |  Branch (2121:24): [True: 0, False: 0]
  ------------------
 2122|      0|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (2122:9): [True: 0, False: 0]
  ------------------
 2123|      0|        !blosc2_checked_add_size((size_t)BLOSC_EXTENDED_HEADER_LENGTH, bstarts_nbytes, &trailer_offset) ||
  ------------------
  |  Branch (2123:9): [True: 0, False: 0]
  ------------------
 2124|      0|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (2124:9): [True: 0, False: 0]
  ------------------
 2125|      0|        !blosc2_checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (2125:9): [True: 0, False: 0]
  ------------------
 2126|      0|        !blosc2_checked_add_size(trailer_offset, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (2126:9): [True: 0, False: 0]
  ------------------
 2127|      0|        (size_t)srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (2127:9): [True: 0, False: 0]
  ------------------
 2128|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2129|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2130|      0|    }
 2131|      0|    int32_t nchunk;
 2132|      0|    int64_t chunk_offset;
 2133|       |    // The nchunk and the offset of the current chunk are in the trailer
 2134|      0|    memcpy(&nchunk, src + trailer_offset, sizeof(nchunk));
 2135|      0|    memcpy(&chunk_offset, src + trailer_offset + sizeof(int32_t), sizeof(chunk_offset));
 2136|       |    // Get the csize of the nblock
 2137|      0|    if (nblock < 0 || nblock >= context->nblocks) {
  ------------------
  |  Branch (2137:9): [True: 0, False: 0]
  |  Branch (2137:23): [True: 0, False: 0]
  ------------------
 2138|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2139|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2140|      0|    }
 2141|      0|    int32_t *block_csizes = (int32_t *)(src + trailer_offset + sizeof(int32_t) + sizeof(int64_t));
 2142|      0|    int32_t block_csize = block_csizes[nblock];
 2143|      0|    int32_t max_lazy_block_csize = context->blocksize + context->typesize * (signed)sizeof(int32_t);
 2144|      0|    if (block_csize <= 0 || block_csize > max_lazy_block_csize) {
  ------------------
  |  Branch (2144:9): [True: 0, False: 0]
  |  Branch (2144:29): [True: 0, False: 0]
  ------------------
 2145|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2146|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2147|      0|    }
 2148|      0|    if (vlblocks && block_csize <= (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (2148:9): [True: 0, False: 0]
  |  Branch (2148:21): [True: 0, False: 0]
  ------------------
 2149|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2150|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2151|      0|    }
 2152|       |    // Read the lazy block on disk
 2153|      0|    void* fp = NULL;
 2154|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 2155|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (2155:9): [True: 0, False: 0]
  ------------------
 2156|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2157|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 2158|      0|    }
 2159|       |
 2160|      0|    int64_t io_pos = 0;
 2161|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2161:9): [True: 0, False: 0]
  ------------------
 2162|       |      // The chunk is not in the frame
 2163|      0|      fp = sframe_open_chunk(frame->urlpath, nchunk, "rb", context->schunk->storage->io);
 2164|      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]
  |  |  ------------------
  ------------------
 2165|       |      // The offset of the block is src_offset
 2166|      0|      if (src_offset < 0) {
  ------------------
  |  Branch (2166:11): [True: 0, False: 0]
  ------------------
 2167|      0|        frame_reader_release(frame, io_cb, fp);
 2168|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2169|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2170|      0|      }
 2171|      0|      io_pos = src_offset;
 2172|      0|    }
 2173|      0|    else {
 2174|      0|      fp = frame_reader_acquire(frame, context->schunk->storage->io);
 2175|      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]
  |  |  ------------------
  ------------------
 2176|       |      // The offset of the block is src_offset
 2177|      0|      if (src_offset < 0) {
  ------------------
  |  Branch (2177:11): [True: 0, False: 0]
  ------------------
 2178|      0|        frame_reader_release(frame, io_cb, fp);
 2179|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2180|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2181|      0|      }
 2182|      0|      if (chunk_offset < 0) {
  ------------------
  |  Branch (2182:11): [True: 0, False: 0]
  ------------------
 2183|      0|        frame_reader_release(frame, io_cb, fp);
 2184|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2185|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2186|      0|      }
 2187|      0|      if (!blosc2_checked_add_i64(frame->file_offset, chunk_offset, &io_pos)) {
  ------------------
  |  Branch (2187:11): [True: 0, False: 0]
  ------------------
 2188|      0|        frame_reader_release(frame, io_cb, fp);
 2189|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2190|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2191|      0|      }
 2192|      0|      if (!blosc2_checked_add_i64(io_pos, src_offset, &io_pos)) {
  ------------------
  |  Branch (2192:11): [True: 0, False: 0]
  ------------------
 2193|      0|        frame_reader_release(frame, io_cb, fp);
 2194|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2195|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2196|      0|      }
 2197|      0|    }
 2198|       |    // We can make use of tmp3 because it will be used after src is not needed anymore
 2199|      0|    int64_t rbytes = io_cb->read((void**)&tmp3, 1, block_csize, io_pos, fp);
 2200|      0|    frame_reader_release(frame, io_cb, fp);
 2201|      0|    if ((int32_t)rbytes != block_csize) {
  ------------------
  |  Branch (2201:9): [True: 0, False: 0]
  ------------------
 2202|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2203|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2204|      0|    }
 2205|      0|    src = tmp3;
 2206|      0|    src_offset = 0;
 2207|      0|    srcsize = block_csize;
 2208|      0|  }
 2209|       |
 2210|       |  // If the chunk is memcpyed, we just have to copy the block to dest and return
 2211|  38.5k|  if (memcpyed) {
  ------------------
  |  Branch (2211:7): [True: 27.4k, False: 11.0k]
  ------------------
 2212|  27.4k|    int bsize_ = leftoverblock ? chunk_nbytes % context->blocksize : bsize;
  ------------------
  |  Branch (2212:18): [True: 9, False: 27.4k]
  ------------------
 2213|  27.4k|    if (!context->special_type) {
  ------------------
  |  Branch (2213:9): [True: 4.37k, False: 23.0k]
  ------------------
 2214|  4.37k|      if (chunk_nbytes + context->header_overhead != chunk_cbytes) {
  ------------------
  |  Branch (2214:11): [True: 0, False: 4.37k]
  ------------------
 2215|      0|        return BLOSC2_ERROR_WRITE_BUFFER;
 2216|      0|      }
 2217|  4.37k|      if (chunk_cbytes < context->header_overhead + (nblock * context->blocksize) + bsize_) {
  ------------------
  |  Branch (2217:11): [True: 0, False: 4.37k]
  ------------------
 2218|       |        /* Not enough input to copy block */
 2219|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2220|      0|      }
 2221|  4.37k|    }
 2222|  27.4k|    if (!is_lazy) {
  ------------------
  |  Branch (2222:9): [True: 27.4k, False: 0]
  ------------------
 2223|  27.4k|      src += context->header_overhead + nblock * context->blocksize;
 2224|  27.4k|    }
 2225|  27.4k|    _dest = dest + dest_offset;
 2226|  27.4k|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (2226:9): [True: 4.13k, False: 23.3k]
  ------------------
 2227|       |      // We are making use of a postfilter, so use a temp for destination
 2228|  4.13k|      _dest = tmp;
 2229|  4.13k|    }
 2230|  27.4k|    rc = 0;
 2231|  27.4k|    switch (context->special_type) {
 2232|  7.94k|      case BLOSC2_SPECIAL_VALUE:
  ------------------
  |  Branch (2232:7): [True: 7.94k, False: 19.5k]
  ------------------
 2233|       |        // All repeated values
 2234|  7.94k|        rc = set_values(typesize, context->src, _dest, bsize_);
 2235|  7.94k|        if (rc < 0) {
  ------------------
  |  Branch (2235:13): [True: 0, False: 7.94k]
  ------------------
 2236|      0|          BLOSC_TRACE_ERROR("set_values 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2237|      0|          return BLOSC2_ERROR_DATA;
 2238|      0|        }
 2239|  7.94k|        break;
 2240|  15.1k|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (2240:7): [True: 15.1k, False: 12.3k]
  ------------------
 2241|  15.1k|        rc = set_nans(context->typesize, _dest, bsize_);
 2242|  15.1k|        if (rc < 0) {
  ------------------
  |  Branch (2242:13): [True: 2, False: 15.1k]
  ------------------
 2243|      2|          BLOSC_TRACE_ERROR("set_nans failed");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2244|      2|          return BLOSC2_ERROR_DATA;
 2245|      2|        }
 2246|  15.1k|        break;
 2247|  15.1k|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (2247:7): [True: 0, False: 27.4k]
  ------------------
 2248|      0|        memset(_dest, 0, bsize_);
 2249|      0|        break;
 2250|      0|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (2250:7): [True: 0, False: 27.4k]
  ------------------
 2251|       |        // We do nothing here
 2252|      0|        break;
 2253|  4.37k|      default:
  ------------------
  |  Branch (2253:7): [True: 4.37k, False: 23.0k]
  ------------------
 2254|  4.37k|        memcpy(_dest, src, bsize_);
 2255|  27.4k|    }
 2256|  27.4k|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (2256:9): [True: 4.13k, False: 23.3k]
  ------------------
 2257|       |      // Create new postfilter parameters for this block (must be private for each thread)
 2258|  4.13k|      blosc2_postfilter_params postparams;
 2259|  4.13k|      memcpy(&postparams, context->postparams, sizeof(postparams));
 2260|  4.13k|      postparams.input = tmp;
 2261|  4.13k|      postparams.output = dest + dest_offset;
 2262|  4.13k|      postparams.size = bsize;
 2263|  4.13k|      postparams.typesize = typesize;
 2264|  4.13k|      postparams.offset = nblock * context->blocksize;
 2265|  4.13k|      postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (2265:27): [True: 4.13k, False: 0]
  ------------------
 2266|  4.13k|      postparams.nblock = nblock;
 2267|  4.13k|      postparams.tid = thread_context->tid;
 2268|  4.13k|      postparams.ttmp = thread_context->tmp;
 2269|  4.13k|      postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 2270|  4.13k|      postparams.ctx = context;
 2271|       |
 2272|       |      // Execute the postfilter (the processed block will be copied to dest)
 2273|  4.13k|      if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (2273:11): [True: 0, False: 4.13k]
  ------------------
 2274|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2275|      0|        return BLOSC2_ERROR_POSTFILTER;
 2276|      0|      }
 2277|  4.13k|    }
 2278|  27.4k|    thread_context->zfp_cell_nitems = 0;
 2279|       |
 2280|  27.4k|    return bsize_;
 2281|  27.4k|  }
 2282|       |
 2283|  11.0k|  if (!is_lazy && (src_offset <= 0 || src_offset >= srcsize)) {
  ------------------
  |  Branch (2283:7): [True: 11.0k, False: 0]
  |  Branch (2283:20): [True: 0, False: 11.0k]
  |  Branch (2283:39): [True: 2, False: 11.0k]
  ------------------
 2284|       |    /* Invalid block src offset encountered */
 2285|      2|    return BLOSC2_ERROR_DATA;
 2286|      2|  }
 2287|       |
 2288|  11.0k|  src += src_offset;
 2289|  11.0k|  if (vlblocks) {
  ------------------
  |  Branch (2289:7): [True: 0, False: 11.0k]
  ------------------
 2290|      0|    if (context->blockcbytes == NULL || nblock >= context->nblocks ||
  ------------------
  |  Branch (2290:9): [True: 0, False: 0]
  |  Branch (2290:41): [True: 0, False: 0]
  ------------------
 2291|      0|        context->blockcbytes[nblock] <= (int32_t)sizeof(int32_t) ||
  ------------------
  |  Branch (2291:9): [True: 0, False: 0]
  ------------------
 2292|      0|        src_offset > srcsize - context->blockcbytes[nblock]) {
  ------------------
  |  Branch (2292:9): [True: 0, False: 0]
  ------------------
 2293|      0|      return BLOSC2_ERROR_DATA;
 2294|      0|    }
 2295|      0|    srcsize = context->blockcbytes[nblock];
 2296|      0|  }
 2297|  11.0k|  else {
 2298|  11.0k|    srcsize -= src_offset;
 2299|  11.0k|  }
 2300|       |
 2301|  11.0k|  int last_filter_index = last_filter(context, 'd');
 2302|  11.0k|  if (instr_codec) {
  ------------------
  |  Branch (2302:7): [True: 0, False: 11.0k]
  ------------------
 2303|       |    // If instrumented, we don't want to run the filters
 2304|      0|    _dest = dest + dest_offset;
 2305|      0|  }
 2306|  11.0k|  else if (((last_filter_index >= 0) &&
  ------------------
  |  Branch (2306:13): [True: 10.9k, False: 83]
  ------------------
 2307|  10.9k|       (next_filter(context, BLOSC2_MAX_FILTERS, 'd') != BLOSC_DELTA)) ||
  ------------------
  |  Branch (2307:8): [True: 9.26k, False: 1.69k]
  ------------------
 2308|  9.34k|    context->postfilter != NULL) {
  ------------------
  |  Branch (2308:5): [True: 80, False: 1.69k]
  ------------------
 2309|       |    // We are making use of some filter, so use a temp for destination
 2310|  9.34k|    _dest = tmp;
 2311|  9.34k|  }
 2312|  1.69k|  else {
 2313|       |    // If no filters, or only DELTA in pipeline
 2314|  1.69k|    _dest = dest + dest_offset;
 2315|  1.69k|  }
 2316|       |
 2317|       |  /* The number of compressed data streams for this block */
 2318|  11.0k|  if (vlblocks) {
  ------------------
  |  Branch (2318:7): [True: 0, False: 11.0k]
  ------------------
 2319|      0|    nstreams = 1;
 2320|      0|  }
 2321|  11.0k|  else if (!dont_split && !leftoverblock) {
  ------------------
  |  Branch (2321:12): [True: 4, False: 11.0k]
  |  Branch (2321:27): [True: 4, False: 0]
  ------------------
 2322|      4|    nstreams = context->typesize;
 2323|      4|  }
 2324|  11.0k|  else {
 2325|  11.0k|    nstreams = 1;
 2326|  11.0k|  }
 2327|       |
 2328|  11.0k|  neblock = bsize / nstreams;
 2329|  11.0k|  if (neblock == 0) {
  ------------------
  |  Branch (2329:7): [True: 0, False: 11.0k]
  ------------------
 2330|       |    /* Not enough space to output bytes */
 2331|      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]
  |  |  ------------------
  ------------------
 2332|      0|  }
 2333|       |  /* The splits must cover the whole block, or part of tmp is left unwritten */
 2334|  11.0k|  if (neblock * nstreams != bsize) {
  ------------------
  |  Branch (2334:7): [True: 1, False: 11.0k]
  ------------------
 2335|      1|    BLOSC_ERROR(BLOSC2_ERROR_DATA);
  ------------------
  |  |  111|      1|    do {                                            \
  |  |  112|      1|        int rc_ = (rc);                             \
  |  |  113|      1|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 1, False: 0]
  |  |  ------------------
  |  |  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|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2336|      1|  }
 2337|  22.0k|  for (int j = 0; j < nstreams; j++) {
  ------------------
  |  Branch (2337:19): [True: 11.0k, False: 10.9k]
  ------------------
 2338|  11.0k|    if (vlblocks) {
  ------------------
  |  Branch (2338:9): [True: 0, False: 11.0k]
  ------------------
 2339|      0|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2339:11): [True: 0, False: 0]
  ------------------
 2340|       |        /* Not enough input to read compressed bytes */
 2341|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2342|      0|      }
 2343|      0|      neblock = sw32_(src);
 2344|      0|      if (neblock != bsize) {
  ------------------
  |  Branch (2344:11): [True: 0, False: 0]
  ------------------
 2345|      0|        return BLOSC2_ERROR_DATA;
 2346|      0|      }
 2347|      0|      src += sizeof(int32_t);
 2348|      0|      cbytes = srcsize - (int32_t)sizeof(int32_t);
 2349|      0|      srcsize = 0;
 2350|      0|    }
 2351|  11.0k|    else {
 2352|  11.0k|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2352:11): [True: 0, False: 11.0k]
  ------------------
 2353|       |        /* Not enough input to read compressed size */
 2354|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2355|      0|      }
 2356|  11.0k|      srcsize -= sizeof(int32_t);
 2357|  11.0k|      cbytes = sw32_(src);      /* amount of compressed bytes */
 2358|  11.0k|      if (cbytes > 0) {
  ------------------
  |  Branch (2358:11): [True: 10.6k, False: 439]
  ------------------
 2359|  10.6k|        if (srcsize < cbytes) {
  ------------------
  |  Branch (2359:13): [True: 0, False: 10.6k]
  ------------------
 2360|       |          /* Not enough input to read compressed bytes */
 2361|      0|          return BLOSC2_ERROR_READ_BUFFER;
 2362|      0|        }
 2363|  10.6k|        srcsize -= cbytes;
 2364|  10.6k|      }
 2365|  11.0k|      src += sizeof(int32_t);
 2366|  11.0k|    }
 2367|       |    // ctbytes += (signed)sizeof(int32_t);
 2368|       |
 2369|       |    /* Uncompress */
 2370|  11.0k|    if (!vlblocks && cbytes == 0) {
  ------------------
  |  Branch (2370:9): [True: 11.0k, False: 0]
  |  Branch (2370:22): [True: 36, False: 11.0k]
  ------------------
 2371|       |      // A run of 0's
 2372|     36|      memset(_dest, 0, (unsigned int)neblock);
 2373|     36|      nbytes = neblock;
 2374|     36|    }
 2375|  11.0k|    else if (!vlblocks && cbytes < 0) {
  ------------------
  |  Branch (2375:14): [True: 11.0k, False: 0]
  |  Branch (2375:27): [True: 403, False: 10.6k]
  ------------------
 2376|       |      // A negative number means some encoding depending on the token that comes next
 2377|    403|      uint8_t token;
 2378|       |
 2379|    403|      if (srcsize < (signed)sizeof(uint8_t)) {
  ------------------
  |  Branch (2379:11): [True: 0, False: 403]
  ------------------
 2380|       |        // Not enough input to read token */
 2381|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2382|      0|      }
 2383|    403|      srcsize -= sizeof(uint8_t);
 2384|       |
 2385|    403|      token = src[0];
 2386|    403|      src += 1;
 2387|       |      // ctbytes += 1;
 2388|       |
 2389|    403|      if (token & 0x1) {
  ------------------
  |  Branch (2389:11): [True: 403, False: 0]
  ------------------
 2390|       |        // A run of bytes that are different than 0
 2391|    403|        if (cbytes < -255) {
  ------------------
  |  Branch (2391:13): [True: 2, False: 401]
  ------------------
 2392|       |          // Runs can only encode a byte
 2393|      2|          return BLOSC2_ERROR_RUN_LENGTH;
 2394|      2|        }
 2395|    401|        uint8_t value = -cbytes;
 2396|    401|        memset(_dest, value, (unsigned int)neblock);
 2397|    401|      } else {
 2398|      0|        BLOSC_TRACE_ERROR("Invalid or unsupported compressed stream token value - %d", token);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2399|      0|        return BLOSC2_ERROR_RUN_LENGTH;
 2400|      0|      }
 2401|    401|      nbytes = neblock;
 2402|    401|      cbytes = 0;  // everything is encoded in the cbytes token
 2403|    401|    }
 2404|  10.6k|    else if (cbytes == neblock) {
  ------------------
  |  Branch (2404:14): [True: 852, False: 9.75k]
  ------------------
 2405|    852|      memcpy(_dest, src, (unsigned int)neblock);
 2406|    852|      nbytes = (int32_t)neblock;
 2407|    852|    }
 2408|  9.75k|    else {
 2409|  9.75k|      if (compformat == BLOSC_BLOSCLZ_FORMAT) {
  ------------------
  |  Branch (2409:11): [True: 3.17k, False: 6.57k]
  ------------------
 2410|  3.17k|        nbytes = blosclz_decompress(src, cbytes, _dest, (int)neblock);
 2411|  3.17k|      }
 2412|  6.57k|      else if (compformat == BLOSC_LZ4_FORMAT) {
  ------------------
  |  Branch (2412:16): [True: 1.26k, False: 5.31k]
  ------------------
 2413|  1.26k|        nbytes = lz4_wrap_decompress((char*)src, (size_t)cbytes,
 2414|  1.26k|                                     (char*)_dest, (size_t)neblock,
 2415|  1.26k|                                     thread_context);
 2416|  1.26k|      }
 2417|  5.31k|  #if defined(HAVE_ZLIB)
 2418|  5.31k|      else if (compformat == BLOSC_ZLIB_FORMAT) {
  ------------------
  |  Branch (2418:16): [True: 18, False: 5.29k]
  ------------------
 2419|     18|        nbytes = zlib_wrap_decompress((char*)src, (size_t)cbytes,
 2420|     18|                                      (char*)_dest, (size_t)neblock);
 2421|     18|      }
 2422|  5.29k|  #endif /*  HAVE_ZLIB */
 2423|  5.29k|  #if defined(HAVE_ZSTD)
 2424|  5.29k|      else if (compformat == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (2424:16): [True: 5.02k, False: 268]
  ------------------
 2425|  5.02k|        nbytes = zstd_wrap_decompress(thread_context,
 2426|  5.02k|                                      (char*)src, (size_t)cbytes,
 2427|  5.02k|                                      (char*)_dest, (size_t)neblock);
 2428|  5.02k|      }
 2429|    268|  #endif /*  HAVE_ZSTD */
 2430|    268|      else if (compformat == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (2430:16): [True: 268, False: 0]
  ------------------
 2431|    268|        bool getcell = false;
 2432|       |
 2433|    268|#if defined(HAVE_ZFP)
 2434|    268|        if ((context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) &&
  ------------------
  |  Branch (2434:13): [True: 72, False: 196]
  ------------------
 2435|     72|            (thread_context->zfp_cell_nitems > 0)) {
  ------------------
  |  Branch (2435:13): [True: 0, False: 72]
  ------------------
 2436|      0|          nbytes = zfp_getcell(thread_context, src, cbytes, _dest, neblock);
 2437|      0|          if (nbytes < 0) {
  ------------------
  |  Branch (2437:15): [True: 0, False: 0]
  ------------------
 2438|      0|            return BLOSC2_ERROR_DATA;
 2439|      0|          }
 2440|      0|          if (nbytes == thread_context->zfp_cell_nitems * typesize) {
  ------------------
  |  Branch (2440:15): [True: 0, False: 0]
  ------------------
 2441|      0|            getcell = true;
 2442|      0|          }
 2443|      0|        }
 2444|    268|#endif /* HAVE_ZFP */
 2445|    268|        if (!getcell) {
  ------------------
  |  Branch (2445:13): [True: 268, False: 0]
  ------------------
 2446|    268|          thread_context->zfp_cell_nitems = 0;
 2447|    844|          for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (2447:27): [True: 844, False: 0]
  ------------------
 2448|    844|            if (g_codecs[i].compcode == context->compcode) {
  ------------------
  |  Branch (2448:17): [True: 268, False: 576]
  ------------------
 2449|    268|              if (load_acquire_ptr(&g_codecs[i].decoder) == NULL) {
  ------------------
  |  |  144|    268|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2449:19): [True: 0, False: 268]
  ------------------
 2450|       |                // Dynamically load codec plugin
 2451|      0|                if (fill_codec(&g_codecs[i]) < 0) {
  ------------------
  |  Branch (2451:21): [True: 0, False: 0]
  ------------------
 2452|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2453|      0|                  return BLOSC2_ERROR_CODEC_SUPPORT;
 2454|      0|                }
 2455|      0|              }
 2456|    268|              blosc2_dparams dparams;
 2457|    268|              blosc2_ctx_get_dparams(context, &dparams);
 2458|    268|              nbytes = g_codecs[i].decoder(src,
 2459|    268|                                           cbytes,
 2460|    268|                                           _dest,
 2461|    268|                                           neblock,
 2462|    268|                                           context->compcode_meta,
 2463|    268|                                           &dparams,
 2464|    268|                                           context->src);
 2465|    268|              goto urcodecsuccess;
 2466|    268|            }
 2467|    844|          }
 2468|      0|          BLOSC_TRACE_ERROR("User-defined compressor codec %d not found during decompression", 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2469|      0|          return BLOSC2_ERROR_CODEC_SUPPORT;
 2470|    268|        }
 2471|    268|      urcodecsuccess:
 2472|    268|        ;
 2473|    268|      }
 2474|      0|      else {
 2475|      0|        compname = clibcode_to_clibname(compformat);
 2476|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2477|      0|                "Blosc has not been compiled with decompression "
 2478|      0|                "support for '%s' format.  "
 2479|      0|                "Please recompile for adding this support.", compname);
 2480|      0|        return BLOSC2_ERROR_CODEC_SUPPORT;
 2481|      0|      }
 2482|       |
 2483|       |      /* Check that decompressed bytes number is correct */
 2484|  9.75k|      if ((nbytes != neblock) && (thread_context->zfp_cell_nitems == 0)) {
  ------------------
  |  Branch (2484:11): [True: 62, False: 9.69k]
  |  Branch (2484:34): [True: 62, False: 0]
  ------------------
 2485|     62|        return BLOSC2_ERROR_DATA;
 2486|     62|      }
 2487|       |
 2488|  9.75k|    }
 2489|  10.9k|    src += cbytes;
 2490|       |    // ctbytes += cbytes;
 2491|  10.9k|    _dest += nbytes;
 2492|  10.9k|    ntbytes += nbytes;
 2493|  10.9k|  } /* Closes j < nstreams */
 2494|       |
 2495|  10.9k|  if (!instr_codec) {
  ------------------
  |  Branch (2495:7): [True: 10.9k, False: 0]
  ------------------
 2496|  10.9k|    if (last_filter_index >= 0 || context->postfilter != NULL) {
  ------------------
  |  Branch (2496:9): [True: 10.8k, False: 80]
  |  Branch (2496:35): [True: 80, False: 0]
  ------------------
 2497|       |      /* Apply regular filter pipeline */
 2498|  10.9k|      int errcode = pipeline_backward(thread_context, bsize, dest, dest_offset, tmp, tmp2, tmp3,
 2499|  10.9k|                                      last_filter_index, nblock);
 2500|  10.9k|      if (errcode < 0)
  ------------------
  |  Branch (2500:11): [True: 0, False: 10.9k]
  ------------------
 2501|      0|        return errcode;
 2502|  10.9k|    }
 2503|  10.9k|  }
 2504|       |
 2505|       |  /* Return the number of uncompressed bytes */
 2506|  10.9k|  return (int)ntbytes;
 2507|  10.9k|}
blosc2.c:lz4_wrap_decompress:
  641|  1.26k|                               struct thread_context* thread_context) {
  642|  1.26k|  int nbytes;
  643|  1.26k|  blosc2_context* context = thread_context->parent_context;
  644|  1.26k|  if (context->use_dict && context->dict_buffer != NULL && context->dict_size > 0) {
  ------------------
  |  Branch (644:7): [True: 0, False: 1.26k]
  |  Branch (644:28): [True: 0, False: 0]
  |  Branch (644:60): [True: 0, False: 0]
  ------------------
  645|      0|    nbytes = LZ4_decompress_safe_usingDict(input, output,
  646|      0|                                           (int)compressed_length, (int)maxout,
  647|      0|                                           (const char*)context->dict_buffer,
  648|      0|                                           (int)context->dict_size);
  649|  1.26k|  } else {
  650|  1.26k|    nbytes = LZ4_decompress_safe(input, output, (int)compressed_length, (int)maxout);
  651|  1.26k|  }
  652|  1.26k|  if (nbytes != (int)maxout) {
  ------------------
  |  Branch (652:7): [True: 6, False: 1.26k]
  ------------------
  653|      6|    return 0;
  654|      6|  }
  655|  1.26k|  return (int)maxout;
  656|  1.26k|}
blosc2.c:zlib_wrap_decompress:
  680|     18|                                char* output, size_t maxout) {
  681|     18|  int status;
  682|     18|#if defined(HAVE_ZLIB_NG) && ! defined(ZLIB_COMPAT)
  683|     18|  size_t ul = maxout;
  684|     18|  status = zng_uncompress(
  685|     18|      (uint8_t*)output, &ul, (uint8_t*)input, compressed_length);
  686|       |#else
  687|       |  uLongf ul = (uLongf)maxout;
  688|       |  status = uncompress(
  689|       |      (Bytef*)output, &ul, (Bytef*)input, (uLong)compressed_length);
  690|       |#endif
  691|     18|  if (status != Z_OK) {
  ------------------
  |  |  180|     18|#define Z_OK            0
  ------------------
  |  Branch (691:7): [True: 18, False: 0]
  ------------------
  692|     18|    return 0;
  693|     18|  }
  694|      0|  return (int)ul;
  695|     18|}
blosc2.c:zstd_wrap_decompress:
  732|  5.02k|                                char* output, size_t maxout) {
  733|  5.02k|  size_t code;
  734|  5.02k|  blosc2_context* context = thread_context->parent_context;
  735|       |
  736|  5.02k|  if (thread_context->zstd_dctx == NULL) {
  ------------------
  |  Branch (736:7): [True: 61, False: 4.96k]
  ------------------
  737|     61|    thread_context->zstd_dctx = ZSTD_createDCtx();
  738|     61|  }
  739|       |
  740|  5.02k|  if (context->use_dict) {
  ------------------
  |  Branch (740:7): [True: 0, False: 5.02k]
  ------------------
  741|      0|    assert(context->dict_ddict != NULL);
  742|      0|    code = ZSTD_decompress_usingDDict(
  743|      0|            thread_context->zstd_dctx, (void*)output, maxout, (void*)input,
  744|      0|            compressed_length, context->dict_ddict);
  745|  5.02k|  } else {
  746|  5.02k|    code = ZSTD_decompressDCtx(thread_context->zstd_dctx,
  747|  5.02k|        (void*)output, maxout, (void*)input, compressed_length);
  748|  5.02k|  }
  749|  5.02k|  if (ZSTD_isError(code) != ZSTD_error_no_error) {
  ------------------
  |  Branch (749:7): [True: 32, False: 4.99k]
  ------------------
  750|     32|    BLOSC_TRACE_ERROR("Error in ZSTD decompression: '%s'.  Giving up.",
  ------------------
  |  |   93|     32|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     32|    do {                                            \
  |  |  |  |   98|     32|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     32|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 32, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     32|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  751|     32|                      ZDICT_getErrorName(code));
  752|     32|    return 0;
  753|     32|  }
  754|  4.99k|  return (int)code;
  755|  5.02k|}
blosc2.c:set_values:
 1993|  8.08k|static int32_t set_values(int32_t typesize, const uint8_t* src, uint8_t* dest, int32_t destsize) {
 1994|       |#if defined(BLOSC_STRICT_ALIGN)
 1995|       |  if (destsize % typesize != 0) {
 1996|       |    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
 1997|       |  }
 1998|       |  int32_t nitems = destsize / typesize;
 1999|       |  if (nitems == 0) {
 2000|       |    return 0;
 2001|       |  }
 2002|       |  for (int i = 0; i < nitems; i++) {
 2003|       |    memcpy(dest + i * typesize, src + BLOSC_EXTENDED_HEADER_LENGTH, typesize);
 2004|       |  }
 2005|       |#else
 2006|  8.08k|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (2006:7): [True: 2, False: 8.08k]
  ------------------
 2007|      2|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      2|    do {                                            \
  |  |  112|      2|        int rc_ = (rc);                             \
  |  |  113|      2|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 2, False: 0]
  |  |  ------------------
  |  |  114|      2|            char *error_msg = print_error(rc_);     \
  |  |  115|      2|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      2|            return rc_;                             \
  |  |  117|      2|        }                                           \
  |  |  118|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2008|      2|  }
 2009|  8.08k|  int32_t nitems = destsize / typesize;
 2010|  8.08k|  if (nitems == 0) {
  ------------------
  |  Branch (2010:7): [True: 0, False: 8.08k]
  ------------------
 2011|      0|    return 0;
 2012|      0|  }
 2013|       |
 2014|  8.08k|  switch (typesize) {
 2015|    442|    case 8: {
  ------------------
  |  Branch (2015:5): [True: 442, False: 7.64k]
  ------------------
 2016|    442|      int64_t val8 = ((int64_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2017|    442|      int64_t* dest8 = (int64_t*)dest;
 2018|  53.0M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2018:23): [True: 53.0M, False: 442]
  ------------------
 2019|  53.0M|        dest8[i] = val8;
 2020|  53.0M|      }
 2021|    442|      break;
 2022|      0|    }
 2023|  7.61k|    case 4: {
  ------------------
  |  Branch (2023:5): [True: 7.61k, False: 465]
  ------------------
 2024|  7.61k|      int32_t val4 = ((int32_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2025|  7.61k|      int32_t* dest4 = (int32_t*)dest;
 2026|  55.2M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2026:23): [True: 55.2M, False: 7.61k]
  ------------------
 2027|  55.2M|        dest4[i] = val4;
 2028|  55.2M|      }
 2029|  7.61k|      break;
 2030|      0|    }
 2031|      3|    case 2: {
  ------------------
  |  Branch (2031:5): [True: 3, False: 8.07k]
  ------------------
 2032|      3|      int16_t val2 = ((int16_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2033|      3|      int16_t* dest2 = (int16_t*)dest;
 2034|   100M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2034:23): [True: 100M, False: 3]
  ------------------
 2035|   100M|        dest2[i] = val2;
 2036|   100M|      }
 2037|      3|      break;
 2038|      0|    }
 2039|      1|    case 1: {
  ------------------
  |  Branch (2039:5): [True: 1, False: 8.08k]
  ------------------
 2040|      1|      int8_t val1 = ((int8_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2041|      1|      int8_t* dest1 = (int8_t*)dest;
 2042|  4.98M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2042:23): [True: 4.98M, False: 1]
  ------------------
 2043|  4.98M|        dest1[i] = val1;
 2044|  4.98M|      }
 2045|      1|      break;
 2046|      0|    }
 2047|     19|    default:
  ------------------
  |  Branch (2047:5): [True: 19, False: 8.06k]
  ------------------
 2048|   118M|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2048:23): [True: 118M, False: 19]
  ------------------
 2049|   118M|        memcpy(dest + i * typesize, src + BLOSC_EXTENDED_HEADER_LENGTH, typesize);
 2050|   118M|      }
 2051|  8.08k|  }
 2052|  8.08k|#endif
 2053|       |
 2054|  8.08k|  return nitems;
 2055|  8.08k|}
blosc2.c:set_nans:
 1961|  15.1k|static int32_t set_nans(int32_t typesize, uint8_t* dest, int32_t destsize) {
 1962|  15.1k|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (1962:7): [True: 2, False: 15.1k]
  ------------------
 1963|      2|    BLOSC_TRACE_ERROR("destsize can only be a multiple of typesize");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1964|      2|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      2|    do {                                            \
  |  |  112|      2|        int rc_ = (rc);                             \
  |  |  113|      2|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 2, False: 0]
  |  |  ------------------
  |  |  114|      2|            char *error_msg = print_error(rc_);     \
  |  |  115|      2|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      2|            return rc_;                             \
  |  |  117|      2|        }                                           \
  |  |  118|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1965|      2|  }
 1966|  15.1k|  int32_t nitems = destsize / typesize;
 1967|  15.1k|  if (nitems == 0) {
  ------------------
  |  Branch (1967:7): [True: 0, False: 15.1k]
  ------------------
 1968|      0|    return 0;
 1969|      0|  }
 1970|       |
 1971|  15.1k|  if (typesize == 4) {
  ------------------
  |  Branch (1971:7): [True: 15.1k, False: 16]
  ------------------
 1972|  15.1k|    float* dest_ = (float*)dest;
 1973|  15.1k|    float val = nanf("");
 1974|  30.2k|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1974:21): [True: 15.1k, False: 15.1k]
  ------------------
 1975|  15.1k|      dest_[i] = val;
 1976|  15.1k|    }
 1977|  15.1k|    return nitems;
 1978|  15.1k|  }
 1979|     16|  else if (typesize == 8) {
  ------------------
  |  Branch (1979:12): [True: 16, False: 0]
  ------------------
 1980|     16|    double* dest_ = (double*)dest;
 1981|     16|    double val = nan("");
 1982|  67.1M|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (1982:21): [True: 67.1M, False: 16]
  ------------------
 1983|  67.1M|      dest_[i] = val;
 1984|  67.1M|    }
 1985|     16|    return nitems;
 1986|     16|  }
 1987|       |
 1988|      0|  BLOSC_TRACE_ERROR("Unsupported typesize for NaN");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1989|      0|  return BLOSC2_ERROR_DATA;
 1990|  15.1k|}
blosc2.c:getitem_read_header:
 5115|  2.64k|static int getitem_read_header(const void* src, int32_t srcsize, blosc_header* header) {
 5116|  2.64k|  int result = read_chunk_header((uint8_t *) src, srcsize, true, header);
 5117|  2.64k|  if (result < 0) {
  ------------------
  |  Branch (5117:7): [True: 0, False: 2.64k]
  ------------------
 5118|      0|    return result;
 5119|      0|  }
 5120|  2.64k|  if (header->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (5120:7): [True: 0, False: 2.64k]
  ------------------
 5121|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5122|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 5123|      0|  }
 5124|  2.64k|  return 0;
 5125|  2.64k|}
blosc2.c:getitem_with_header:
 5131|  2.64k|                               int start, int nitems, void* dest, int32_t destsize) {
 5132|       |  /* Minimally populate the context */
 5133|  2.64k|  context->src = src;
 5134|  2.64k|  context->srcsize = srcsize;
 5135|  2.64k|  context->dest = dest;
 5136|  2.64k|  context->destsize = destsize;
 5137|       |
 5138|  2.64k|  int result = blosc2_initialize_context_from_header(context, header);
 5139|  2.64k|  if (result < 0) {
  ------------------
  |  Branch (5139:7): [True: 0, False: 2.64k]
  ------------------
 5140|      0|    return result;
 5141|      0|  }
 5142|       |
 5143|       |  /* Call the actual getitem function */
 5144|  2.64k|  return _blosc_getitem(context, header, src, srcsize, start, nitems, dest, destsize);
 5145|  2.64k|}
blosc2.c:blosc2_initialize_context_from_header:
 1032|  4.65k|static int blosc2_initialize_context_from_header(blosc2_context* context, blosc_header* header) {
 1033|  4.65k|  context->header_flags = header->flags;
 1034|  4.65k|  context->typesize = header->typesize;
 1035|  4.65k|  context->sourcesize = header->nbytes;
 1036|  4.65k|  context->header_blocksize = header->blocksize;
 1037|  4.65k|  context->blocksize = header->blocksize;
 1038|  4.65k|  context->blosc2_flags2 = header->blosc2_flags2;
 1039|  4.65k|  context->blosc2_flags = header->blosc2_flags;
 1040|  4.65k|  context->compcode = header->flags >> 5;
 1041|  4.65k|  if (context->compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (1041:7): [True: 272, False: 4.38k]
  ------------------
 1042|    272|    context->compcode = header->udcompcode;
 1043|    272|  }
 1044|  4.65k|  if (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (1044:7): [True: 3, False: 4.65k]
  ------------------
 1045|      3|    context->nblocks = header->blocksize;
 1046|      3|    context->leftover = 0;
 1047|      3|    context->blocksize = 0;
 1048|      3|  }
 1049|  4.65k|  else {
 1050|  4.65k|    blosc2_calculate_blocks(context);
 1051|  4.65k|  }
 1052|       |
 1053|  4.65k|  bool is_lazy = false;
 1054|  4.65k|  if ((context->header_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (1054:7): [True: 4.56k, False: 85]
  ------------------
 1055|  4.56k|      (context->header_flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (1055:7): [True: 4.56k, False: 6]
  ------------------
 1056|       |    /* Extended header */
 1057|  4.56k|    context->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 1058|       |
 1059|  4.56k|    memcpy(context->filters, header->filters, BLOSC2_MAX_FILTERS);
 1060|  4.56k|    memcpy(context->filters_meta, header->filters_meta, BLOSC2_MAX_FILTERS);
 1061|  4.56k|    context->compcode_meta = header->compcode_meta;
 1062|       |
 1063|  4.56k|    context->filter_flags = filters_to_flags(header->filters);
 1064|  4.56k|    context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
 1065|       |
 1066|       |    // Chunks with special values cannot be lazy (as in blosc_d()), and their
 1067|       |    // value is read from the buffer, so the cbytes check below must apply
 1068|  4.56k|    is_lazy = (context->blosc2_flags & 0x08u) && !context->special_type;
  ------------------
  |  Branch (1068:15): [True: 15, False: 4.54k]
  |  Branch (1068:50): [True: 1, False: 14]
  ------------------
 1069|  4.56k|  }
 1070|     91|  else {
 1071|     91|    context->header_overhead = BLOSC_MIN_HEADER_LENGTH;
 1072|     91|    context->filter_flags = get_filter_flags(context->header_flags, context->typesize);
 1073|     91|    flags_to_filters(context->header_flags, context->filters);
 1074|     91|  }
 1075|       |
 1076|       |  // Some checks for malformed headers
 1077|  4.65k|  if (!is_lazy && header->cbytes > context->srcsize) {
  ------------------
  |  Branch (1077:7): [True: 4.65k, False: 1]
  |  Branch (1077:19): [True: 0, False: 4.65k]
  ------------------
 1078|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1079|      0|  }
 1080|       |
 1081|  4.65k|  return 0;
 1082|  4.65k|}
blosc2.c:get_filter_flags:
  872|     91|                                const int32_t typesize) {
  873|     91|  uint8_t flags = 0;
  874|       |
  875|     91|  if ((header_flags & BLOSC_DOSHUFFLE) && (typesize > 1)) {
  ------------------
  |  Branch (875:7): [True: 6, False: 85]
  |  Branch (875:43): [True: 6, False: 0]
  ------------------
  876|      6|    flags |= BLOSC_DOSHUFFLE;
  877|      6|  }
  878|     91|  if (header_flags & BLOSC_DOBITSHUFFLE) {
  ------------------
  |  Branch (878:7): [True: 37, False: 54]
  ------------------
  879|     37|    flags |= BLOSC_DOBITSHUFFLE;
  880|     37|  }
  881|     91|  if (header_flags & BLOSC_DODELTA) {
  ------------------
  |  Branch (881:7): [True: 82, False: 9]
  ------------------
  882|     82|    flags |= BLOSC_DODELTA;
  883|     82|  }
  884|     91|  if (header_flags & BLOSC_MEMCPYED) {
  ------------------
  |  Branch (884:7): [True: 6, False: 85]
  ------------------
  885|      6|    flags |= BLOSC_MEMCPYED;
  886|      6|  }
  887|     91|  return flags;
  888|     91|}
blosc2.c:clear_context_decompression_dict:
 2989|  2.00k|static void clear_context_decompression_dict(blosc2_context* context) {
 2990|  2.00k|  context->use_dict = 0;
 2991|  2.00k|  release_context_dict_buffer(context);
 2992|  2.00k|#if defined(HAVE_ZSTD)
 2993|  2.00k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (2993:7): [True: 0, False: 2.00k]
  ------------------
 2994|      0|    ZSTD_freeDDict(context->dict_ddict);
 2995|      0|    context->dict_ddict = NULL;
 2996|      0|  }
 2997|       |#else
 2998|       |  context->dict_ddict = NULL;
 2999|       |#endif
 3000|  2.00k|}
blosc2.c:check_nthreads:
 2654|  3.51k|static int check_nthreads(blosc2_context* context, bool start_backend) {
 2655|  3.51k|  if (context->new_nthreads != context->nthreads && context->new_nthreads <= 0) {
  ------------------
  |  Branch (2655:7): [True: 0, False: 3.51k]
  |  Branch (2655:53): [True: 0, False: 0]
  ------------------
 2656|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2656|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2657|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2658|      0|  }
 2659|  3.51k|  if (context->nthreads <= 0) {
  ------------------
  |  Branch (2659:7): [True: 0, False: 3.51k]
  ------------------
 2660|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2660|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2661|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2662|      0|  }
 2663|       |
 2664|       |  /* Detect a pool that was torn down by blosc2_destroy() while this context
 2665|       |   * was still alive, or that belongs to the parent of a forked process.  The
 2666|       |   * epoch mismatch tells us the pool pointer is dangling or has no threads;
 2667|       |   * clear it so the re-attach logic below creates a fresh one. */
 2668|  3.51k|  if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL &&
  ------------------
  |  |   34|  7.02k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (2668:7): [True: 0, False: 3.51k]
  ------------------
 2669|      0|      context->pool_epoch != load_acquire_int(&g_destroy_count)) {
  ------------------
  |  |  142|      0|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2669:7): [True: 0, False: 0]
  ------------------
 2670|      0|    context->thread_pool = NULL;
 2671|      0|    context->threads_started = 0;
 2672|      0|    context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|      0|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 2673|      0|  }
 2674|       |
 2675|  3.51k|  if (context->new_nthreads != context->nthreads) {
  ------------------
  |  Branch (2675:7): [True: 0, False: 3.51k]
  ------------------
 2676|      0|    release_thread_backend(context);
 2677|      0|    context->nthreads = context->new_nthreads;
 2678|      0|  }
 2679|  3.51k|  if (start_backend && context->nthreads > 1 && context->threads_started == 0) {
  ------------------
  |  Branch (2679:7): [True: 0, False: 3.51k]
  |  Branch (2679:24): [True: 0, False: 0]
  |  Branch (2679:49): [True: 0, False: 0]
  ------------------
 2680|      0|    int rc;
 2681|      0|    if (threads_callback) {
  ------------------
  |  Branch (2681:9): [True: 0, False: 0]
  ------------------
 2682|      0|      rc = init_callback_threads(context);
 2683|      0|    }
 2684|      0|    else {
 2685|       |#if defined(_WIN32)
 2686|       |      rc = init_threadpool(context);
 2687|       |#else
 2688|      0|      rc = attach_shared_pool(context);
 2689|      0|#endif
 2690|      0|    }
 2691|      0|    if (rc < 0) {
  ------------------
  |  Branch (2691:9): [True: 0, False: 0]
  ------------------
 2692|      0|      return rc;
 2693|      0|    }
 2694|      0|  }
 2695|  3.51k|  if (context->nthreads <= 1) {
  ------------------
  |  Branch (2695:7): [True: 2.74k, False: 772]
  ------------------
 2696|  2.74k|    context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|  2.74k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 2697|  2.74k|  }
 2698|       |
 2699|  3.51k|  return context->nthreads;
 2700|  3.51k|}
blosc2.c:register_atfork:
  293|      1|static void register_atfork(void) {
  294|      1|  if (pthread_atfork(atfork_prepare, atfork_parent, atfork_child) != 0) {
  ------------------
  |  Branch (294:7): [True: 0, False: 1]
  ------------------
  295|       |    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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  296|      0|  }
  297|      1|}
blosc2.c:blosc2_init_locked:
 6543|    243|static void blosc2_init_locked(void) {
 6544|    243|  BLOSC2_IO_CB_DEFAULTS.id = BLOSC2_IO_FILESYSTEM;
 6545|    243|  BLOSC2_IO_CB_DEFAULTS.name = "filesystem";
 6546|    243|  BLOSC2_IO_CB_DEFAULTS.is_allocation_necessary = true;
 6547|    243|  BLOSC2_IO_CB_DEFAULTS.open = (blosc2_open_cb) blosc2_stdio_open;
 6548|    243|  BLOSC2_IO_CB_DEFAULTS.close = (blosc2_close_cb) blosc2_stdio_close;
 6549|    243|  BLOSC2_IO_CB_DEFAULTS.size = (blosc2_size_cb) blosc2_stdio_size;
 6550|    243|  BLOSC2_IO_CB_DEFAULTS.write = (blosc2_write_cb) blosc2_stdio_write;
 6551|    243|  BLOSC2_IO_CB_DEFAULTS.read = (blosc2_read_cb) blosc2_stdio_read;
 6552|    243|  BLOSC2_IO_CB_DEFAULTS.truncate = (blosc2_truncate_cb) blosc2_stdio_truncate;
 6553|    243|  BLOSC2_IO_CB_DEFAULTS.destroy = (blosc2_destroy_cb) blosc2_stdio_destroy;
 6554|       |
 6555|    243|  _blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS);
 6556|       |
 6557|    243|  BLOSC2_IO_CB_MMAP.id = BLOSC2_IO_FILESYSTEM_MMAP;
 6558|    243|  BLOSC2_IO_CB_MMAP.name = "filesystem_mmap";
 6559|    243|  BLOSC2_IO_CB_MMAP.is_allocation_necessary = false;
 6560|    243|  BLOSC2_IO_CB_MMAP.open = (blosc2_open_cb) blosc2_stdio_mmap_open;
 6561|    243|  BLOSC2_IO_CB_MMAP.close = (blosc2_close_cb) blosc2_stdio_mmap_close;
 6562|    243|  BLOSC2_IO_CB_MMAP.read = (blosc2_read_cb) blosc2_stdio_mmap_read;
 6563|    243|  BLOSC2_IO_CB_MMAP.size = (blosc2_size_cb) blosc2_stdio_mmap_size;
 6564|    243|  BLOSC2_IO_CB_MMAP.write = (blosc2_write_cb) blosc2_stdio_mmap_write;
 6565|    243|  BLOSC2_IO_CB_MMAP.truncate = (blosc2_truncate_cb) blosc2_stdio_mmap_truncate;
 6566|    243|  BLOSC2_IO_CB_MMAP.destroy = (blosc2_destroy_cb) blosc2_stdio_mmap_destroy;
 6567|       |
 6568|    243|  _blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP);
 6569|       |
 6570|       |  // BLOSC_PREFETCH=<nthreads> turns read-ahead on without touching the sources (see blosc2_set_prefetch())
 6571|    243|  const char *prefetch_env = getenv("BLOSC_PREFETCH");
 6572|    243|  if (prefetch_env != NULL && prefetch_env[0] != '\0') {
  ------------------
  |  Branch (6572:7): [True: 0, False: 243]
  |  Branch (6572:31): [True: 0, False: 0]
  ------------------
 6573|      0|    long nthreads = strtol(prefetch_env, NULL, 10);
 6574|      0|    if (nthreads > 0 && nthreads <= BLOSC2_PREFETCH_MAX_NTHREADS) {
  ------------------
  |  |  786|      0|#define BLOSC2_PREFETCH_MAX_NTHREADS 256
  ------------------
  |  Branch (6574:9): [True: 0, False: 0]
  |  Branch (6574:25): [True: 0, False: 0]
  ------------------
 6575|      0|      blosc2_set_prefetch((int) nthreads, 0, 0);
 6576|      0|    }
 6577|      0|  }
 6578|       |  // BLOSC_PREFETCH_POPULATE: of which memory-mapped frames read-ahead populates the mapping: of all (1), of none (0),
 6579|       |  // or, if unset or empty, of those on GPFS
 6580|    243|  const char *populate_env = getenv("BLOSC_PREFETCH_POPULATE");
 6581|    243|  prefetch_set_populate(populate_env != NULL && populate_env[0] != '\0' ? strtol(populate_env, NULL, 10) != 0 : -1);
  ------------------
  |  Branch (6581:25): [True: 0, False: 243]
  |  Branch (6581:49): [True: 0, False: 0]
  ------------------
 6582|       |
 6583|    243|  g_ncodecs = 0;
 6584|    243|  g_nfilters = 0;
 6585|    243|  g_ntuners = 0;
 6586|       |
 6587|    243|#if defined(HAVE_PLUGINS)
 6588|    243|  #include "blosc2/blosc2-common.h"
 6589|    243|  #include "blosc2/blosc2-stdio.h"
 6590|    243|  register_codecs();
 6591|    243|  register_filters();
 6592|    243|  register_tuners();
 6593|    243|#endif
 6594|    243|  blosc2_pthread_mutex_init(&global_comp_mutex, NULL);
  ------------------
  |  |   90|    243|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6595|       |  /* Create a global context */
 6596|    243|  g_global_context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 6597|    243|  memset(g_global_context, 0, sizeof(blosc2_context));
 6598|    243|  g_global_context->nthreads = g_nthreads;
 6599|    243|  g_global_context->new_nthreads = g_nthreads;
 6600|    243|  blosc2_pthread_mutex_init(&g_global_context->nchunk_mutex, NULL);
  ------------------
  |  |   90|    243|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6601|    243|  store_release_int(&g_initlib, BLOSC_STATE_INITIALIZED);
  ------------------
  |  |  143|    243|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 6602|    243|}
blosc2.c:blosc2_free_resources_locked:
 6631|    243|static int blosc2_free_resources_locked(void) {
 6632|       |  /* The calling thread's temporaries (other threads free theirs at exit) */
 6633|    243|  blosc2_tmp_cache_clear();
 6634|    243|  int rc = release_thread_backend(g_global_context);
 6635|       |  /* The thread pools that no context uses (kept for reuse) */
 6636|    243|  static_lock(&pool_registry_mutex);
  ------------------
  |  |  132|    243|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6637|    243|  struct blosc_shared_pool *unused = unlink_unused_pools_locked(0);
 6638|    243|  static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|    243|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6639|    243|  destroy_shared_pools(unused);
 6640|    243|  return rc;
 6641|    243|}
blosc2.c:unlink_unused_pools_locked:
 5894|    243|static struct blosc_shared_pool *unlink_unused_pools_locked(int keep) {
 5895|    243|  struct blosc_shared_pool *unused = NULL;
 5896|    243|  struct blosc_shared_pool **prev = &shared_pools;
 5897|    243|  while (*prev != NULL) {
  ------------------
  |  Branch (5897:10): [True: 0, False: 243]
  ------------------
 5898|      0|    struct blosc_shared_pool *pool = *prev;
 5899|      0|    if (pool->context_refs == 0) {
  ------------------
  |  Branch (5899:9): [True: 0, False: 0]
  ------------------
 5900|      0|      if (keep == 0) {
  ------------------
  |  Branch (5900:11): [True: 0, False: 0]
  ------------------
 5901|      0|        *prev = pool->next;
 5902|      0|        pool->next = unused;
 5903|      0|        unused = pool;
 5904|      0|        continue;
 5905|      0|      }
 5906|      0|      keep--;
 5907|      0|    }
 5908|      0|    prev = &pool->next;
 5909|      0|  }
 5910|    243|  return unused;
 5911|    243|}
blosc2.c:destroy_shared_pools:
 5881|    486|static void destroy_shared_pools(struct blosc_shared_pool *pool) {
 5882|    486|  while (pool != NULL) {
  ------------------
  |  Branch (5882:10): [True: 0, False: 486]
  ------------------
 5883|      0|    struct blosc_shared_pool *next = pool->next;
 5884|      0|    destroy_shared_pool(pool);
 5885|      0|    pool = next;
 5886|      0|  }
 5887|    486|}
blosc2.c:serial_context_put:
 6768|  5.13k|static void serial_context_put(struct thread_context* thread_context) {
 6769|  5.13k|#if !defined(_WIN32)
 6770|  5.13k|  tmp_cache_t *cache = tmp_cache_get(false);
 6771|  5.13k|  if (cache != NULL && cache->serial == thread_context) {
  ------------------
  |  Branch (6771:7): [True: 5.13k, False: 1]
  |  Branch (6771:24): [True: 5.08k, False: 55]
  ------------------
 6772|  5.08k|    blosc2_context* context = thread_context->parent_context;
 6773|  5.08k|    if (context->serial_context == NULL &&
  ------------------
  |  Branch (6773:9): [True: 5.08k, False: 0]
  ------------------
 6774|  5.08k|        thread_context_nbytes(thread_context) > BLOSC2_SERIAL_TLS_MAX) {
  ------------------
  |  | 6664|  5.08k|#define BLOSC2_SERIAL_TLS_MAX (16 * 1024 * 1024)
  ------------------
  |  Branch (6774:9): [True: 0, False: 5.08k]
  ------------------
 6775|       |      /* Grown too large to keep per thread (e.g. ZSTD compression state for
 6776|       |         large blocks at high levels): the context that needed it keeps it, as
 6777|       |         if it had always been its own, and the thread starts a new one */
 6778|      0|      thread_context->tmp_blocksize = context->blocksize;
 6779|      0|      context->serial_context = thread_context;
 6780|      0|      cache->serial = NULL;
 6781|      0|    }
 6782|  5.08k|    else {
 6783|  5.08k|      thread_context->parent_context = NULL;
 6784|  5.08k|    }
 6785|  5.08k|    cache->serial_busy = false;
 6786|  5.08k|  }
 6787|       |#else
 6788|       |  BLOSC_UNUSED_PARAM(thread_context);
 6789|       |#endif
 6790|  5.13k|}
blosc2.c:thread_context_nbytes:
 6714|  5.08k|static size_t thread_context_nbytes(const struct thread_context* thread_context) {
 6715|  5.08k|  size_t nbytes = thread_context->tmp_nbytes +
 6716|  5.08k|                  (thread_context->blosclz_state != NULL ? sizeof(blosclz_state) : 0);
  ------------------
  |  Branch (6716:20): [True: 4.70k, False: 373]
  ------------------
 6717|  5.08k|#if defined(HAVE_ZSTD)
 6718|  5.08k|  if (thread_context->zstd_cctx != NULL) {
  ------------------
  |  Branch (6718:7): [True: 2.98k, False: 2.09k]
  ------------------
 6719|  2.98k|    nbytes += ZSTD_sizeof_CCtx(thread_context->zstd_cctx);
 6720|  2.98k|  }
 6721|  5.08k|  if (thread_context->zstd_dctx != NULL) {
  ------------------
  |  Branch (6721:7): [True: 1.03k, False: 4.05k]
  ------------------
 6722|  1.03k|    nbytes += ZSTD_sizeof_DCtx(thread_context->zstd_dctx);
 6723|  1.03k|  }
 6724|  5.08k|#endif
 6725|  5.08k|  if (thread_context->lz4_cstream != NULL) {
  ------------------
  |  Branch (6725:7): [True: 465, False: 4.61k]
  ------------------
 6726|    465|    nbytes += sizeof(LZ4_stream_t);
 6727|    465|  }
 6728|  5.08k|  if (thread_context->lz4hc_cstream != NULL) {
  ------------------
  |  Branch (6728:7): [True: 0, False: 5.08k]
  ------------------
 6729|      0|    nbytes += sizeof(LZ4_streamHC_t);
 6730|      0|  }
 6731|  5.08k|  return nbytes;
 6732|  5.08k|}
blosc2.c:tmp_cache_get:
 6695|  10.7k|static tmp_cache_t *tmp_cache_get(bool create) {
 6696|  10.7k|  pthread_once(&tmp_cache_once, tmp_cache_init);
 6697|  10.7k|  if (!tmp_cache_ready) {
  ------------------
  |  Branch (6697:7): [True: 0, False: 10.7k]
  ------------------
 6698|      0|    return NULL;
 6699|      0|  }
 6700|  10.7k|  tmp_cache_t *cache = pthread_getspecific(tmp_cache_key);
 6701|  10.7k|  if (cache == NULL && create) {
  ------------------
  |  Branch (6701:7): [True: 6, False: 10.7k]
  |  Branch (6701:24): [True: 1, False: 5]
  ------------------
 6702|      1|    cache = calloc(1, sizeof(tmp_cache_t));
 6703|      1|    if (cache != NULL && pthread_setspecific(tmp_cache_key, cache) != 0) {
  ------------------
  |  Branch (6703:9): [True: 1, False: 0]
  |  Branch (6703:26): [True: 0, False: 1]
  ------------------
 6704|      0|      free(cache);
 6705|       |      cache = NULL;
 6706|      0|    }
 6707|      1|  }
 6708|  10.7k|  return cache;
 6709|  10.7k|}
blosc2.c:tmp_cache_init:
 6691|      1|static void tmp_cache_init(void) {
 6692|      1|  tmp_cache_ready = pthread_key_create(&tmp_cache_key, tmp_cache_release) == 0;
 6693|      1|}
blosc2.c:blosc2_destroy_locked:
 6892|    243|static void blosc2_destroy_locked(void) {
 6893|    243|  blosc2_free_resources_locked();
 6894|    243|  blosc2_free_ctx(g_global_context);
 6895|    243|  blosc2_tmp_cache_clear();
 6896|       |
 6897|       |  /* Atomically invalidate outstanding context pointers and detach the registry.
 6898|       |   * A release either finishes its refcount update before this, or observes the
 6899|       |   * new epoch without dereferencing its stale pool.  Join outside the lock. */
 6900|    243|  static_lock(&pool_registry_mutex);
  ------------------
  |  |  132|    243|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6901|    243|  store_release_int(&g_destroy_count, load_acquire_int(&g_destroy_count) + 1);
  ------------------
  |  |  143|    243|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 6902|    243|  struct blosc_shared_pool *pools = shared_pools;
 6903|    243|  shared_pools = NULL;
 6904|    243|  static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|    243|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6905|    243|  destroy_shared_pools(pools);
 6906|       |
 6907|    243|  blosc2_pthread_mutex_destroy(&global_comp_mutex);
  ------------------
  |  |   91|    243|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6908|    243|}
blosc2.c:my_malloc:
  365|  3.48k|static uint8_t* my_malloc(size_t size) {
  366|  3.48k|  void* block = NULL;
  367|  3.48k|  int res = 0;
  368|       |  /* Keep aligned allocations valid under Valgrind and POSIX wrappers. */
  369|  3.48k|  if (size == 0) {
  ------------------
  |  Branch (369:7): [True: 0, False: 3.48k]
  ------------------
  370|      0|    size = 1;
  371|      0|  }
  372|       |
  373|       |/* Do an alignment to 32 bytes because AVX2 is supported */
  374|       |#if defined(_WIN32)
  375|       |  /* A (void *) cast needed for avoiding a warning with MINGW :-/ */
  376|       |  block = (void *)_aligned_malloc(size, 32);
  377|       |#elif _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
  378|       |  /* Platform does have an implementation of posix_memalign */
  379|  3.48k|  res = posix_memalign(&block, 32, size);
  380|       |#else
  381|       |  block = malloc(size);
  382|       |#endif  /* _WIN32 */
  383|       |
  384|  3.48k|  if (block == NULL || res != 0) {
  ------------------
  |  Branch (384:7): [True: 0, False: 3.48k]
  |  Branch (384:24): [True: 0, False: 3.48k]
  ------------------
  385|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  386|      0|    return NULL;
  387|      0|  }
  388|       |
  389|  3.48k|  return (uint8_t*)block;
  390|  3.48k|}
blosc2.c:release_thread_backend:
 6049|  3.09k|static int release_thread_backend(blosc2_context *context) {
 6050|  3.09k|  if (context->thread_backend == BLOSC_BACKEND_CALLBACK && context->threads_started > 0) {
  ------------------
  |  |   35|  6.18k|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (6050:7): [True: 0, False: 3.09k]
  |  Branch (6050:60): [True: 0, False: 0]
  ------------------
 6051|      0|    for (int32_t t = 0; t < context->threads_started; t++) {
  ------------------
  |  Branch (6051:25): [True: 0, False: 0]
  ------------------
 6052|      0|      destroy_thread_context(context->thread_contexts + t);
 6053|      0|    }
 6054|      0|    my_free(context->thread_contexts);
 6055|      0|    context->thread_contexts = NULL;
 6056|      0|    blosc2_pthread_mutex_destroy(&context->count_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6057|      0|    blosc2_pthread_mutex_destroy(&context->delta_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6058|      0|    blosc2_pthread_cond_destroy(&context->delta_cv);
  ------------------
  |  |   97|      0|#define blosc2_pthread_cond_destroy(a) pthread_cond_destroy((a))
  ------------------
 6059|      0|  }
 6060|       |#if defined(_WIN32)
 6061|       |  else if (context->thread_backend == BLOSC_BACKEND_PER_CONTEXT && context->threads_started > 0) {
 6062|       |    /* Signal all workers to exit. */
 6063|       |    blosc2_pthread_mutex_lock(&context->jobs_mutex);
 6064|       |    context->end_threads = 1;
 6065|       |    blosc2_pthread_cond_broadcast(&context->jobs_ready);
 6066|       |    blosc2_pthread_mutex_unlock(&context->jobs_mutex);
 6067|       |
 6068|       |    for (int32_t t = 0; t < context->threads_started; t++) {
 6069|       |      blosc2_pthread_join(context->threads[t], NULL);
 6070|       |    }
 6071|       |    my_free(context->threads);
 6072|       |    context->threads = NULL;
 6073|       |    blosc2_pthread_cond_destroy(&context->jobs_done);
 6074|       |    blosc2_pthread_cond_destroy(&context->jobs_ready);
 6075|       |    blosc2_pthread_mutex_destroy(&context->jobs_mutex);
 6076|       |    blosc2_pthread_cond_destroy(&context->delta_cv);
 6077|       |    blosc2_pthread_mutex_destroy(&context->delta_mutex);
 6078|       |    blosc2_pthread_mutex_destroy(&context->count_mutex);
 6079|       |  }
 6080|       |#endif  /* _WIN32 */
 6081|  3.09k|  else if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL && context->thread_pool != NULL) {
  ------------------
  |  |   34|  6.18k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (6081:12): [True: 0, False: 3.09k]
  |  Branch (6081:68): [True: 0, False: 0]
  ------------------
 6082|      0|    struct blosc_shared_pool *pool = context->thread_pool;
 6083|       |
 6084|      0|    static_lock(&pool_registry_mutex);
  ------------------
  |  |  132|      0|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6085|      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 (6085:9): [True: 0, False: 0]
  ------------------
 6086|       |      /* Check under the process-lifetime registry lock: destruction cannot
 6087|       |       * invalidate the pool between this check and the refcount update. */
 6088|      0|      static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|      0|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6089|      0|      context->thread_pool = NULL;
 6090|      0|      context->threads_started = 0;
 6091|      0|      context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|      0|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 6092|      0|      return 0;
 6093|      0|    }
 6094|       |
 6095|       |    /* A pool that no context uses any more stays registered for the next
 6096|       |     * contexts with the same nthreads: contexts that live for one call
 6097|       |     * (python-blosc2's compress2()/decompress2(), BLOSC_NOLOCK) would otherwise
 6098|       |     * start and join all of its threads every time.  The most recently
 6099|       |     * released unused pools are kept, the others destroyed (the pool moves to
 6100|       |     * the front of the registry); blosc2_free_resources() destroys all. */
 6101|      0|    struct blosc_shared_pool *unused = NULL;
 6102|      0|    pool->context_refs--;
 6103|      0|    if (pool->context_refs == 0) {
  ------------------
  |  Branch (6103:9): [True: 0, False: 0]
  ------------------
 6104|      0|      struct blosc_shared_pool **prev = &shared_pools;
 6105|      0|      while (*prev != NULL && *prev != pool) {
  ------------------
  |  Branch (6105:14): [True: 0, False: 0]
  |  Branch (6105:31): [True: 0, False: 0]
  ------------------
 6106|      0|        prev = &(*prev)->next;
 6107|      0|      }
 6108|      0|      if (*prev == pool) {
  ------------------
  |  Branch (6108:11): [True: 0, False: 0]
  ------------------
 6109|      0|        *prev = pool->next;
 6110|      0|        pool->next = shared_pools;
 6111|      0|        shared_pools = pool;
 6112|      0|      }
 6113|      0|      unused = unlink_unused_pools_locked(BLOSC2_UNUSED_POOLS_MAX);
  ------------------
  |  |  187|      0|#define BLOSC2_UNUSED_POOLS_MAX 2
  ------------------
 6114|      0|    }
 6115|      0|    static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|      0|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6116|      0|    destroy_shared_pools(unused);
 6117|      0|    context->thread_pool = NULL;
 6118|      0|  }
 6119|       |
 6120|  3.09k|  context->threads_started = 0;
 6121|  3.09k|  context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|  3.09k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 6122|  3.09k|  return 0;
 6123|  3.09k|}
blosc2.c:release_context_dict_buffer:
 2979|  5.09k|static void release_context_dict_buffer(blosc2_context* context) {
 2980|  5.09k|  if (context->dict_buffer_owned && context->dict_buffer != NULL) {
  ------------------
  |  Branch (2980:7): [True: 0, False: 5.09k]
  |  Branch (2980:37): [True: 0, False: 0]
  ------------------
 2981|      0|    free(context->dict_buffer);
 2982|      0|  }
 2983|  5.09k|  context->dict_buffer = NULL;
 2984|       |  context->dict_buffer_owned = false;
 2985|  5.09k|  context->dict_size = 0;
 2986|  5.09k|}

blosclz_compress_state:
  750|  1.24k|                           void* output, int maxout, blosclz_state* state) {
  751|  1.24k|  if (state->tagged) {
  ------------------
  |  Branch (751:7): [True: 108, False: 1.13k]
  ------------------
  752|    108|    return compress_impl(clevel, input, length, output, maxout, state->htab, state, 1);
  753|    108|  }
  754|  1.13k|  return compress_impl(clevel, input, length, output, maxout, state->htab, state, 0);
  755|  1.24k|}
blosclz_decompress:
  833|  3.17k|int blosclz_decompress(const void* input, int length, void* output, int maxout) {
  834|  3.17k|  const uint8_t* ip = (const uint8_t*)input;
  835|  3.17k|  const uint8_t* ip_limit = ip + length;
  836|  3.17k|  uint8_t* op = (uint8_t*)output;
  837|  3.17k|  uint32_t ctrl;
  838|  3.17k|  uint8_t* op_limit = op + maxout;
  839|  3.17k|  if (BLOSCLZ_UNLIKELY(length == 0)) {
  ------------------
  |  |   39|  3.17k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 0, False: 3.17k]
  |  |  ------------------
  ------------------
  840|      0|    return 0;
  841|      0|  }
  842|  3.17k|  ctrl = (*ip++) & 31U;
  843|       |
  844|  18.7k|  while (1) {
  ------------------
  |  Branch (844:10): [True: 18.7k, Folded]
  ------------------
  845|  18.7k|    if (ctrl >= 32) {
  ------------------
  |  Branch (845:9): [True: 8.47k, False: 10.2k]
  ------------------
  846|       |      // match
  847|  8.47k|      int32_t len = (int32_t)(ctrl >> 5U) - 1 ;
  848|  8.47k|      int32_t ofs = (int32_t)(ctrl & 31U) << 8U;
  849|  8.47k|      uint8_t code;
  850|  8.47k|      const uint8_t* ref = op - ofs;
  851|       |
  852|  8.47k|      if (len == 7 - 1) {
  ------------------
  |  Branch (852:11): [True: 6.41k, False: 2.06k]
  ------------------
  853|  6.41k|#ifdef BLOSCLZ_WIDE_DECODE
  854|       |        /* Long runs encode their lengths as consecutive 255-byte extensions.
  855|       |         * Consume eight together, keeping an offset byte in reserve. */
  856|  6.41k|        while (ip_limit - ip >= 9) {
  ------------------
  |  Branch (856:16): [True: 3.88k, False: 2.52k]
  ------------------
  857|  3.88k|          uint64_t extensions;
  858|  3.88k|          memcpy(&extensions, ip, sizeof(extensions));
  859|  3.88k|          if (extensions != UINT64_MAX) {
  ------------------
  |  Branch (859:15): [True: 3.88k, False: 0]
  ------------------
  860|  3.88k|            break;
  861|  3.88k|          }
  862|      0|          if (BLOSCLZ_UNLIKELY(len > maxout - 8 * 255)) {
  ------------------
  |  |   39|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  863|      0|            return 0;
  864|      0|          }
  865|      0|          len += 8 * 255;
  866|      0|          ip += 8;
  867|      0|        }
  868|  6.41k|#endif
  869|  6.41k|        do {
  870|  6.41k|          if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   39|  6.41k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 0, False: 6.41k]
  |  |  ------------------
  ------------------
  871|      0|            return 0;
  872|      0|          }
  873|  6.41k|          code = *ip++;
  874|       |          /* Guard before the addition so that `len` can never wrap past
  875|       |             INT32_MAX.  The subsequent `len += 3` adds at most 3 more,
  876|       |             so capping at maxout here is safe and sufficient. */
  877|  6.41k|          if (BLOSCLZ_UNLIKELY(len > maxout - code)) {
  ------------------
  |  |   39|  6.41k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 0, False: 6.41k]
  |  |  ------------------
  ------------------
  878|      0|            return 0;
  879|      0|          }
  880|  6.41k|          len += code;
  881|  6.41k|        } while (code == 255);
  ------------------
  |  Branch (881:18): [True: 0, False: 6.41k]
  ------------------
  882|  6.41k|      }
  883|  2.06k|      else {
  884|  2.06k|        if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   39|  2.06k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 1, False: 2.06k]
  |  |  ------------------
  ------------------
  885|      1|          return 0;
  886|      1|        }
  887|  2.06k|      }
  888|  8.47k|      code = *ip++;
  889|  8.47k|      len += 3;
  890|  8.47k|      ref -= code;
  891|       |
  892|       |      /* match from 16-bit distance */
  893|  8.47k|      if (BLOSCLZ_UNLIKELY(code == 255)) {
  ------------------
  |  |   39|  8.47k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 1, False: 8.47k]
  |  |  ------------------
  ------------------
  894|      1|        if (ofs == (31U << 8U)) {
  ------------------
  |  Branch (894:13): [True: 1, False: 0]
  ------------------
  895|      1|          if (ip + 1 >= ip_limit) {
  ------------------
  |  Branch (895:15): [True: 1, False: 0]
  ------------------
  896|      1|            return 0;
  897|      1|          }
  898|      0|          ofs = (*ip++) << 8U;
  899|      0|          ofs += *ip++;
  900|      0|          ref = op - ofs - MAX_DISTANCE;
  ------------------
  |  |   50|      0|#define MAX_DISTANCE 8191
  ------------------
  901|      0|        }
  902|      1|      }
  903|       |
  904|  8.47k|      if (BLOSCLZ_UNLIKELY(len > op_limit - op)) {
  ------------------
  |  |   39|  8.47k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 0, False: 8.47k]
  |  |  ------------------
  ------------------
  905|      0|        return 0;
  906|      0|      }
  907|       |
  908|  8.47k|      if (BLOSCLZ_UNLIKELY(ref <= (uint8_t*)output)) {
  ------------------
  |  |   39|  8.47k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 2, False: 8.46k]
  |  |  ------------------
  ------------------
  909|      2|        return 0;
  910|      2|      }
  911|       |
  912|  8.46k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   39|  8.46k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 0, False: 8.46k]
  |  |  ------------------
  ------------------
  913|  8.46k|      ctrl = *ip++;
  914|       |
  915|  8.46k|      ref--;
  916|  8.46k|      if (ref == op - 1) {
  ------------------
  |  Branch (916:11): [True: 3.06k, False: 5.40k]
  ------------------
  917|       |        /* optimized copy for a run */
  918|  3.06k|        memset(op, *ref, len);
  919|  3.06k|        op += len;
  920|  3.06k|      }
  921|  5.40k|#ifdef BLOSCLZ_WIDE_DECODE
  922|  5.40k|      else if ((op - ref >= 16) && (op_limit - op - len >= 16)) {
  ------------------
  |  Branch (922:16): [True: 2.49k, False: 2.91k]
  |  Branch (922:36): [True: 1.97k, False: 518]
  ------------------
  923|  1.97k|        wild_copy_16(op, ref, op + len);
  924|  1.97k|        op += len;
  925|  1.97k|      }
  926|  3.43k|#endif
  927|  3.43k|      else if ((op - ref >= 8) && (op_limit - op - len >= 8)) {
  ------------------
  |  Branch (927:16): [True: 2.60k, False: 830]
  |  Branch (927:35): [True: 1.99k, False: 603]
  ------------------
  928|       |        // copy with an overlap not larger than 8
  929|  1.99k|        wild_copy(op, ref, op + len);
  930|  1.99k|        op += len;
  931|  1.99k|      }
  932|  1.43k|      else {
  933|       |        // general copy with any overlap
  934|       |#if 0 && defined(__AVX2__)
  935|       |        if (op - ref <= 16) {
  936|       |          // This is not faster on a combination of compilers (clang, gcc, icc) or machines, but
  937|       |          // it is not too slower either.
  938|       |          op = copy_match_16(op, ref, len);
  939|       |        }
  940|       |        else {
  941|       |#endif
  942|  1.43k|          op = copy_match(op, ref, (unsigned) len);
  943|       |#if 0 && defined(__AVX2__)
  944|       |        }
  945|       |#endif
  946|  1.43k|      }
  947|  8.46k|    }
  948|  10.2k|    else {
  949|       |      // literal
  950|  10.2k|      ctrl++;
  951|  10.2k|      if (BLOSCLZ_UNLIKELY(ctrl > op_limit - op)) {
  ------------------
  |  |   39|  10.2k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 0, False: 10.2k]
  |  |  ------------------
  ------------------
  952|      0|        return 0;
  953|      0|      }
  954|  10.2k|      if (BLOSCLZ_UNLIKELY(ctrl > ip_limit - ip)) {
  ------------------
  |  |   39|  10.2k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 0, False: 10.2k]
  |  |  ------------------
  ------------------
  955|      0|        return 0;
  956|      0|      }
  957|       |
  958|  10.2k|#ifdef BLOSCLZ_WIDE_DECODE
  959|       |      /* Fixed-size copies can inline.  Overcopy only within both buffers;
  960|       |       * subsequent tokens overwrite the extra output bytes. */
  961|  10.2k|      if (ctrl <= 16 && op_limit - op >= 16 && ip_limit - ip >= 16) {
  ------------------
  |  Branch (961:11): [True: 8.63k, False: 1.60k]
  |  Branch (961:25): [True: 5.47k, False: 3.15k]
  |  Branch (961:48): [True: 3.81k, False: 1.66k]
  ------------------
  962|  3.81k|        memcpy(op, ip, 16);
  963|  3.81k|      }
  964|  6.42k|      else if (op_limit - op >= 32 && ip_limit - ip >= 32) {
  ------------------
  |  Branch (964:16): [True: 3.07k, False: 3.35k]
  |  Branch (964:39): [True: 1.44k, False: 1.63k]
  ------------------
  965|  1.44k|        memcpy(op, ip, 32);
  966|  1.44k|      }
  967|  4.98k|      else
  968|  4.98k|#endif
  969|  4.98k|      {
  970|  4.98k|        memcpy(op, ip, ctrl);
  971|  4.98k|      }
  972|  10.2k|      op += ctrl; ip += ctrl;
  973|       |      // On GCC-6, fastcopy this is still faster than plain memcpy
  974|       |      // However, using recent CLANG/LLVM 9.0, there is almost no difference
  975|       |      // in performance.
  976|       |      // And starting on CLANG/LLVM 10 and GCC 9, memcpy is generally faster.
  977|       |      // op = fastcopy(op, ip, (unsigned) ctrl); ip += ctrl;
  978|       |
  979|  10.2k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   39|  10.2k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 3.17k, False: 7.06k]
  |  |  ------------------
  ------------------
  980|  7.06k|      ctrl = *ip++;
  981|  7.06k|    }
  982|  18.7k|  }
  983|       |
  984|  3.17k|  return (int)(op - (uint8_t*)output);
  985|  3.17k|}
blosclz.c:compress_impl:
  538|  1.24k|                                        int maxout, uint32_t htab[], blosclz_state* state, const int tagged) {
  539|  1.24k|  uint8_t* ibase = (uint8_t*)input;
  540|       |
  541|       |  /* Keep match coverage and boundary positioning consistent across levels.
  542|       |   * A shift of 4 truncates matches further and can disrupt periodic byte deltas,
  543|       |   * reducing both compression ratio and speed on floating-point ramps. */
  544|  1.24k|  unsigned ipshift = 3;
  545|       |  /* Retain the higher-level minimum: accepting more short matches can prevent
  546|       |   * finding longer matches and increase decompression work. */
  547|  1.24k|  unsigned minlen = clevel == 1 ? 3 : 4;
  ------------------
  |  Branch (547:21): [True: 0, False: 1.24k]
  ------------------
  548|       |
  549|       |  /* Grow the table gradually from 1 KB at level 1 to 64 KB at level 7.
  550|       |   * Smaller tables also bound the entropy probe, reducing low-level work on
  551|       |   * the small alphabets produced by filtered ramps. */
  552|  1.24k|  uint8_t hashlog_[10] = {0, HASH_LOG - 6, HASH_LOG - 5, HASH_LOG - 4, HASH_LOG - 3,
  ------------------
  |  |   61|  1.24k|#define HASH_LOG (14U)
  ------------------
                uint8_t hashlog_[10] = {0, HASH_LOG - 6, HASH_LOG - 5, HASH_LOG - 4, HASH_LOG - 3,
  ------------------
  |  |   61|  1.24k|#define HASH_LOG (14U)
  ------------------
                uint8_t hashlog_[10] = {0, HASH_LOG - 6, HASH_LOG - 5, HASH_LOG - 4, HASH_LOG - 3,
  ------------------
  |  |   61|  1.24k|#define HASH_LOG (14U)
  ------------------
                uint8_t hashlog_[10] = {0, HASH_LOG - 6, HASH_LOG - 5, HASH_LOG - 4, HASH_LOG - 3,
  ------------------
  |  |   61|  1.24k|#define HASH_LOG (14U)
  ------------------
  553|  1.24k|                          HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   61|  1.24k|#define HASH_LOG (14U)
  ------------------
                                        HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   61|  1.24k|#define HASH_LOG (14U)
  ------------------
                                        HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   61|  1.24k|#define HASH_LOG (14U)
  ------------------
                                        HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   61|  1.24k|#define HASH_LOG (14U)
  ------------------
                                        HASH_LOG - 2, HASH_LOG - 1, HASH_LOG, HASH_LOG, HASH_LOG};
  ------------------
  |  |   61|  1.24k|#define HASH_LOG (14U)
  ------------------
  554|  1.24k|  uint8_t hashlog = hashlog_[clevel];
  555|       |
  556|       |  // Experiments say that checking 1/4 of the buffer is enough to figure out approx cratio
  557|       |  // UPDATE: new experiments with ERA5 datasets (float32) say that checking the whole buffer
  558|       |  // is better (specially when combined with bitshuffle).
  559|       |  // The loss in speed for checking the whole buffer is pretty negligible too.
  560|  1.24k|  int maxlen = length;
  561|  1.24k|  if (clevel < 2) {
  ------------------
  |  Branch (561:7): [True: 0, False: 1.24k]
  ------------------
  562|      0|    maxlen /= 8;
  563|      0|  }
  564|  1.24k|  else if (clevel < 4) {
  ------------------
  |  Branch (564:12): [True: 0, False: 1.24k]
  ------------------
  565|      0|    maxlen /= 4;
  566|      0|  }
  567|  1.24k|  else if (clevel < 7) {
  ------------------
  |  Branch (567:12): [True: 568, False: 674]
  ------------------
  568|    568|    maxlen /= 2;
  569|    568|  }
  570|       |  // Start probing somewhere inside the buffer
  571|  1.24k|  int shift = length - maxlen;
  572|       |  // Actual entropy probing!
  573|  1.24k|  uint32_t base = htab_reset(htab, hashlog, state, maxlen, tagged);
  574|  1.24k|  double cratio = get_cratio(ibase + shift, maxlen, minlen, ipshift, htab, hashlog, base, tagged);
  575|  1.24k|  if (state != NULL) {
  ------------------
  |  Branch (575:7): [True: 1.24k, False: 0]
  ------------------
  576|       |    /* Tagged lookups cost a bit per hash probe; they only pay off when skipping
  577|       |     * the (large) table clear matters, i.e. on very compressible data. */
  578|  1.24k|    state->tagged = clevel >= 4 && cratio >= 8.0;
  ------------------
  |  Branch (578:21): [True: 1.24k, False: 0]
  |  Branch (578:36): [True: 108, False: 1.13k]
  ------------------
  579|  1.24k|  }
  580|       |  // discard probes with small compression ratios (too expensive)
  581|  1.24k|  double cratio_[10] = {0, 2, 1.5, 1.2, 1.2, 1.2, 1.2, 1.15, 1.1, 1.0};
  582|  1.24k|  if (cratio < cratio_[clevel]) {
  ------------------
  |  Branch (582:7): [True: 0, False: 1.24k]
  ------------------
  583|      0|      goto out;
  584|      0|  }
  585|       |
  586|  1.24k|  uint8_t* ip = ibase;
  587|  1.24k|  uint8_t* ip_bound = ibase + length - 1;
  588|  1.24k|  uint8_t* ip_limit = ibase + length - 12;
  589|  1.24k|  uint8_t* op = (uint8_t*)output;
  590|  1.24k|  const uint8_t* op_limit = op + maxout;
  591|  1.24k|  uint32_t seq;
  592|  1.24k|  uint8_t copy;
  593|  1.24k|  uint32_t hval;
  594|       |
  595|       |  /* input and output buffer cannot be less than 16 and 66 bytes or we can get into trouble */
  596|  1.24k|  if (length < 16 || maxout < 66) {
  ------------------
  |  Branch (596:7): [True: 0, False: 1.24k]
  |  Branch (596:22): [True: 224, False: 1.01k]
  ------------------
  597|    224|    return 0;
  598|    224|  }
  599|       |
  600|       |  // Initialize the hash table
  601|  1.01k|  base = htab_reset(htab, hashlog, state, length, tagged);
  602|       |
  603|       |  /* we start with literal copy */
  604|  1.01k|  copy = 4;
  605|  1.01k|  *op++ = MAX_COPY - 1;
  ------------------
  |  |   49|  1.01k|#define MAX_COPY 32U
  ------------------
  606|  1.01k|  *op++ = *ip++;
  607|  1.01k|  *op++ = *ip++;
  608|  1.01k|  *op++ = *ip++;
  609|  1.01k|  *op++ = *ip++;
  610|       |
  611|       |  /* main loop */
  612|  25.6k|  while (BLOSCLZ_LIKELY(ip < ip_limit)) {
  ------------------
  |  |   38|  25.6k|#define BLOSCLZ_LIKELY(c)    (c)
  |  |  ------------------
  |  |  |  Branch (38:30): [True: 24.6k, False: 1.01k]
  |  |  ------------------
  ------------------
  613|  24.6k|    const uint8_t* ref;
  614|  24.6k|    unsigned distance;
  615|  24.6k|    uint8_t* anchor = ip;    /* comparison starting-point */
  616|       |
  617|       |    /* find potential match */
  618|  24.6k|    seq = BLOSCLZ_READU32(ip);
  ------------------
  |  |   58|  24.6k|  #define BLOSCLZ_READU32(p) *((const uint32_t*)(p))
  ------------------
  619|  24.6k|    HASH_FUNCTION(hval, seq, hashlog)
  ------------------
  |  |   64|  24.6k|#define HASH_FUNCTION(v, s, h) {      \
  |  |   65|  24.6k|  (v) = ((s) * 2654435761U) >> (32U - (h)); \
  |  |   66|  24.6k|}
  ------------------
  620|  24.6k|    ref = ibase + HTAB_GET(htab[hval], base);
  ------------------
  |  |  407|  24.6k|#define HTAB_GET(entry, base) (tagged ? ((entry) >= (base) ? (entry) - (base) : 0) : (entry))
  |  |  ------------------
  |  |  |  Branch (407:32): [True: 6.47k, False: 18.1k]
  |  |  |  Branch (407:42): [True: 853, False: 5.61k]
  |  |  ------------------
  ------------------
  621|       |    /* With no pending literals, try the position following the previous
  622|       |     * occurrence of ip[-1..2].  Its alignment can break a chain of short
  623|       |     * matches on periodic data even when the ordinary candidate also matches.
  624|       |     * Read the old entry before updating it, then reload the ordinary candidate:
  625|       |     * the two hashes can share a slot. */
  626|  24.6k|    if (copy == 0 && ip > ibase + 4 && ip_bound - ip >= 8) {
  ------------------
  |  Branch (626:9): [True: 2.65k, False: 21.9k]
  |  Branch (626:22): [True: 2.65k, False: 0]
  |  Branch (626:40): [True: 2.65k, False: 0]
  ------------------
  627|  2.65k|      uint32_t prevhash;
  628|  2.65k|      HASH_FUNCTION(prevhash, BLOSCLZ_READU32(ip - 1), hashlog)
  ------------------
  |  |   64|  2.65k|#define HASH_FUNCTION(v, s, h) {      \
  |  |   65|  2.65k|  (v) = ((s) * 2654435761U) >> (32U - (h)); \
  |  |   66|  2.65k|}
  ------------------
  629|  2.65k|      const uint8_t *candidate = ibase + HTAB_GET(htab[prevhash], base) + 1;
  ------------------
  |  |  407|  2.65k|#define HTAB_GET(entry, base) (tagged ? ((entry) >= (base) ? (entry) - (base) : 0) : (entry))
  |  |  ------------------
  |  |  |  Branch (407:32): [True: 255, False: 2.39k]
  |  |  |  Branch (407:42): [True: 142, False: 113]
  |  |  ------------------
  ------------------
  630|  2.65k|      htab[prevhash] = (uint32_t)(ip - 1 - ibase) + base;
  631|  2.65k|      ref = ibase + HTAB_GET(htab[hval], base);
  ------------------
  |  |  407|  2.65k|#define HTAB_GET(entry, base) (tagged ? ((entry) >= (base) ? (entry) - (base) : 0) : (entry))
  |  |  ------------------
  |  |  |  Branch (407:32): [True: 255, False: 2.39k]
  |  |  |  Branch (407:42): [True: 44, False: 211]
  |  |  ------------------
  ------------------
  632|  2.65k|      if (candidate < ip && ip - candidate < MAX_FARDISTANCE &&
  ------------------
  |  |   51|  5.14k|#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1)
  |  |  ------------------
  |  |  |  |   50|  2.48k|#define MAX_DISTANCE 8191
  |  |  ------------------
  ------------------
  |  Branch (632:11): [True: 2.48k, False: 168]
  |  Branch (632:29): [True: 2.48k, False: 0]
  ------------------
  633|  2.48k|          memcmp(candidate, ip, 8) == 0) {
  ------------------
  |  Branch (633:11): [True: 515, False: 1.97k]
  ------------------
  634|    515|        ref = candidate;
  635|    515|      }
  636|  2.65k|    }
  637|       |
  638|       |    /* calculate distance to the match */
  639|  24.6k|    distance = (unsigned int)(anchor - ref);
  640|       |
  641|       |    /* update hash table */
  642|  24.6k|    htab[hval] = (uint32_t) (anchor - ibase) + base;
  643|       |
  644|  24.6k|    if (distance == 0 || (distance >= MAX_FARDISTANCE)) {
  ------------------
  |  |   51|  24.6k|#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1)
  |  |  ------------------
  |  |  |  |   50|  24.6k|#define MAX_DISTANCE 8191
  |  |  ------------------
  ------------------
  |  Branch (644:9): [True: 0, False: 24.6k]
  |  Branch (644:26): [True: 0, False: 24.6k]
  ------------------
  645|      0|      LITERAL(ip, op, op_limit, anchor, copy)
  ------------------
  |  |  333|      0|#define LITERAL(ip, op, op_limit, anchor, copy) {       \
  |  |  334|      0|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 2))          \
  |  |  ------------------
  |  |  |  |   39|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  335|      0|    goto out;                                           \
  |  |  336|      0|  *(op)++ = *(anchor)++;                                \
  |  |  337|      0|  (ip) = (anchor);                                      \
  |  |  338|      0|  (copy)++;                                             \
  |  |  339|      0|  if (BLOSCLZ_UNLIKELY((copy) == MAX_COPY)) {           \
  |  |  ------------------
  |  |  |  |   39|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|      0|    (copy) = 0;                                         \
  |  |  341|      0|    *(op)++ = MAX_COPY-1;                               \
  |  |  ------------------
  |  |  |  |   49|      0|#define MAX_COPY 32U
  |  |  ------------------
  |  |  342|      0|  }                                                     \
  |  |  343|      0|}
  ------------------
  646|      0|      continue;
  647|      0|    }
  648|       |
  649|       |    /* is this a match? check the first 4 bytes */
  650|  24.6k|    if (BLOSCLZ_UNLIKELY(BLOSCLZ_READU32(ref) == BLOSCLZ_READU32(ip))) {
  ------------------
  |  |   39|  24.6k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 6.83k, False: 17.7k]
  |  |  ------------------
  ------------------
  651|  6.83k|      ref += 4;
  652|  17.7k|    } else {
  653|       |      /* no luck, copy as a literal */
  654|  17.7k|      LITERAL(ip, op, op_limit, anchor, copy)
  ------------------
  |  |  333|  17.7k|#define LITERAL(ip, op, op_limit, anchor, copy) {       \
  |  |  334|  17.7k|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 2))          \
  |  |  ------------------
  |  |  |  |   39|  17.7k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 17.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  335|  17.7k|    goto out;                                           \
  |  |  336|  17.7k|  *(op)++ = *(anchor)++;                                \
  |  |  337|  17.7k|  (ip) = (anchor);                                      \
  |  |  338|  17.7k|  (copy)++;                                             \
  |  |  339|  17.7k|  if (BLOSCLZ_UNLIKELY((copy) == MAX_COPY)) {           \
  |  |  ------------------
  |  |  |  |   39|  17.7k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 168, False: 17.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|    168|    (copy) = 0;                                         \
  |  |  341|    168|    *(op)++ = MAX_COPY-1;                               \
  |  |  ------------------
  |  |  |  |   49|    168|#define MAX_COPY 32U
  |  |  ------------------
  |  |  342|    168|  }                                                     \
  |  |  343|  17.7k|}
  ------------------
  655|      0|      continue;
  656|  17.7k|    }
  657|       |
  658|       |    /* last matched byte */
  659|  6.83k|    ip = anchor + 4;
  660|       |
  661|       |    /* distance is biased */
  662|  6.83k|    distance--;
  663|       |
  664|       |    /* get runs or matches; zero distance means a run */
  665|  6.83k|    ip = get_run_or_match(ip, ip_bound, ref, !distance);
  666|       |
  667|       |    /* length is biased, '1' means a match of 3 bytes */
  668|  6.83k|    ip -= ipshift;
  669|       |
  670|  6.83k|    unsigned len = (int)(ip - anchor);
  671|       |
  672|       |    // Encoding short lengths is expensive during decompression
  673|  6.83k|    if (len < minlen || (len <= 5 && distance >= MAX_DISTANCE)) {
  ------------------
  |  |   50|    830|#define MAX_DISTANCE 8191
  ------------------
  |  Branch (673:9): [True: 3.48k, False: 3.34k]
  |  Branch (673:26): [True: 830, False: 2.51k]
  |  Branch (673:38): [True: 0, False: 830]
  ------------------
  674|  3.48k|      LITERAL(ip, op, op_limit, anchor, copy)
  ------------------
  |  |  333|  3.48k|#define LITERAL(ip, op, op_limit, anchor, copy) {       \
  |  |  334|  3.48k|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 2))          \
  |  |  ------------------
  |  |  |  |   39|  3.48k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 3.48k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  335|  3.48k|    goto out;                                           \
  |  |  336|  3.48k|  *(op)++ = *(anchor)++;                                \
  |  |  337|  3.48k|  (ip) = (anchor);                                      \
  |  |  338|  3.48k|  (copy)++;                                             \
  |  |  339|  3.48k|  if (BLOSCLZ_UNLIKELY((copy) == MAX_COPY)) {           \
  |  |  ------------------
  |  |  |  |   39|  3.48k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 3.48k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|      0|    (copy) = 0;                                         \
  |  |  341|      0|    *(op)++ = MAX_COPY-1;                               \
  |  |  ------------------
  |  |  |  |   49|      0|#define MAX_COPY 32U
  |  |  ------------------
  |  |  342|      0|  }                                                     \
  |  |  343|  3.48k|}
  ------------------
  675|      0|      continue;
  676|  3.48k|    }
  677|       |
  678|       |    /* if we have copied something, adjust the copy count */
  679|  3.34k|    if (copy)
  ------------------
  |  Branch (679:9): [True: 2.32k, False: 1.02k]
  ------------------
  680|       |      /* copy is biased, '0' means 1 byte copy */
  681|  2.32k|      *(op - copy - 1) = (uint8_t)(copy - 1);
  682|  1.02k|    else
  683|       |      /* back, to overwrite the copy count */
  684|  1.02k|      op--;
  685|       |    /* reset literal counter */
  686|  3.34k|    copy = 0;
  687|       |
  688|       |    /* encode the match */
  689|  3.34k|    if (distance < MAX_DISTANCE) {
  ------------------
  |  |   50|  3.34k|#define MAX_DISTANCE 8191
  ------------------
  |  Branch (689:9): [True: 3.34k, False: 0]
  ------------------
  690|  3.34k|      if (len < 7) {
  ------------------
  |  Branch (690:11): [True: 998, False: 2.34k]
  ------------------
  691|    998|        MATCH_SHORT(op, op_limit, len, distance)
  ------------------
  |  |  355|    998|#define MATCH_SHORT(op, op_limit, len, distance) {        \
  |  |  356|    998|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 2))            \
  |  |  ------------------
  |  |  |  |   39|    998|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 998]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  357|    998|    goto out;                                             \
  |  |  358|    998|  *(op)++ = (uint8_t)(((len) << 5U) + ((distance) >> 8U));\
  |  |  359|    998|  *(op)++ = (uint8_t)(((distance) & 255U));               \
  |  |  360|    998|}
  ------------------
  692|  2.34k|      } else {
  693|  7.04k|        MATCH_LONG(op, op_limit, len, distance)
  ------------------
  |  |  362|  2.34k|#define MATCH_LONG(op, op_limit, len, distance) {       \
  |  |  363|  2.34k|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 1))          \
  |  |  ------------------
  |  |  |  |   39|  2.34k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 2.34k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  364|  2.34k|    goto out;                                           \
  |  |  365|  2.34k|  *(op)++ = (uint8_t)((7U << 5U) + ((distance) >> 8U)); \
  |  |  366|  2.34k|  for ((len) -= 7; (len) >= 255; (len) -= 255) {        \
  |  |  ------------------
  |  |  |  Branch (366:20): [True: 0, False: 2.34k]
  |  |  ------------------
  |  |  367|      0|    if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 1))        \
  |  |  ------------------
  |  |  |  |   39|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  368|      0|      goto out;                                         \
  |  |  369|      0|    *(op)++ = 255;                                      \
  |  |  370|      0|  }                                                     \
  |  |  371|  2.34k|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 2))          \
  |  |  ------------------
  |  |  |  |   39|  2.34k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 2.34k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  2.34k|    goto out;                                           \
  |  |  373|  2.34k|  *(op)++ = (uint8_t)(len);                             \
  |  |  374|  2.34k|  *(op)++ = (uint8_t)(((distance) & 255U));             \
  |  |  375|  2.34k|}
  ------------------
  694|  7.04k|      }
  695|  3.34k|    } else {
  696|       |      /* far away, but not yet in the another galaxy... */
  697|      0|      distance -= MAX_DISTANCE;
  ------------------
  |  |   50|      0|#define MAX_DISTANCE 8191
  ------------------
  698|      0|      if (len < 7) {
  ------------------
  |  Branch (698:11): [True: 0, False: 0]
  ------------------
  699|      0|        MATCH_SHORT_FAR(op, op_limit, len, distance)
  ------------------
  |  |  377|      0|#define MATCH_SHORT_FAR(op, op_limit, len, distance) {      \
  |  |  378|      0|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 4))              \
  |  |  ------------------
  |  |  |  |   39|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  379|      0|    goto out;                                               \
  |  |  380|      0|  *(op)++ = (uint8_t)(((len) << 5U) + 31);                  \
  |  |  381|      0|  *(op)++ = 255;                                            \
  |  |  382|      0|  *(op)++ = (uint8_t)((distance) >> 8U);                    \
  |  |  383|      0|  *(op)++ = (uint8_t)((distance) & 255U);                   \
  |  |  384|      0|}
  ------------------
  700|      0|      } else {
  701|      0|        MATCH_LONG_FAR(op, op_limit, len, distance)
  ------------------
  |  |  386|      0|#define MATCH_LONG_FAR(op, op_limit, len, distance) {       \
  |  |  387|      0|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 1))              \
  |  |  ------------------
  |  |  |  |   39|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  388|      0|    goto out;                                               \
  |  |  389|      0|  *(op)++ = (7U << 5U) + 31;                                \
  |  |  390|      0|  for ((len) -= 7; (len) >= 255; (len) -= 255) {            \
  |  |  ------------------
  |  |  |  Branch (390:20): [True: 0, False: 0]
  |  |  ------------------
  |  |  391|      0|    if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 1))            \
  |  |  ------------------
  |  |  |  |   39|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  392|      0|      goto out;                                             \
  |  |  393|      0|    *(op)++ = 255;                                          \
  |  |  394|      0|  }                                                         \
  |  |  395|      0|  if (BLOSCLZ_UNLIKELY((op_limit) - (op) < 4))              \
  |  |  ------------------
  |  |  |  |   39|      0|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  396|      0|    goto out;                                               \
  |  |  397|      0|  *(op)++ = (uint8_t)(len);                                 \
  |  |  398|      0|  *(op)++ = 255;                                            \
  |  |  399|      0|  *(op)++ = (uint8_t)((distance) >> 8U);                    \
  |  |  400|      0|  *(op)++ = (uint8_t)((distance) & 255U);                   \
  |  |  401|      0|}
  ------------------
  702|      0|      }
  703|      0|    }
  704|       |
  705|       |    /* Advance past the biased match length.  Update the boundary hashes on
  706|       |     * the next iteration, preserving the old ip-1 entry for the extra candidate. */
  707|  3.34k|    ip += 2;
  708|       |
  709|  3.34k|    if (BLOSCLZ_UNLIKELY(op_limit - op < 1))
  ------------------
  |  |   39|  3.34k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 0, False: 3.34k]
  |  |  ------------------
  ------------------
  710|      0|      goto out;
  711|       |
  712|       |    /* assuming literal copy */
  713|  3.34k|    *op++ = MAX_COPY - 1;
  ------------------
  |  |   49|  3.34k|#define MAX_COPY 32U
  ------------------
  714|  3.34k|  }
  715|       |
  716|       |  /* left-over as literal copy */
  717|  6.82k|  while (BLOSCLZ_UNLIKELY(ip <= ip_bound)) {
  ------------------
  |  |   39|  6.82k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 5.84k, False: 973]
  |  |  ------------------
  ------------------
  718|  5.84k|    if (BLOSCLZ_UNLIKELY(op_limit - op < 2)) goto out;
  ------------------
  |  |   39|  5.84k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 45, False: 5.80k]
  |  |  ------------------
  ------------------
  719|  5.80k|    *op++ = *ip++;
  720|  5.80k|    copy++;
  721|  5.80k|    if (BLOSCLZ_UNLIKELY(copy == MAX_COPY)) {
  ------------------
  |  |   39|  5.80k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 15, False: 5.78k]
  |  |  ------------------
  ------------------
  722|     15|      copy = 0;
  723|     15|      *op++ = MAX_COPY - 1;
  ------------------
  |  |   49|     15|#define MAX_COPY 32U
  ------------------
  724|     15|    }
  725|  5.80k|  }
  726|       |
  727|       |  /* if we have copied something, adjust the copy length */
  728|    973|  if (copy)
  ------------------
  |  Branch (728:7): [True: 958, False: 15]
  ------------------
  729|    958|    *(op - copy - 1) = (uint8_t)(copy - 1);
  730|     15|  else
  731|     15|    op--;
  732|       |
  733|       |  /* marker for blosclz */
  734|    973|  *(uint8_t*)output |= (1U << 5U);
  735|       |
  736|    973|  return (int)(op - (uint8_t*)output);
  737|       |
  738|     45|  out:
  739|     45|  return 0;
  740|  1.01k|}
blosclz.c:htab_reset:
  519|  2.26k|                                          const int tagged) {
  520|  2.26k|  if (!tagged) {
  ------------------
  |  Branch (520:7): [True: 2.04k, False: 216]
  ------------------
  521|  2.04k|    memset(htab, 0, (1U << hashlog) * sizeof(uint32_t));
  522|       |    /* untagged entries (< span) must look stale to the next tagged pass */
  523|  2.04k|    if (state != NULL && state->base < (uint32_t)span) {
  ------------------
  |  Branch (523:9): [True: 2.04k, False: 0]
  |  Branch (523:26): [True: 74, False: 1.97k]
  ------------------
  524|     74|      state->base = (uint32_t)span;
  525|     74|    }
  526|  2.04k|    return 0;
  527|  2.04k|  }
  528|    216|  if (state->base > UINT32_MAX - (uint32_t)span) {
  ------------------
  |  Branch (528:7): [True: 0, False: 216]
  ------------------
  529|      0|    memset(state->htab, 0, sizeof(state->htab));
  530|      0|    state->base = 0;
  531|      0|  }
  532|    216|  uint32_t base = state->base;
  533|    216|  state->base += (uint32_t)span;
  534|    216|  return base;
  535|  2.26k|}
blosclz.c:get_cratio:
  417|  1.24k|                                        int8_t hashlog, uint32_t base, const int tagged) {
  418|  1.24k|  uint8_t* ip = ibase;
  419|  1.24k|  int32_t oc = 0;
  420|  1.24k|  const uint16_t hashlen = (1U << (uint8_t)hashlog);
  421|  1.24k|  uint32_t hval;
  422|  1.24k|  uint32_t seq;
  423|  1.24k|  uint8_t copy;
  424|       |  // Make a tradeoff between testing too much and too little
  425|  1.24k|  uint16_t limit = (maxlen > hashlen) ? hashlen : maxlen;
  ------------------
  |  Branch (425:20): [True: 0, False: 1.24k]
  ------------------
  426|  1.24k|  uint8_t* ip_bound = ibase + limit - 1;
  427|  1.24k|  uint8_t* ip_limit = ibase + limit - 12;
  428|       |
  429|       |
  430|       |  /* we start with literal copy */
  431|  1.24k|  copy = 4;
  432|  1.24k|  oc += 5;
  433|       |
  434|       |  /* main loop */
  435|  20.7k|  while (BLOSCLZ_LIKELY(ip < ip_limit)) {
  ------------------
  |  |   38|  20.7k|#define BLOSCLZ_LIKELY(c)    (c)
  |  |  ------------------
  |  |  |  Branch (38:30): [True: 19.5k, False: 1.24k]
  |  |  ------------------
  ------------------
  436|  19.5k|    const uint8_t* ref;
  437|  19.5k|    unsigned distance;
  438|  19.5k|    uint8_t* anchor = ip;    /* comparison starting-point */
  439|       |
  440|       |    /* find potential match */
  441|  19.5k|    seq = BLOSCLZ_READU32(ip);
  ------------------
  |  |   58|  19.5k|  #define BLOSCLZ_READU32(p) *((const uint32_t*)(p))
  ------------------
  442|  19.5k|    HASH_FUNCTION(hval, seq, hashlog)
  ------------------
  |  |   64|  19.5k|#define HASH_FUNCTION(v, s, h) {      \
  |  |   65|  19.5k|  (v) = ((s) * 2654435761U) >> (32U - (h)); \
  |  |   66|  19.5k|}
  ------------------
  443|  19.5k|    ref = ibase + HTAB_GET(htab[hval], base);
  ------------------
  |  |  407|  19.5k|#define HTAB_GET(entry, base) (tagged ? ((entry) >= (base) ? (entry) - (base) : 0) : (entry))
  |  |  ------------------
  |  |  |  Branch (407:32): [True: 6.22k, False: 13.2k]
  |  |  |  Branch (407:42): [True: 881, False: 5.34k]
  |  |  ------------------
  ------------------
  444|       |
  445|       |    /* calculate distance to the match */
  446|  19.5k|    distance = (unsigned int)(anchor - ref);
  447|       |
  448|       |    /* update hash table */
  449|  19.5k|    htab[hval] = (uint32_t) (anchor - ibase) + base;
  450|       |
  451|  19.5k|    if (distance == 0 || (distance >= MAX_FARDISTANCE)) {
  ------------------
  |  |   51|  18.2k|#define MAX_FARDISTANCE (65535 + MAX_DISTANCE - 1)
  |  |  ------------------
  |  |  |  |   50|  18.2k|#define MAX_DISTANCE 8191
  |  |  ------------------
  ------------------
  |  Branch (451:9): [True: 1.24k, False: 18.2k]
  |  Branch (451:26): [True: 0, False: 18.2k]
  ------------------
  452|  1.24k|      LITERAL2(ip, anchor, copy)
  ------------------
  |  |  345|  1.24k|#define LITERAL2(ip, anchor, copy) {                    \
  |  |  346|  1.24k|  oc++; (anchor)++;                                     \
  |  |  347|  1.24k|  (ip) = (anchor);                                      \
  |  |  348|  1.24k|  (copy)++;                                             \
  |  |  349|  1.24k|  if (BLOSCLZ_UNLIKELY((copy) == MAX_COPY)) {           \
  |  |  ------------------
  |  |  |  |   39|  1.24k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 0, False: 1.24k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  350|      0|    (copy) = 0;                                         \
  |  |  351|      0|    oc++;                                               \
  |  |  352|      0|  }                                                     \
  |  |  353|  1.24k|}
  ------------------
  453|  1.24k|      continue;
  454|  1.24k|    }
  455|       |
  456|       |    /* is this a match? check the first 4 bytes */
  457|  18.2k|    if (BLOSCLZ_READU32(ref) == BLOSCLZ_READU32(ip)) {
  ------------------
  |  |   58|  18.2k|  #define BLOSCLZ_READU32(p) *((const uint32_t*)(p))
  ------------------
                  if (BLOSCLZ_READU32(ref) == BLOSCLZ_READU32(ip)) {
  ------------------
  |  |   58|  18.2k|  #define BLOSCLZ_READU32(p) *((const uint32_t*)(p))
  ------------------
  |  Branch (457:9): [True: 6.21k, False: 12.0k]
  ------------------
  458|  6.21k|      ref += 4;
  459|  6.21k|    }
  460|  12.0k|    else {
  461|       |      /* no luck, copy as a literal */
  462|  12.0k|      LITERAL2(ip, anchor, copy)
  ------------------
  |  |  345|  12.0k|#define LITERAL2(ip, anchor, copy) {                    \
  |  |  346|  12.0k|  oc++; (anchor)++;                                     \
  |  |  347|  12.0k|  (ip) = (anchor);                                      \
  |  |  348|  12.0k|  (copy)++;                                             \
  |  |  349|  12.0k|  if (BLOSCLZ_UNLIKELY((copy) == MAX_COPY)) {           \
  |  |  ------------------
  |  |  |  |   39|  12.0k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 96, False: 11.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  350|     96|    (copy) = 0;                                         \
  |  |  351|     96|    oc++;                                               \
  |  |  352|     96|  }                                                     \
  |  |  353|  12.0k|}
  ------------------
  463|  12.0k|      continue;
  464|  12.0k|    }
  465|       |
  466|       |    /* last matched byte */
  467|  6.21k|    ip = anchor + 4;
  468|       |
  469|       |    /* distance is biased */
  470|  6.21k|    distance--;
  471|       |
  472|       |    /* get runs or matches; zero distance means a run */
  473|  6.21k|    ip = get_run_or_match(ip, ip_bound, ref, !distance);
  474|       |
  475|  6.21k|    ip -= ipshift;
  476|  6.21k|    int len = (int)(ip - anchor);
  477|  6.21k|    if (len < minlen) {
  ------------------
  |  Branch (477:9): [True: 2.58k, False: 3.63k]
  ------------------
  478|  2.58k|      LITERAL2(ip, anchor, copy)
  ------------------
  |  |  345|  2.58k|#define LITERAL2(ip, anchor, copy) {                    \
  |  |  346|  2.58k|  oc++; (anchor)++;                                     \
  |  |  347|  2.58k|  (ip) = (anchor);                                      \
  |  |  348|  2.58k|  (copy)++;                                             \
  |  |  349|  2.58k|  if (BLOSCLZ_UNLIKELY((copy) == MAX_COPY)) {           \
  |  |  ------------------
  |  |  |  |   39|  2.58k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (39:30): [True: 15, False: 2.56k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  350|     15|    (copy) = 0;                                         \
  |  |  351|     15|    oc++;                                               \
  |  |  352|     15|  }                                                     \
  |  |  353|  2.58k|}
  ------------------
  479|  2.58k|      continue;
  480|  2.58k|    }
  481|       |
  482|       |    /* if we haven't copied anything, adjust the output counter */
  483|  3.63k|    if (!copy)
  ------------------
  |  Branch (483:9): [True: 997, False: 2.63k]
  ------------------
  484|    997|      oc--;
  485|       |    /* reset literal counter */
  486|  3.63k|    copy = 0;
  487|       |
  488|       |    /* encode the match */
  489|  3.63k|    if (distance < MAX_DISTANCE) {
  ------------------
  |  |   50|  3.63k|#define MAX_DISTANCE 8191
  ------------------
  |  Branch (489:9): [True: 3.63k, False: 0]
  ------------------
  490|  3.63k|      if (len >= 7) {
  ------------------
  |  Branch (490:11): [True: 2.23k, False: 1.40k]
  ------------------
  491|  2.23k|        oc += ((len - 7) / 255) + 1;
  492|  2.23k|      }
  493|  3.63k|      oc += 2;
  494|  3.63k|    }
  495|      0|    else {
  496|       |      /* far away, but not yet in the another galaxy... */
  497|      0|      if (len >= 7) {
  ------------------
  |  Branch (497:11): [True: 0, False: 0]
  ------------------
  498|      0|        oc += ((len - 7) / 255) + 1;
  499|      0|      }
  500|      0|      oc += 4;
  501|      0|    }
  502|       |
  503|       |    /* update the hash at match boundary */
  504|  3.63k|    seq = BLOSCLZ_READU32(ip);
  ------------------
  |  |   58|  3.63k|  #define BLOSCLZ_READU32(p) *((const uint32_t*)(p))
  ------------------
  505|  3.63k|    HASH_FUNCTION(hval, seq, hashlog)
  ------------------
  |  |   64|  3.63k|#define HASH_FUNCTION(v, s, h) {      \
  |  |   65|  3.63k|  (v) = ((s) * 2654435761U) >> (32U - (h)); \
  |  |   66|  3.63k|}
  ------------------
  506|  3.63k|    htab[hval] = (uint32_t)(ip++ - ibase) + base;
  507|  3.63k|    ip++;
  508|       |    /* assuming literal copy */
  509|  3.63k|    oc++;
  510|  3.63k|  }
  511|       |
  512|  1.24k|  double ic = (double)(ip - ibase);
  513|  1.24k|  return ic / (double)oc;
  514|  1.24k|}
blosclz.c:get_run_or_match:
  299|  13.0k|static uint8_t* get_run_or_match(uint8_t* ip, uint8_t* ip_bound, const uint8_t* ref, bool run) {
  300|  13.0k|  if (BLOSCLZ_UNLIKELY(run)) {
  ------------------
  |  |   39|  13.0k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (39:30): [True: 3.04k, False: 10.0k]
  |  |  ------------------
  ------------------
  301|       |#if defined(__AVX2__)
  302|       |    // Extensive experiments on AMD Ryzen3 say that regular get_run is faster
  303|       |    // ip = get_run_32(ip, ip_bound, ref);
  304|       |    ip = get_run(ip, ip_bound, ref);
  305|       |#elif defined(__SSE2__)
  306|       |    // Extensive experiments on AMD Ryzen3 say that regular get_run is faster
  307|       |    // ip = get_run_16(ip, ip_bound, ref);
  308|  3.04k|    ip = get_run(ip, ip_bound, ref);
  309|       |#elif defined(__aarch64__) || defined(_M_ARM64)
  310|       |    ip = get_run_neon(ip, ip_bound, ref);
  311|       |#else
  312|       |    ip = get_run(ip, ip_bound, ref);
  313|       |#endif
  314|  3.04k|  }
  315|  10.0k|  else {
  316|       |#if defined(__AVX2__)
  317|       |    // Extensive experiments on AMD Ryzen3 say that regular get_match_16 is faster
  318|       |    // ip = get_match_32(ip, ip_bound, ref);
  319|       |    ip = get_match_16(ip, ip_bound, ref);
  320|       |#elif defined(__SSE2__)
  321|       |    ip = get_match_16(ip, ip_bound, ref);
  322|       |#elif defined(__aarch64__) || defined(_M_ARM64)
  323|       |    ip = get_match_neon(ip, ip_bound, ref);
  324|       |#else
  325|       |    ip = get_match(ip, ip_bound, ref);
  326|       |#endif
  327|  10.0k|  }
  328|       |
  329|  13.0k|  return ip;
  330|  13.0k|}
blosclz.c:get_run:
  124|  3.04k|static uint8_t *get_run(uint8_t *ip, const uint8_t *ip_bound, const uint8_t *ref) {
  125|  3.04k|  uint8_t x = ip[-1];
  126|  3.04k|  int64_t value, value2;
  127|       |  /* Broadcast the value for every byte in a 64-bit register */
  128|  3.04k|  memset(&value, x, 8);
  129|       |  /* safe because the outer check against ip limit */
  130|  10.4k|  while (ip < (ip_bound - sizeof(int64_t))) {
  ------------------
  |  Branch (130:10): [True: 9.74k, False: 663]
  ------------------
  131|       |#if defined(BLOSC_STRICT_ALIGN)
  132|       |    memcpy(&value2, ref, 8);
  133|       |#else
  134|  9.74k|    value2 = ((int64_t*)ref)[0];
  135|  9.74k|#endif
  136|  9.74k|    if (value != value2) {
  ------------------
  |  Branch (136:9): [True: 2.37k, False: 7.36k]
  ------------------
  137|       |      /* Return the byte that starts to differ */
  138|  9.39k|      while (*ref++ == x) ip++;
  ------------------
  |  Branch (138:14): [True: 7.01k, False: 2.37k]
  ------------------
  139|  2.37k|      return ip;
  140|  2.37k|    }
  141|  7.36k|    else {
  142|  7.36k|      ip += 8;
  143|  7.36k|      ref += 8;
  144|  7.36k|    }
  145|  9.74k|  }
  146|       |  /* Look into the remainder */
  147|  2.42k|  while ((ip < ip_bound) && (*ref++ == x)) ip++;
  ------------------
  |  Branch (147:10): [True: 1.93k, False: 493]
  |  Branch (147:29): [True: 1.76k, False: 170]
  ------------------
  148|    663|  return ip;
  149|  3.04k|}
blosclz.c:get_match_16:
  175|  10.0k|static uint8_t *get_match_16(uint8_t *ip, const uint8_t *ip_bound, const uint8_t *ref) {
  176|  10.0k|  __m128i value, value2, cmp;
  177|       |
  178|  14.5k|  while (ip < (ip_bound - sizeof(__m128i))) {
  ------------------
  |  Branch (178:10): [True: 12.7k, False: 1.79k]
  ------------------
  179|  12.7k|    value = _mm_loadu_si128((__m128i *) ip);
  180|  12.7k|    value2 = _mm_loadu_si128((__m128i *) ref);
  181|  12.7k|    cmp = _mm_cmpeq_epi32(value, value2);
  182|  12.7k|    if (_mm_movemask_epi8(cmp) != 0xFFFF) {
  ------------------
  |  Branch (182:9): [True: 8.21k, False: 4.50k]
  ------------------
  183|       |      /* Return the byte that starts to differ */
  184|  28.2k|      while (*ref++ == *ip++) {}
  ------------------
  |  Branch (184:14): [True: 20.0k, False: 8.21k]
  ------------------
  185|  8.21k|      return ip;
  186|  8.21k|    }
  187|  4.50k|    else {
  188|  4.50k|      ip += sizeof(__m128i);
  189|  4.50k|      ref += sizeof(__m128i);
  190|  4.50k|    }
  191|  12.7k|  }
  192|       |  /* Look into the remainder */
  193|  8.96k|  while ((ip < ip_bound) && (*ref++ == *ip++)) {}
  ------------------
  |  Branch (193:10): [True: 8.31k, False: 643]
  |  Branch (193:29): [True: 7.17k, False: 1.14k]
  ------------------
  194|  1.79k|  return ip;
  195|  10.0k|}
blosclz.c:wild_copy_16:
  828|  1.97k|static inline void wild_copy_16(uint8_t *out, const uint8_t *from, uint8_t *end) {
  829|  2.45k|  do { memcpy(out, from, 16); out += 16; from += 16; } while (out < end);
  ------------------
  |  Branch (829:63): [True: 486, False: 1.97k]
  ------------------
  830|  1.97k|}
blosclz.c:wild_copy:
  813|  1.99k|static inline void wild_copy(uint8_t *out, const uint8_t* from, uint8_t* end) {
  814|  1.99k|  uint8_t* d = out;
  815|  1.99k|  const uint8_t* s = from;
  816|  1.99k|  uint8_t* const e = end;
  817|       |
  818|  7.26k|  do { memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  Branch (818:44): [True: 5.26k, False: 1.99k]
  ------------------
  819|  1.99k|}

blosc2.c:ctx_clear_maskout:
  170|  3.18k|static inline void ctx_clear_maskout(blosc2_context *context) {
  171|  3.18k|  free(context->block_maskout);
  172|       |  context->block_maskout = NULL;
  173|  3.18k|  context->block_maskout_nitems = 0;
  174|  3.18k|}
schunk.c:ctx_clear_maskout:
  170|  1.17k|static inline void ctx_clear_maskout(blosc2_context *context) {
  171|  1.17k|  free(context->block_maskout);
  172|       |  context->block_maskout = NULL;
  173|  1.17k|  context->block_maskout_nitems = 0;
  174|  1.17k|}

delta_encoder:
   19|  1.07k|                   const uint8_t* src, uint8_t* dest) {
   20|  1.07k|  int32_t i;
   21|  1.07k|  if (offset == 0) {
  ------------------
  |  Branch (21:7): [True: 74, False: 1.00k]
  ------------------
   22|       |    /* This is the reference block, use delta coding in elements */
   23|     74|    switch (typesize) {
   24|      0|      case 1:
  ------------------
  |  Branch (24:7): [True: 0, False: 74]
  ------------------
   25|      0|        dest[0] = dref[0];
   26|      0|        for (i = 1; i < nbytes; i++) {
  ------------------
  |  Branch (26:21): [True: 0, False: 0]
  ------------------
   27|      0|          dest[i] = src[i] ^ dref[i-1];
   28|      0|        }
   29|      0|        break;
   30|      0|      case 2:
  ------------------
  |  Branch (30:7): [True: 0, False: 74]
  ------------------
   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|      4|      case 4:
  ------------------
  |  Branch (37:7): [True: 4, False: 70]
  ------------------
   38|      4|        ((uint32_t *)dest)[0] = ((uint32_t *)dref)[0];
   39|    256|        for (i = 1; i < nbytes / 4; i++) {
  ------------------
  |  Branch (39:21): [True: 252, False: 4]
  ------------------
   40|    252|          ((uint32_t *)dest)[i] =
   41|    252|                  ((uint32_t *)src)[i] ^ ((uint32_t *)dref)[i-1];
   42|    252|        }
   43|      4|        break;
   44|     70|      case 8:
  ------------------
  |  Branch (44:7): [True: 70, False: 4]
  ------------------
   45|     70|        ((uint64_t *)dest)[0] = ((uint64_t *)dref)[0];
   46|  1.08k|        for (i = 1; i < nbytes / 8; i++) {
  ------------------
  |  Branch (46:21): [True: 1.01k, False: 70]
  ------------------
   47|  1.01k|          ((uint64_t *)dest)[i] =
   48|  1.01k|                  ((uint64_t *)src)[i] ^ ((uint64_t *)dref)[i-1];
   49|  1.01k|        }
   50|     70|        break;
   51|      0|      default:
  ------------------
  |  Branch (51:7): [True: 0, False: 74]
  ------------------
   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|     74|    }
   58|  1.00k|  } else {
   59|       |    /* Use delta coding wrt reference block */
   60|  1.00k|    switch (typesize) {
   61|      0|      case 1:
  ------------------
  |  Branch (61:7): [True: 0, False: 1.00k]
  ------------------
   62|      0|        for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (62:21): [True: 0, False: 0]
  ------------------
   63|      0|          dest[i] = src[i] ^ dref[i];
   64|      0|        }
   65|      0|        break;
   66|      0|      case 2:
  ------------------
  |  Branch (66:7): [True: 0, False: 1.00k]
  ------------------
   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|      0|      case 4:
  ------------------
  |  Branch (72:7): [True: 0, False: 1.00k]
  ------------------
   73|      0|        for (i = 0; i < nbytes / 4; i++) {
  ------------------
  |  Branch (73:21): [True: 0, False: 0]
  ------------------
   74|      0|          ((uint32_t *) dest)[i] =
   75|      0|                  ((uint32_t *) src)[i] ^ ((uint32_t *) dref)[i];
   76|      0|        }
   77|      0|        break;
   78|  1.00k|      case 8:
  ------------------
  |  Branch (78:7): [True: 1.00k, False: 0]
  ------------------
   79|  16.9k|        for (i = 0; i < nbytes / 8; i++) {
  ------------------
  |  Branch (79:21): [True: 15.9k, False: 1.00k]
  ------------------
   80|  15.9k|          ((uint64_t *) dest)[i] =
   81|  15.9k|                  ((uint64_t *) src)[i] ^ ((uint64_t *) dref)[i];
   82|  15.9k|        }
   83|  1.00k|        break;
   84|      0|      default:
  ------------------
  |  Branch (84:7): [True: 0, False: 1.00k]
  ------------------
   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|  1.00k|    }
   91|  1.00k|  }
   92|  1.07k|}
delta_decoder:
   97|  1.68k|                   int32_t typesize, uint8_t* dest) {
   98|  1.68k|  int32_t i;
   99|       |
  100|  1.68k|  if (offset == 0) {
  ------------------
  |  Branch (100:7): [True: 167, False: 1.51k]
  ------------------
  101|       |    /* Decode delta for the reference block */
  102|    167|    switch (typesize) {
  103|      7|      case 1:
  ------------------
  |  Branch (103:7): [True: 7, False: 160]
  ------------------
  104|   161M|        for (i = 1; i < nbytes; i++) {
  ------------------
  |  Branch (104:21): [True: 161M, False: 7]
  ------------------
  105|   161M|          dest[i] ^= dref[i-1];
  106|   161M|        }
  107|      7|        break;
  108|      3|      case 2:
  ------------------
  |  Branch (108:7): [True: 3, False: 164]
  ------------------
  109|  17.8M|        for (i = 1; i < nbytes / 2; i++) {
  ------------------
  |  Branch (109:21): [True: 17.8M, False: 3]
  ------------------
  110|  17.8M|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i-1];
  111|  17.8M|        }
  112|      3|        break;
  113|      9|      case 4:
  ------------------
  |  Branch (113:7): [True: 9, False: 158]
  ------------------
  114|  3.52M|        for (i = 1; i < nbytes / 4; i++) {
  ------------------
  |  Branch (114:21): [True: 3.52M, False: 9]
  ------------------
  115|  3.52M|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i-1];
  116|  3.52M|        }
  117|      9|        break;
  118|    140|      case 8:
  ------------------
  |  Branch (118:7): [True: 140, False: 27]
  ------------------
  119|  6.32M|        for (i = 1; i < nbytes / 8; i++) {
  ------------------
  |  Branch (119:21): [True: 6.32M, False: 140]
  ------------------
  120|  6.32M|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i-1];
  121|  6.32M|        }
  122|    140|        break;
  123|      8|      default:
  ------------------
  |  Branch (123:7): [True: 8, False: 159]
  ------------------
  124|      8|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (124:13): [True: 3, False: 5]
  ------------------
  125|      3|          delta_decoder(dref, offset, nbytes, 8, dest);
  126|      5|        } else {
  127|      5|          delta_decoder(dref, offset, nbytes, 1, dest);
  128|      5|        }
  129|    167|    }
  130|  1.51k|  } else {
  131|       |    /* Decode delta for the non-reference blocks */
  132|  1.51k|    switch (typesize) {
  133|      4|      case 1:
  ------------------
  |  Branch (133:7): [True: 4, False: 1.51k]
  ------------------
  134|   106M|        for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (134:21): [True: 106M, False: 4]
  ------------------
  135|   106M|          dest[i] ^= dref[i];
  136|   106M|        }
  137|      4|        break;
  138|      0|      case 2:
  ------------------
  |  Branch (138:7): [True: 0, False: 1.51k]
  ------------------
  139|      0|        for (i = 0; i < nbytes / 2; i++) {
  ------------------
  |  Branch (139:21): [True: 0, False: 0]
  ------------------
  140|      0|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i];
  141|      0|        }
  142|      0|        break;
  143|      1|      case 4:
  ------------------
  |  Branch (143:7): [True: 1, False: 1.51k]
  ------------------
  144|   671k|        for (i = 0; i < nbytes / 4; i++) {
  ------------------
  |  Branch (144:21): [True: 671k, False: 1]
  ------------------
  145|   671k|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i];
  146|   671k|        }
  147|      1|        break;
  148|  1.50k|      case 8:
  ------------------
  |  Branch (148:7): [True: 1.50k, False: 9]
  ------------------
  149|  25.5k|        for (i = 0; i < nbytes / 8; i++) {
  ------------------
  |  Branch (149:21): [True: 24.0k, False: 1.50k]
  ------------------
  150|  24.0k|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i];
  151|  24.0k|        }
  152|  1.50k|        break;
  153|      4|      default:
  ------------------
  |  Branch (153:7): [True: 4, False: 1.51k]
  ------------------
  154|      4|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (154:13): [True: 0, False: 4]
  ------------------
  155|      0|          delta_decoder(dref, offset, nbytes, 8, dest);
  156|      4|        } else {
  157|      4|          delta_decoder(dref, offset, nbytes, 1, dest);
  158|      4|        }
  159|  1.51k|    }
  160|  1.51k|  }
  161|  1.68k|}

fastcopy:
  504|    206|unsigned char *fastcopy(unsigned char *out, const unsigned char *from, unsigned len) {
  505|    206|  switch (len) {
  506|      0|    case 32:
  ------------------
  |  Branch (506:5): [True: 0, False: 206]
  ------------------
  507|      0|      return copy_32_bytes(out, from);
  508|     20|    case 16:
  ------------------
  |  Branch (508:5): [True: 20, False: 186]
  ------------------
  509|     20|      return copy_16_bytes(out, from);
  510|      0|    case 8:
  ------------------
  |  Branch (510:5): [True: 0, False: 206]
  ------------------
  511|      0|      return copy_8_bytes(out, from);
  512|    186|    default: {
  ------------------
  |  Branch (512:5): [True: 186, False: 20]
  ------------------
  513|    186|    }
  514|    206|  }
  515|    186|  if (len < 8) {
  ------------------
  |  Branch (515:7): [True: 0, False: 186]
  ------------------
  516|      0|    return copy_bytes(out, from, len);
  517|      0|  }
  518|    186|#if defined(__SSE2__)
  519|    186|  if (len < 16) {
  ------------------
  |  Branch (519:7): [True: 58, False: 128]
  ------------------
  520|     58|    return chunk_memcpy(out, from, len);
  521|     58|  }
  522|    128|#if !defined(__AVX2__)
  523|    128|  return chunk_memcpy_unaligned(out, from, len);
  524|       |#else
  525|       |  if (len < 32) {
  526|       |    return chunk_memcpy_16(out, from, len);
  527|       |  }
  528|       |  return chunk_memcpy_unaligned(out, from, len);
  529|       |#endif  // !__AVX2__
  530|       |#else
  531|       |  return chunk_memcpy(out, from, len);
  532|       |#endif  // __SSE2__
  533|    186|}
copy_match:
  537|  1.43k|unsigned char* copy_match(unsigned char *out, const unsigned char *from, unsigned len) {
  538|       |#if defined(__AVX2__)
  539|       |  unsigned sz = sizeof(__m256i);
  540|       |#elif defined(__SSE2__)
  541|       |  unsigned sz = sizeof(__m128i);
  542|       |#else
  543|       |  unsigned sz = sizeof(uint64_t);
  544|       |#endif
  545|       |
  546|       |#if ((defined(__GNUC__) && BLOSC_GCC_VERSION < 800) && !defined(__clang__) && !defined(__ICC) && !defined(__ICL))
  547|       |  // GCC < 8 in fully optimization mode seems to have problems with the code further below so stop here
  548|       |  for (; len > 0; len--) {
  549|       |    *out++ = *from++;
  550|       |  }
  551|       |  return out;
  552|       |#endif
  553|       |
  554|       |  // If out and from are away more than the size of the copy, then a fastcopy is safe
  555|  1.43k|  unsigned overlap_dist = (unsigned) (out - from);
  556|  1.43k|  if (overlap_dist > sz) {
  ------------------
  |  Branch (556:7): [True: 206, False: 1.22k]
  ------------------
  557|    206|    return fastcopy(out, from, len);
  558|    206|  }
  559|       |
  560|       |  // Otherwise we need to be more careful so as not to overwrite destination
  561|  1.22k|  switch (overlap_dist) {
  562|      0|    case 32:
  ------------------
  |  Branch (562:5): [True: 0, False: 1.22k]
  ------------------
  563|      0|      for (; len >= 32; len -= 32) {
  ------------------
  |  Branch (563:14): [True: 0, False: 0]
  ------------------
  564|      0|        out = copy_32_bytes(out, from);
  565|      0|      }
  566|      0|      break;
  567|      0|    case 30:
  ------------------
  |  Branch (567:5): [True: 0, False: 1.22k]
  ------------------
  568|      0|      for (; len >= 30; len -= 30) {
  ------------------
  |  Branch (568:14): [True: 0, False: 0]
  ------------------
  569|      0|        out = copy_16_bytes(out, from);
  570|      0|        out = copy_8_bytes(out, from + 16);
  571|      0|        out = copy_4_bytes(out, from + 24);
  572|      0|        out = copy_2_bytes(out, from + 28);
  573|      0|      }
  574|      0|      break;
  575|      0|    case 28:
  ------------------
  |  Branch (575:5): [True: 0, False: 1.22k]
  ------------------
  576|      0|      for (; len >= 28; len -= 28) {
  ------------------
  |  Branch (576:14): [True: 0, False: 0]
  ------------------
  577|      0|        out = copy_16_bytes(out, from);
  578|      0|        out = copy_8_bytes(out, from + 16);
  579|      0|        out = copy_4_bytes(out, from + 24);
  580|      0|      }
  581|      0|      break;
  582|      0|    case 26:
  ------------------
  |  Branch (582:5): [True: 0, False: 1.22k]
  ------------------
  583|      0|      for (; len >= 26; len -= 26) {
  ------------------
  |  Branch (583:14): [True: 0, False: 0]
  ------------------
  584|      0|        out = copy_16_bytes(out, from);
  585|      0|        out = copy_8_bytes(out, from + 16);
  586|      0|        out = copy_2_bytes(out, from + 24);
  587|      0|      }
  588|      0|      break;
  589|      0|    case 24:
  ------------------
  |  Branch (589:5): [True: 0, False: 1.22k]
  ------------------
  590|      0|      for (; len >= 24; len -= 24) {
  ------------------
  |  Branch (590:14): [True: 0, False: 0]
  ------------------
  591|      0|        out = copy_16_bytes(out, from);
  592|      0|        out = copy_8_bytes(out, from + 16);
  593|      0|      }
  594|      0|      break;
  595|      0|    case 22:
  ------------------
  |  Branch (595:5): [True: 0, False: 1.22k]
  ------------------
  596|      0|      for (; len >= 22; len -= 22) {
  ------------------
  |  Branch (596:14): [True: 0, False: 0]
  ------------------
  597|      0|        out = copy_16_bytes(out, from);
  598|      0|        out = copy_4_bytes(out, from + 16);
  599|      0|        out = copy_2_bytes(out, from + 20);
  600|      0|      }
  601|      0|      break;
  602|      0|    case 20:
  ------------------
  |  Branch (602:5): [True: 0, False: 1.22k]
  ------------------
  603|      0|      for (; len >= 20; len -= 20) {
  ------------------
  |  Branch (603:14): [True: 0, False: 0]
  ------------------
  604|      0|        out = copy_16_bytes(out, from);
  605|      0|        out = copy_4_bytes(out, from + 16);
  606|      0|      }
  607|      0|      break;
  608|      0|    case 18:
  ------------------
  |  Branch (608:5): [True: 0, False: 1.22k]
  ------------------
  609|      0|      for (; len >= 18; len -= 18) {
  ------------------
  |  Branch (609:14): [True: 0, False: 0]
  ------------------
  610|      0|        out = copy_16_bytes(out, from);
  611|      0|        out = copy_2_bytes(out, from + 16);
  612|      0|      }
  613|      0|      break;
  614|    128|    case 16:
  ------------------
  |  Branch (614:5): [True: 128, False: 1.09k]
  ------------------
  615|    896|      for (; len >= 16; len -= 16) {
  ------------------
  |  Branch (615:14): [True: 768, False: 128]
  ------------------
  616|    768|        out = copy_16_bytes(out, from);
  617|    768|      }
  618|    128|      break;
  619|    203|    case 8:
  ------------------
  |  Branch (619:5): [True: 203, False: 1.02k]
  ------------------
  620|  2.98k|      for (; len >= 8; len -= 8) {
  ------------------
  |  Branch (620:14): [True: 2.78k, False: 203]
  ------------------
  621|  2.78k|        out = copy_8_bytes(out, from);
  622|  2.78k|      }
  623|    203|      break;
  624|    447|    case 4:
  ------------------
  |  Branch (624:5): [True: 447, False: 780]
  ------------------
  625|  5.29k|      for (; len >= 4; len -= 4) {
  ------------------
  |  Branch (625:14): [True: 4.84k, False: 447]
  ------------------
  626|  4.84k|        out = copy_4_bytes(out, from);
  627|  4.84k|      }
  628|    447|      break;
  629|     70|    case 2:
  ------------------
  |  Branch (629:5): [True: 70, False: 1.15k]
  ------------------
  630|    376|      for (; len >= 2; len -= 2) {
  ------------------
  |  Branch (630:14): [True: 306, False: 70]
  ------------------
  631|    306|        out = copy_2_bytes(out, from);
  632|    306|      }
  633|     70|      break;
  634|    379|    default:
  ------------------
  |  Branch (634:5): [True: 379, False: 848]
  ------------------
  635|  23.8k|      for (; len > 0; len--) {
  ------------------
  |  Branch (635:14): [True: 23.4k, False: 379]
  ------------------
  636|  23.4k|        *out++ = *from++;
  637|  23.4k|      }
  638|  1.22k|  }
  639|       |
  640|       |  // Copy the leftovers
  641|  4.61k|  for (; len > 0; len--) {
  ------------------
  |  Branch (641:10): [True: 3.38k, False: 1.22k]
  ------------------
  642|  3.38k|    *out++ = *from++;
  643|  3.38k|  }
  644|       |
  645|  1.22k|  return out;
  646|  1.22k|}
fastcopy.c:copy_16_bytes:
   98|  1.11k|static inline unsigned char *copy_16_bytes(unsigned char *out, const unsigned char *from) {
   99|  1.11k|#if defined(__SSE2__)
  100|  1.11k|  __m128i chunk;
  101|  1.11k|  chunk = _mm_loadu_si128((__m128i*)from);
  102|  1.11k|  _mm_storeu_si128((__m128i*)out, chunk);
  103|  1.11k|  out += 16;
  104|       |#elif !defined(BLOSC_STRICT_ALIGN)
  105|       |  *(uint64_t*)out = *(uint64_t*)from;
  106|       |   from += 8; out += 8;
  107|       |   *(uint64_t*)out = *(uint64_t*)from;
  108|       |   from += 8; out += 8;
  109|       |#else
  110|       |   int i;
  111|       |   for (i = 0; i < 16; i++) {
  112|       |     *out++ = *from++;
  113|       |   }
  114|       |#endif
  115|  1.11k|  return out;
  116|  1.11k|}
fastcopy.c:copy_8_bytes:
   86|  2.89k|static inline unsigned char *copy_8_bytes(unsigned char *out, const unsigned char *from) {
   87|       |#if defined(BLOSC_STRICT_ALIGN)
   88|       |  uint64_t chunk;
   89|       |  memcpy(&chunk, from, 8);
   90|       |  memcpy(out, &chunk, 8);
   91|       |#else
   92|  2.89k|  *(uint64_t *) out = *(uint64_t *) from;
   93|  2.89k|#endif
   94|  2.89k|  return out + 8;
   95|  2.89k|}
fastcopy.c:chunk_memcpy:
  200|     58|static inline unsigned char *chunk_memcpy(unsigned char *out, const unsigned char *from, unsigned len) {
  201|     58|  unsigned sz = sizeof(uint64_t);
  202|     58|  unsigned rem = len % sz;
  203|     58|  unsigned by8;
  204|       |
  205|     58|  assert(len >= sz);
  206|       |
  207|       |  /* Copy a few bytes to make sure the loop below has a multiple of SZ bytes to be copied. */
  208|     58|  copy_8_bytes(out, from);
  209|       |
  210|     58|  len /= sz;
  211|     58|  out += rem;
  212|     58|  from += rem;
  213|       |
  214|     58|  by8 = len % 8;
  215|     58|  len -= by8;
  216|     58|  switch (by8) {
  217|      0|    case 7:
  ------------------
  |  Branch (217:5): [True: 0, False: 58]
  ------------------
  218|      0|      out = copy_8_bytes(out, from);
  219|      0|      from += sz;
  220|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  221|       |      __attribute__ ((fallthrough));  // Shut-up -Wimplicit-fallthrough warning in GCC
  222|       |      #endif
  223|      0|    case 6:
  ------------------
  |  Branch (223:5): [True: 0, False: 58]
  ------------------
  224|      0|      out = copy_8_bytes(out, from);
  225|      0|      from += sz;
  226|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  227|       |      __attribute__ ((fallthrough));
  228|       |      #endif
  229|      0|    case 5:
  ------------------
  |  Branch (229:5): [True: 0, False: 58]
  ------------------
  230|      0|      out = copy_8_bytes(out, from);
  231|      0|      from += sz;
  232|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  233|       |      __attribute__ ((fallthrough));
  234|       |      #endif
  235|      0|    case 4:
  ------------------
  |  Branch (235:5): [True: 0, False: 58]
  ------------------
  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 3:
  ------------------
  |  Branch (241:5): [True: 0, False: 58]
  ------------------
  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 2:
  ------------------
  |  Branch (247:5): [True: 0, False: 58]
  ------------------
  248|      0|      out = copy_8_bytes(out, from);
  249|      0|      from += sz;
  250|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  251|       |      __attribute__ ((fallthrough));
  252|       |      #endif
  253|     58|    case 1:
  ------------------
  |  Branch (253:5): [True: 58, False: 0]
  ------------------
  254|     58|      out = copy_8_bytes(out, from);
  255|     58|      from += sz;
  256|       |      #ifdef AVOID_FALLTHROUGH_WARNING
  257|       |      __attribute__ ((fallthrough));
  258|       |      #endif
  259|     58|    default:
  ------------------
  |  Branch (259:5): [True: 0, False: 58]
  ------------------
  260|     58|      break;
  261|     58|  }
  262|       |
  263|     58|  while (len) {
  ------------------
  |  Branch (263:10): [True: 0, False: 58]
  ------------------
  264|      0|    out = copy_8_bytes(out, from);
  265|      0|    from += sz;
  266|      0|    out = copy_8_bytes(out, from);
  267|      0|    from += sz;
  268|      0|    out = copy_8_bytes(out, from);
  269|      0|    from += sz;
  270|      0|    out = copy_8_bytes(out, from);
  271|      0|    from += sz;
  272|      0|    out = copy_8_bytes(out, from);
  273|      0|    from += sz;
  274|      0|    out = copy_8_bytes(out, from);
  275|      0|    from += sz;
  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|       |
  281|      0|    len -= 8;
  282|      0|  }
  283|       |
  284|     58|  return out;
  285|     58|}
fastcopy.c:chunk_memcpy_unaligned:
  410|    128|static inline unsigned char *chunk_memcpy_unaligned(unsigned char *out, const unsigned char *from, unsigned len) {
  411|       |#if defined(__AVX2__)
  412|       |  unsigned sz = sizeof(__m256i);
  413|       |#elif defined(__SSE2__)
  414|       |  unsigned sz = sizeof(__m128i);
  415|    128|#endif
  416|    128|  unsigned rem = len % sz;
  417|    128|  unsigned ilen;
  418|       |
  419|    128|  assert(len >= sz);
  420|       |
  421|       |  /* Copy a few bytes to make sure the loop below has a multiple of SZ bytes to be copied. */
  422|       |#if defined(__AVX2__)
  423|       |  copy_32_bytes(out, from);
  424|       |#elif defined(__SSE2__)
  425|       |  copy_16_bytes(out, from);
  426|    128|#endif
  427|       |
  428|    128|  len /= sz;
  429|    128|  out += rem;
  430|    128|  from += rem;
  431|       |
  432|    330|  for (ilen = 0; ilen < len; ilen++) {
  ------------------
  |  Branch (432:18): [True: 202, False: 128]
  ------------------
  433|       |#if defined(__AVX2__)
  434|       |    copy_32_bytes(out, from);
  435|       |#elif defined(__SSE2__)
  436|       |    copy_16_bytes(out, from);
  437|    202|#endif
  438|    202|    out += sz;
  439|    202|    from += sz;
  440|    202|  }
  441|       |
  442|    128|  return out;
  443|    128|}
fastcopy.c:copy_4_bytes:
   48|  4.84k|static inline unsigned char *copy_4_bytes(unsigned char *out, const unsigned char *from) {
   49|       |#if defined(BLOSC_STRICT_ALIGN)
   50|       |  uint32_t chunk;
   51|       |  memcpy(&chunk, from, 4);
   52|       |  memcpy(out, &chunk, 4);
   53|       |#else
   54|  4.84k|  *(uint32_t *) out = *(uint32_t *) from;
   55|  4.84k|#endif
   56|  4.84k|  return out + 4;
   57|  4.84k|}
fastcopy.c:copy_2_bytes:
   37|    306|static inline unsigned char *copy_2_bytes(unsigned char *out, const unsigned char *from) {
   38|       |#if defined(BLOSC_STRICT_ALIGN)
   39|       |  uint16_t chunk;
   40|       |  memcpy(&chunk, from, 2);
   41|       |  memcpy(out, &chunk, 2);
   42|       |#else
   43|    306|  *(uint16_t *) out = *(uint16_t *) from;
   44|    306|#endif
   45|    306|  return out + 2;
   46|    306|}

frame_reader_invalidate:
  439|    322|void frame_reader_invalidate(blosc2_frame_s* frame) {
  440|    322|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|    322|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  441|    322|  frame_writer_close_locked(frame);
  442|    322|  frame_reader_close_locked(frame, true);
  443|    322|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|    322|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  444|    322|}
frame_new:
  619|     87|blosc2_frame_s* frame_new(const char* urlpath) {
  620|     87|  blosc2_frame_s* new_frame = frame_alloc();
  621|     87|  if (new_frame == NULL) {
  ------------------
  |  Branch (621:7): [True: 0, False: 87]
  ------------------
  622|      0|    return NULL;
  623|      0|  }
  624|     87|  if (urlpath != NULL) {
  ------------------
  |  Branch (624:7): [True: 0, False: 87]
  ------------------
  625|      0|    char* new_urlpath = malloc(strlen(urlpath) + 1);  // + 1 for the trailing NULL
  626|      0|    if (new_urlpath == NULL) {
  ------------------
  |  Branch (626:9): [True: 0, False: 0]
  ------------------
  627|      0|      blosc2_pthread_mutex_destroy(&new_frame->read_fp_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
  628|      0|      free(new_frame);
  629|      0|      return NULL;
  630|      0|    }
  631|      0|    new_frame->urlpath = strcpy(new_urlpath, urlpath);
  632|      0|    new_frame->file_offset = 0;
  633|      0|  }
  634|     87|  return new_frame;
  635|     87|}
frame_set_locking:
  656|     87|void frame_set_locking(blosc2_frame_s* frame, const blosc2_io* io) {
  657|     87|  if (frame->urlpath == NULL) {
  ------------------
  |  Branch (657:7): [True: 87, False: 0]
  ------------------
  658|     87|    return;
  659|     87|  }
  660|      0|  if (frame_locking_requested(io)) {
  ------------------
  |  Branch (660:7): [True: 0, False: 0]
  ------------------
  661|       |    frame->locking = true;
  662|      0|    frame->lock_fd = -1;
  663|      0|  }
  664|      0|}
frame_lock:
  775|  2.24k|int frame_lock(blosc2_frame_s* frame, bool exclusive) {
  776|  2.24k|  if (frame == NULL || !frame->locking) {
  ------------------
  |  Branch (776:7): [True: 0, False: 2.24k]
  |  Branch (776:24): [True: 2.24k, False: 0]
  ------------------
  777|  2.24k|    return BLOSC2_ERROR_SUCCESS;
  778|  2.24k|  }
  779|      0|  if (frame->lock_depth > 0) {
  ------------------
  |  Branch (779:7): [True: 0, False: 0]
  ------------------
  780|       |    // Already held by this handle (a nested call); the outer lock covers us
  781|      0|    frame->lock_depth++;
  782|      0|    return BLOSC2_ERROR_SUCCESS;
  783|      0|  }
  784|      0|  if (frame->lock_fd == -1) {
  ------------------
  |  Branch (784:7): [True: 0, False: 0]
  ------------------
  785|       |    // Lazily open the sidecar, kept for the frame's lifetime
  786|      0|    char* path = frame_lock_path(frame);
  787|      0|    if (path == NULL) {
  ------------------
  |  Branch (787:9): [True: 0, False: 0]
  ------------------
  788|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
  789|      0|    }
  790|       |#if defined(_WIN32)
  791|       |    HANDLE h = CreateFileA(path, GENERIC_READ | GENERIC_WRITE,
  792|       |                           FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
  793|       |                           NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
  794|       |    if (h == INVALID_HANDLE_VALUE) {
  795|       |      BLOSC_TRACE_ERROR("Cannot open the lock file in: %s", path);
  796|       |      free(path);
  797|       |      return BLOSC2_ERROR_LOCK;
  798|       |    }
  799|       |    frame->lock_fd = (intptr_t)h;
  800|       |#else
  801|      0|    int fd = open(path, O_CREAT | O_RDWR | O_CLOEXEC, 0666);
  802|      0|    if (fd < 0) {
  ------------------
  |  Branch (802:9): [True: 0, False: 0]
  ------------------
  803|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  804|      0|      free(path);
  805|      0|      return BLOSC2_ERROR_LOCK;
  806|      0|    }
  807|      0|    frame->lock_fd = fd;
  808|      0|#endif
  809|      0|    free(path);
  810|      0|  }
  811|      0|  if (frame_os_lock(frame, exclusive) < 0) {
  ------------------
  |  Branch (811:7): [True: 0, False: 0]
  ------------------
  812|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  813|      0|    return BLOSC2_ERROR_LOCK;
  814|      0|  }
  815|       |  // Generation counter: writers bump it, everyone compares it with the last
  816|       |  // value it saw.  This detects mutations by other handles exactly, even when
  817|       |  // the frame length on disk ends up unchanged (which the length-based
  818|       |  // staleness check in frame_refresh_if_stale() cannot see).
  819|      0|  uint64_t seq;
  820|      0|  if (frame_lock_read_seq(frame, &seq) < 0 ||
  ------------------
  |  Branch (820:7): [True: 0, False: 0]
  ------------------
  821|      0|      (exclusive && frame_lock_write_seq(frame, seq + 1) < 0)) {
  ------------------
  |  Branch (821:8): [True: 0, False: 0]
  |  Branch (821:21): [True: 0, False: 0]
  ------------------
  822|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  823|      0|    frame_os_unlock(frame);
  824|      0|    return BLOSC2_ERROR_LOCK;
  825|      0|  }
  826|      0|  if (seq != frame->lock_seq) {
  ------------------
  |  Branch (826:7): [True: 0, False: 0]
  ------------------
  827|      0|    frame->force_refresh = true;
  828|      0|  }
  829|      0|  if (exclusive) {
  ------------------
  |  Branch (829:7): [True: 0, False: 0]
  ------------------
  830|      0|    seq++;
  831|      0|  }
  832|      0|  frame->lock_seq = seq;
  833|      0|  frame->lock_depth = 1;
  834|      0|  return BLOSC2_ERROR_SUCCESS;
  835|      0|}
frame_unlock:
  838|  2.24k|int frame_unlock(blosc2_frame_s* frame) {
  839|  2.24k|  if (frame == NULL || !frame->locking || frame->lock_depth == 0) {
  ------------------
  |  Branch (839:7): [True: 0, False: 2.24k]
  |  Branch (839:24): [True: 2.24k, False: 0]
  |  Branch (839:43): [True: 0, False: 0]
  ------------------
  840|  2.24k|    return BLOSC2_ERROR_SUCCESS;
  841|  2.24k|  }
  842|      0|  if (--frame->lock_depth > 0) {
  ------------------
  |  Branch (842:7): [True: 0, False: 0]
  ------------------
  843|      0|    return BLOSC2_ERROR_SUCCESS;
  844|      0|  }
  845|       |  // Hand our writes over before the next lock holder looks: closing the cached
  846|       |  // writer is what pushes them to the server on NFS (close-to-open consistency).
  847|       |  // A no-op unless this handle wrote since it last let go of the lock.
  848|      0|  frame_writer_close(frame);
  849|      0|  if (frame_os_unlock(frame) < 0) {
  ------------------
  |  Branch (849:7): [True: 0, False: 0]
  ------------------
  850|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  851|      0|    return BLOSC2_ERROR_LOCK;
  852|      0|  }
  853|      0|  return BLOSC2_ERROR_SUCCESS;
  854|      0|}
frame_free:
  858|    322|int frame_free(blosc2_frame_s* frame) {
  859|       |
  860|    322|  frame_reader_invalidate(frame);
  861|    322|  blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|    322|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
  862|       |
  863|    322|  if (frame->locking && frame->lock_fd != -1) {
  ------------------
  |  Branch (863:7): [True: 0, False: 322]
  |  Branch (863:25): [True: 0, False: 0]
  ------------------
  864|       |#if defined(_WIN32)
  865|       |    CloseHandle((HANDLE)frame->lock_fd);
  866|       |#else
  867|      0|    close((int)frame->lock_fd);
  868|      0|#endif
  869|      0|  }
  870|       |
  871|    322|  if (frame->cframe != NULL && !frame->avoid_cframe_free) {
  ------------------
  |  Branch (871:7): [True: 322, False: 0]
  |  Branch (871:32): [True: 87, False: 235]
  ------------------
  872|     87|    free(frame->cframe);
  873|     87|  }
  874|       |
  875|    322|  if (frame->coffsets != NULL && frame->coffsets_needs_free) {
  ------------------
  |  Branch (875:7): [True: 0, False: 322]
  |  Branch (875:34): [True: 0, False: 0]
  ------------------
  876|      0|    free(frame->coffsets);
  877|      0|  }
  878|       |
  879|    322|  if (frame->urlpath != NULL) {
  ------------------
  |  Branch (879:7): [True: 0, False: 322]
  ------------------
  880|      0|    free(frame->urlpath);
  881|      0|  }
  882|    322|  free(frame->holes);
  883|       |
  884|    322|  free(frame);
  885|       |
  886|    322|  return 0;
  887|    322|}
new_header_frame:
  890|    865|void *new_header_frame(blosc2_schunk *schunk, blosc2_frame_s *frame) {
  891|    865|  if (frame == NULL) {
  ------------------
  |  Branch (891:7): [True: 0, False: 865]
  ------------------
  892|      0|    return NULL;
  893|      0|  }
  894|    865|  uint8_t* h2 = calloc(FRAME_HEADER_MINLEN, 1);
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  895|    865|  uint8_t* h2p = h2;
  896|       |
  897|       |  // The msgpack header starts here
  898|    865|  *h2p = 0x90;  // fixarray...
  899|    865|  *h2p += 14;   // ...with 13 elements
  900|    865|  h2p += 1;
  901|       |
  902|       |  // Magic number
  903|    865|  *h2p = 0xa0 + 8;  // str with 8 elements
  904|    865|  h2p += 1;
  905|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (905:7): [True: 0, False: 865]
  ------------------
  906|      0|    return NULL;
  907|      0|  }
  908|    865|  strcpy((char*)h2p, "b2frame");
  909|    865|  h2p += 8;
  910|       |
  911|       |  // Header size
  912|    865|  *h2p = 0xd2;  // int32
  913|    865|  h2p += 1 + 4;
  914|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (914:7): [True: 0, False: 865]
  ------------------
  915|      0|    return NULL;
  916|      0|  }
  917|       |
  918|       |  // Total frame size
  919|    865|  *h2p = 0xcf;  // uint64
  920|       |  // Fill it with frame->len which is known *after* the creation of the frame (e.g. when updating the header)
  921|    865|  int64_t flen = frame->len;
  922|    865|  to_big(h2 + FRAME_LEN, &flen, sizeof(flen));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
  923|    865|  h2p += 1 + 8;
  924|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (924:7): [True: 0, False: 865]
  ------------------
  925|      0|    return NULL;
  926|      0|  }
  927|       |
  928|       |  // Flags
  929|    865|  *h2p = 0xa0 + 4;  // str with 4 elements
  930|    865|  h2p += 1;
  931|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (931:7): [True: 0, False: 865]
  ------------------
  932|      0|    return NULL;
  933|      0|  }
  934|       |  // General flags
  935|    865|  if (schunk->chunksize == 0 || (schunk->flags2 & BLOSC2_VL_BLOCKS)) {
  ------------------
  |  Branch (935:7): [True: 0, False: 865]
  |  Branch (935:33): [True: 0, False: 865]
  ------------------
  936|      0|    *h2p = BLOSC2_VERSION_FRAME_FORMAT_VL_BLOCKS;  // version
  937|      0|  }
  938|    865|  else {
  939|    865|    *h2p = BLOSC2_VERSION_FRAME_FORMAT_RC1;  // version
  940|    865|  }
  941|    865|  *h2p += 0x10;  // 64-bit offsets.  We only support this for now.
  942|    865|  if (schunk->chunksize == 0) {
  ------------------
  |  Branch (942:7): [True: 0, False: 865]
  ------------------
  943|      0|    *h2p |= FRAME_VARIABLE_CHUNKS;
  ------------------
  |  |   26|      0|#define FRAME_VARIABLE_CHUNKS (1U << 6)
  ------------------
  944|      0|  }
  945|    865|  if (schunk->flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (945:7): [True: 0, False: 865]
  ------------------
  946|      0|    *h2p |= FRAME_VL_BLOCKS;
  ------------------
  |  |   27|      0|#define FRAME_VL_BLOCKS (1U << 7)
  ------------------
  947|      0|  }
  948|    865|  h2p += 1;
  949|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (949:7): [True: 0, False: 865]
  ------------------
  950|      0|    return NULL;
  951|      0|  }
  952|       |
  953|       |  // Frame type
  954|       |  // We only support contiguous and sparse directories frames currently
  955|    865|  *h2p = frame->sframe ? 1 : 0;
  ------------------
  |  Branch (955:10): [True: 0, False: 865]
  ------------------
  956|    865|  h2p += 1;
  957|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (957:7): [True: 0, False: 865]
  ------------------
  958|      0|    return NULL;
  959|      0|  }
  960|       |
  961|       |  // Codec flags
  962|    865|  *h2p = schunk->compcode;
  963|    865|  if (schunk->compcode >= BLOSC_LAST_CODEC) {
  ------------------
  |  Branch (963:7): [True: 259, False: 606]
  ------------------
  964|    259|    *h2p = BLOSC_UDCODEC_FORMAT;
  965|    259|  }
  966|    865|  *h2p += (schunk->clevel) << 4u;  // clevel
  967|    865|  h2p += 1;
  968|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (968:7): [True: 0, False: 865]
  ------------------
  969|      0|    return NULL;
  970|      0|  }
  971|       |
  972|       |  // Other flags
  973|    865|  *h2p = schunk->splitmode - 1;
  974|    865|  h2p += 1;
  975|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (975:7): [True: 0, False: 865]
  ------------------
  976|      0|    return NULL;
  977|      0|  }
  978|       |
  979|       |  // Uncompressed size
  980|    865|  *h2p = 0xd3;  // int64
  981|    865|  h2p += 1;
  982|    865|  int64_t nbytes = schunk->nbytes;
  983|    865|  to_big(h2p, &nbytes, sizeof(nbytes));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
  984|    865|  h2p += 8;
  985|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (985:7): [True: 0, False: 865]
  ------------------
  986|      0|    return NULL;
  987|      0|  }
  988|       |
  989|       |  // Compressed size
  990|    865|  *h2p = 0xd3;  // int64
  991|    865|  h2p += 1;
  992|    865|  int64_t cbytes = schunk->cbytes;
  993|    865|  to_big(h2p, &cbytes, sizeof(cbytes));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
  994|    865|  h2p += 8;
  995|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (995:7): [True: 0, False: 865]
  ------------------
  996|      0|    return NULL;
  997|      0|  }
  998|       |
  999|       |  // Type size
 1000|    865|  *h2p = 0xd2;  // int32
 1001|    865|  h2p += 1;
 1002|    865|  int32_t typesize = schunk->typesize;
 1003|    865|  to_big(h2p, &typesize, sizeof(typesize));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1004|    865|  h2p += 4;
 1005|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1005:7): [True: 0, False: 865]
  ------------------
 1006|      0|    return NULL;
 1007|      0|  }
 1008|       |
 1009|       |  // Block size
 1010|    865|  *h2p = 0xd2;  // int32
 1011|    865|  h2p += 1;
 1012|    865|  int32_t blocksize = schunk->blocksize;
 1013|    865|  to_big(h2p, &blocksize, sizeof(blocksize));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1014|    865|  h2p += 4;
 1015|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1015:7): [True: 0, False: 865]
  ------------------
 1016|      0|    return NULL;
 1017|      0|  }
 1018|       |
 1019|       |  // Chunk size
 1020|    865|  *h2p = 0xd2;  // int32
 1021|    865|  h2p += 1;
 1022|    865|  int32_t chunksize = schunk->chunksize;
 1023|    865|  to_big(h2p, &chunksize, sizeof(chunksize));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1024|    865|  h2p += 4;
 1025|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1025:7): [True: 0, False: 865]
  ------------------
 1026|      0|    return NULL;
 1027|      0|  }
 1028|       |
 1029|       |  // Number of threads for compression
 1030|    865|  *h2p = 0xd1;  // int16
 1031|    865|  h2p += 1;
 1032|    865|  int16_t nthreads = (int16_t)schunk->cctx->nthreads;
 1033|    865|  to_big(h2p, &nthreads, sizeof(nthreads));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1034|    865|  h2p += 2;
 1035|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1035:7): [True: 0, False: 865]
  ------------------
 1036|      0|    return NULL;
 1037|      0|  }
 1038|       |
 1039|       |  // Number of threads for decompression
 1040|    865|  *h2p = 0xd1;  // int16
 1041|    865|  h2p += 1;
 1042|    865|  nthreads = (int16_t)schunk->dctx->nthreads;
 1043|    865|  to_big(h2p, &nthreads, sizeof(nthreads));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1044|    865|  h2p += 2;
 1045|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1045:7): [True: 0, False: 865]
  ------------------
 1046|      0|    return NULL;
 1047|      0|  }
 1048|       |
 1049|       |  // The boolean for variable-length metalayers
 1050|    865|  *h2p = (schunk->nvlmetalayers > 0) ? (uint8_t)0xc3 : (uint8_t)0xc2;
  ------------------
  |  Branch (1050:10): [True: 0, False: 865]
  ------------------
 1051|    865|  h2p += 1;
 1052|    865|  if (h2p - h2 >= FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1052:7): [True: 0, False: 865]
  ------------------
 1053|      0|    return NULL;
 1054|      0|  }
 1055|       |
 1056|       |  // The space for FRAME_FILTER_PIPELINE
 1057|    865|  *h2p = 0xd8;  //  fixext 16
 1058|    865|  h2p += 1;
 1059|    865|  if (BLOSC2_MAX_FILTERS > FRAME_FILTER_PIPELINE_MAX) {
  ------------------
  |  |   53|    865|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
  |  Branch (1059:7): [Folded, False: 865]
  ------------------
 1060|      0|    return NULL;
 1061|      0|  }
 1062|       |  // Store the filter pipeline in header
 1063|    865|  uint8_t* mp_filters = h2 + FRAME_FILTER_PIPELINE + 1;
  ------------------
  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1064|    865|  uint8_t* mp_meta = h2 + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                uint8_t* mp_meta = h2 + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   53|    865|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
 1065|  6.05k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (1065:19): [True: 5.19k, False: 865]
  ------------------
 1066|  5.19k|      mp_filters[i] = schunk->filters[i];
 1067|  5.19k|      mp_meta[i] = schunk->filters_meta[i];
 1068|  5.19k|  }
 1069|    865|  *h2p = (uint8_t) BLOSC2_MAX_FILTERS;
 1070|    865|  h2p += 1;
 1071|    865|  h2p += 16;
 1072|       |
 1073|       |  // User-defined codec and codec metadata
 1074|    865|  uint8_t* udcodec = h2 + FRAME_UDCODEC;
  ------------------
  |  |   45|    865|#define FRAME_UDCODEC (FRAME_FILTER_PIPELINE + 1 + 6) // 77
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1075|    865|  *udcodec = schunk->compcode;
 1076|    865|  uint8_t* codec_meta = h2 + FRAME_CODEC_META;
  ------------------
  |  |   46|    865|#define FRAME_CODEC_META (FRAME_FILTER_PIPELINE + 1 + 7) // 78
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1077|    865|  *codec_meta = schunk->compcode_meta;
 1078|       |
 1079|       |  // Other flags 2 (byte 0x55): bit 0 = use_dict
 1080|    865|  h2[FRAME_OTHER_FLAGS2] = schunk->use_dict ? FRAME_USE_DICT : 0;
  ------------------
  |  |   47|    865|#define FRAME_OTHER_FLAGS2 (FRAME_FILTER_PIPELINE + 1 + 14)  // 85
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#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 (1080:28): [True: 0, False: 865]
  ------------------
 1081|       |
 1082|    865|  if (h2p - h2 != FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1082:7): [True: 0, False: 865]
  ------------------
 1083|      0|    return NULL;
 1084|      0|  }
 1085|       |
 1086|    865|  int32_t hsize = FRAME_HEADER_MINLEN;
  ------------------
  |  |   49|    865|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    865|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    865|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    865|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    865|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    865|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    865|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    865|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    865|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    865|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    865|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    865|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    865|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    865|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1087|       |
 1088|       |  // Now, deal with metalayers
 1089|    865|  uint16_t nmetalayers = schunk->nmetalayers;
 1090|    865|  if (nmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1895|    865|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (1090:7): [True: 0, False: 865]
  ------------------
 1091|      0|    return NULL;
 1092|      0|  }
 1093|       |
 1094|       |  // Make space for the header of metalayers (array marker, size, map of offsets)
 1095|    865|  h2 = realloc(h2, (size_t)hsize + 1 + 1 + 2 + 1 + 2);
 1096|    865|  h2p = h2 + hsize;
 1097|       |
 1098|       |  // The msgpack header for the metalayers (array_marker, size, map of offsets, list of metalayers)
 1099|    865|  *h2p = 0x90 + 3;  // array with 3 elements
 1100|    865|  h2p += 1;
 1101|       |
 1102|       |  // Size for the map (index) of offsets, including this uint16 size (to be filled out later on)
 1103|    865|  *h2p = 0xcd;  // uint16
 1104|    865|  h2p += 1 + 2;
 1105|       |
 1106|       |  // Map (index) of offsets for optional metalayers
 1107|    865|  *h2p = 0xde;  // map 16 with N keys
 1108|    865|  h2p += 1;
 1109|    865|  to_big(h2p, &nmetalayers, sizeof(nmetalayers));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1110|    865|  h2p += sizeof(nmetalayers);
 1111|    865|  int32_t current_header_len = (int32_t)(h2p - h2);
 1112|    865|  int32_t *offtooff = malloc(nmetalayers * sizeof(int32_t));
 1113|    865|  if (offtooff == NULL) {
  ------------------
  |  Branch (1113:7): [True: 0, False: 865]
  ------------------
 1114|      0|    free(h2);
 1115|      0|    return NULL;
 1116|      0|  }
 1117|  1.64k|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (1117:28): [True: 778, False: 865]
  ------------------
 1118|    778|    if (frame == NULL) {
  ------------------
  |  Branch (1118:9): [True: 0, False: 778]
  ------------------
 1119|      0|      free(offtooff);
 1120|      0|      free(h2);
 1121|      0|      return NULL;
 1122|      0|    }
 1123|    778|    blosc2_metalayer *metalayer = schunk->metalayers[nmetalayer];
 1124|    778|    uint8_t namelen = (uint8_t) strlen(metalayer->name);
 1125|    778|    h2 = realloc(h2, (size_t)current_header_len + 1 + namelen + 1 + 4);
 1126|    778|    h2p = h2 + current_header_len;
 1127|       |    // Store the metalayer
 1128|    778|    if (namelen >= (1U << 5U)) {  // metalayer strings cannot be longer than 32 bytes
  ------------------
  |  Branch (1128:9): [True: 0, False: 778]
  ------------------
 1129|      0|      free(offtooff);
 1130|      0|      free(h2);
 1131|      0|      return NULL;
 1132|      0|    }
 1133|    778|    *h2p = (uint8_t)0xa0 + namelen;  // str
 1134|    778|    h2p += 1;
 1135|    778|    memcpy(h2p, metalayer->name, namelen);
 1136|    778|    h2p += namelen;
 1137|       |    // Space for storing the offset for the value of this metalayer
 1138|    778|    *h2p = 0xd2;  // int32
 1139|    778|    h2p += 1;
 1140|    778|    offtooff[nmetalayer] = (int32_t)(h2p - h2);
 1141|    778|    h2p += 4;
 1142|    778|    current_header_len += 1 + namelen + 1 + 4;
 1143|    778|  }
 1144|    865|  int32_t hsize2 = (int32_t)(h2p - h2);
 1145|    865|  if (hsize2 != current_header_len) {  // sanity check
  ------------------
  |  Branch (1145:7): [True: 0, False: 865]
  ------------------
 1146|      0|    free(offtooff);
 1147|      0|    free(h2);
 1148|      0|    return NULL;
 1149|      0|  }
 1150|       |
 1151|       |  // Map size + int16 size
 1152|    865|  if ((uint32_t) (hsize2 - hsize) >= (1U << 16U)) {
  ------------------
  |  Branch (1152:7): [True: 0, False: 865]
  ------------------
 1153|      0|    free(offtooff);
 1154|      0|    free(h2);
 1155|      0|    return NULL;
 1156|      0|  }
 1157|    865|  uint16_t map_size = (uint16_t) (hsize2 - hsize);
 1158|    865|  to_big(h2 + FRAME_IDX_SIZE, &map_size, sizeof(map_size));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1159|       |
 1160|       |  // Make space for an (empty) array
 1161|    865|  hsize = (int32_t)(h2p - h2);
 1162|    865|  h2 = realloc(h2, (size_t)hsize + 2 + 1 + 2);
 1163|    865|  h2p = h2 + hsize;
 1164|       |
 1165|       |  // Now, store the values in an array
 1166|    865|  *h2p = 0xdc;  // array 16 with N elements
 1167|    865|  h2p += 1;
 1168|    865|  to_big(h2p, &nmetalayers, sizeof(nmetalayers));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1169|    865|  h2p += sizeof(nmetalayers);
 1170|    865|  current_header_len = (int32_t)(h2p - h2);
 1171|  1.64k|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (1171:28): [True: 778, False: 865]
  ------------------
 1172|    778|    if (frame == NULL) {
  ------------------
  |  Branch (1172:9): [True: 0, False: 778]
  ------------------
 1173|      0|      free(offtooff);
 1174|      0|      free(h2);
 1175|      0|      return NULL;
 1176|      0|    }
 1177|    778|    blosc2_metalayer *metalayer = schunk->metalayers[nmetalayer];
 1178|    778|    h2 = realloc(h2, (size_t)current_header_len + 1 + 4 + metalayer->content_len);
 1179|    778|    h2p = h2 + current_header_len;
 1180|       |    // Store the serialized contents for this metalayer
 1181|    778|    *h2p = 0xc6;  // bin32
 1182|    778|    h2p += 1;
 1183|    778|    to_big(h2p, &(metalayer->content_len), sizeof(metalayer->content_len));
  ------------------
  |  |   37|    778|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1184|    778|    h2p += 4;
 1185|    778|    memcpy(h2p, metalayer->content, metalayer->content_len);  // buffer, no need to swap
 1186|    778|    h2p += metalayer->content_len;
 1187|       |    // Update the offset now that we know it
 1188|    778|    to_big(h2 + offtooff[nmetalayer], &current_header_len, sizeof(current_header_len));
  ------------------
  |  |   37|    778|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1189|    778|    current_header_len += 1 + 4 + metalayer->content_len;
 1190|    778|  }
 1191|    865|  free(offtooff);
 1192|    865|  hsize = (int32_t)(h2p - h2);
 1193|    865|  if (hsize != current_header_len) {  // sanity check
  ------------------
  |  Branch (1193:7): [True: 0, False: 865]
  ------------------
 1194|      0|    free(h2);
 1195|      0|    return NULL;
 1196|      0|  }
 1197|       |
 1198|       |  // Set the length of the whole header now that we know it
 1199|    865|  to_big(h2 + FRAME_HEADER_LEN, &hsize, sizeof(hsize));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1200|       |
 1201|    865|  return h2;
 1202|    865|}
get_header_info:
 1211|  4.61k|                    uint8_t *splitmode, uint8_t *use_dict, const blosc2_io *io) {
 1212|  4.61k|  uint8_t* framep = frame->cframe;
 1213|  4.61k|  uint8_t* header_ptr;
 1214|  4.61k|  uint8_t header[FRAME_HEADER_MINLEN];
 1215|       |
 1216|  4.61k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
 1217|  4.61k|  if (io_cb == NULL) {
  ------------------
  |  Branch (1217:7): [True: 0, False: 4.61k]
  ------------------
 1218|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1219|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1220|      0|  }
 1221|       |
 1222|  4.61k|  if (frame->len <= 0) {
  ------------------
  |  Branch (1222:7): [True: 0, False: 4.61k]
  ------------------
 1223|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1224|      0|  }
 1225|       |
 1226|  4.61k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (1226:7): [True: 0, False: 4.61k]
  ------------------
 1227|      0|    int64_t rbytes = 0;
 1228|      0|    void* fp = NULL;
 1229|      0|    int64_t io_pos = 0;
 1230|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1230:9): [True: 0, False: 0]
  ------------------
 1231|      0|      fp = sframe_open_index(frame->urlpath, "rb", io);
 1232|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1232:11): [True: 0, False: 0]
  ------------------
 1233|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1234|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1235|      0|      }
 1236|      0|    }
 1237|      0|    else {
 1238|       |      /* Ahead of the header read, not after it: everything downstream (and
 1239|       |         frame_refresh_if_stale in particular) trusts the length this read
 1240|       |         returns, so a stale handle here would pair old metadata with the
 1241|       |         replacement's bytes. */
 1242|      0|      frame_reader_revalidate(frame);
 1243|      0|      fp = frame_reader_acquire(frame, io);
 1244|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1244:11): [True: 0, False: 0]
  ------------------
 1245|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1246|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1247|      0|      }
 1248|      0|      io_pos = frame->file_offset;
 1249|      0|    }
 1250|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (1250:9): [True: 0, False: 0]
  ------------------
 1251|      0|      header_ptr = header;
 1252|      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
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1253|      0|    frame_reader_release(frame, io_cb, fp);
 1254|      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 (1254:9): [True: 0, False: 0]
  ------------------
 1255|      0|      return BLOSC2_ERROR_FILE_READ;
 1256|      0|    }
 1257|      0|    framep = header_ptr;
 1258|      0|  }
 1259|       |
 1260|       |  // Consistency check for frame type
 1261|  4.61k|  uint8_t frame_type = framep[FRAME_TYPE];
  ------------------
  |  |   33|  4.61k|#define FRAME_TYPE (FRAME_FLAGS + 1)  // 26
  |  |  ------------------
  |  |  |  |   32|  4.61k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  4.61k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  4.61k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  4.61k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1262|  4.61k|  uint8_t frame_version = framep[FRAME_FLAGS] & 0x0fu;
  ------------------
  |  |   32|  4.61k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|  4.61k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|  4.61k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|  4.61k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1263|  4.61k|  if (frame_version > BLOSC2_VERSION_FRAME_FORMAT) {
  ------------------
  |  Branch (1263:7): [True: 0, False: 4.61k]
  ------------------
 1264|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1265|      0|    return BLOSC2_ERROR_VERSION_SUPPORT;
 1266|      0|  }
 1267|  4.61k|  if (frame->sframe) {
  ------------------
  |  Branch (1267:7): [True: 0, False: 4.61k]
  ------------------
 1268|      0|    if (frame_type != FRAME_DIRECTORY_TYPE) {
  ------------------
  |  |   22|      0|#define FRAME_DIRECTORY_TYPE 1
  ------------------
  |  Branch (1268:9): [True: 0, False: 0]
  ------------------
 1269|      0|      return BLOSC2_ERROR_FRAME_TYPE;
 1270|      0|    }
 1271|  4.61k|  } else {
 1272|  4.61k|    if (frame_type != FRAME_CONTIGUOUS_TYPE) {
  ------------------
  |  |   21|  4.61k|#define FRAME_CONTIGUOUS_TYPE 0
  ------------------
  |  Branch (1272:9): [True: 0, False: 4.61k]
  ------------------
 1273|      0|      return BLOSC2_ERROR_FRAME_TYPE;
 1274|      0|    }
 1275|  4.61k|  }
 1276|       |
 1277|       |  // Fetch some internal lengths
 1278|  4.61k|  from_big(header_len, framep + FRAME_HEADER_LEN, sizeof(*header_len));
  ------------------
  |  |   38|  4.61k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1279|  4.61k|  if (*header_len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  4.61k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  4.61k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  4.61k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  4.61k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  4.61k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  4.61k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  4.61k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  4.61k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  4.61k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  4.61k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  4.61k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  4.61k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  4.61k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  4.61k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1279:7): [True: 0, False: 4.61k]
  ------------------
 1280|      0|    BLOSC_TRACE_ERROR("Header length is zero or smaller than min 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1281|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1282|      0|  }
 1283|  4.61k|  from_big(frame_len, framep + FRAME_LEN, sizeof(*frame_len));
  ------------------
  |  |   38|  4.61k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1284|  4.61k|  if (*header_len > *frame_len) {
  ------------------
  |  Branch (1284:7): [True: 1, False: 4.61k]
  ------------------
 1285|      1|    BLOSC_TRACE_ERROR("Header length exceeds length of the 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1286|      1|    return BLOSC2_ERROR_INVALID_HEADER;
 1287|      1|  }
 1288|  4.61k|  from_big(nbytes, framep + FRAME_NBYTES, sizeof(*nbytes));
  ------------------
  |  |   38|  4.61k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1289|  4.61k|  from_big(cbytes, framep + FRAME_CBYTES, sizeof(*cbytes));
  ------------------
  |  |   38|  4.61k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1290|  4.61k|  from_big(blocksize, framep + FRAME_BLOCKSIZE, sizeof(*blocksize));
  ------------------
  |  |   38|  4.61k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1291|  4.61k|  if (chunksize != NULL) {
  ------------------
  |  Branch (1291:7): [True: 4.52k, False: 87]
  ------------------
 1292|  4.52k|    from_big(chunksize, framep + FRAME_CHUNKSIZE, sizeof(*chunksize));
  ------------------
  |  |   38|  4.52k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1293|  4.52k|  }
 1294|  4.61k|  if (typesize != NULL) {
  ------------------
  |  Branch (1294:7): [True: 2.79k, False: 1.81k]
  ------------------
 1295|  2.79k|    from_big(typesize, framep + FRAME_TYPESIZE, sizeof(*typesize));
  ------------------
  |  |   38|  2.79k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1296|  2.79k|    if (*typesize <= 0) {
  ------------------
  |  Branch (1296:9): [True: 0, False: 2.79k]
  ------------------
 1297|      0|      BLOSC_TRACE_ERROR("`typesize` cannot be zero or 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1298|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 1299|      0|    }
 1300|  2.79k|  }
 1301|       |
 1302|       |  // Codecs
 1303|  4.61k|  uint8_t frame_codecs = framep[FRAME_CODECS];
  ------------------
  |  |   34|  4.61k|#define FRAME_CODECS (FRAME_FLAGS + 2)  // 27
  |  |  ------------------
  |  |  |  |   32|  4.61k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  4.61k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  4.61k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  4.61k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1304|  4.61k|  if (clevel != NULL) {
  ------------------
  |  Branch (1304:7): [True: 234, False: 4.38k]
  ------------------
 1305|    234|    *clevel = frame_codecs >> 4u;
 1306|    234|  }
 1307|  4.61k|  if (compcode != NULL) {
  ------------------
  |  Branch (1307:7): [True: 234, False: 4.38k]
  ------------------
 1308|    234|    *compcode = frame_codecs & 0xFu;
 1309|    234|    if (*compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (1309:9): [True: 36, False: 198]
  ------------------
 1310|     36|      from_big(compcode, framep + FRAME_UDCODEC, sizeof(*compcode));
  ------------------
  |  |   38|     36|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1311|     36|    }
 1312|    234|  }
 1313|       |
 1314|       |  // Other flags
 1315|  4.61k|  uint8_t other_flags = framep[FRAME_OTHER_FLAGS];
  ------------------
  |  |   35|  4.61k|#define FRAME_OTHER_FLAGS (FRAME_FLAGS + 3)  // 28
  |  |  ------------------
  |  |  |  |   32|  4.61k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  4.61k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  4.61k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  4.61k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1316|  4.61k|  if (splitmode != NULL) {
  ------------------
  |  Branch (1316:7): [True: 234, False: 4.38k]
  ------------------
 1317|    234|    *splitmode = (other_flags & 0x03u) + 1;
 1318|    234|  }
 1319|       |
 1320|       |  // Other flags 2: bit 0 = use_dict
 1321|  4.61k|  if (use_dict != NULL) {
  ------------------
  |  Branch (1321:7): [True: 234, False: 4.38k]
  ------------------
 1322|    234|    *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   47|    234|#define FRAME_OTHER_FLAGS2 (FRAME_FILTER_PIPELINE + 1 + 14)  // 85
  |  |  ------------------
  |  |  |  |   44|    234|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    234|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    234|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    234|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    234|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    234|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    234|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    234|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    234|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    234|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    234|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    234|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    234|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   48|    234|#define FRAME_USE_DICT (1U << 0)   //!< bit 0 of other_flags2: use dictionary compression
  ------------------
  |  Branch (1322:17): [True: 73, False: 161]
  ------------------
 1323|    234|  }
 1324|       |
 1325|  4.61k|  if (compcode_meta != NULL) {
  ------------------
  |  Branch (1325:7): [True: 234, False: 4.38k]
  ------------------
 1326|    234|    from_big(compcode_meta, framep + FRAME_CODEC_META, sizeof(*compcode_meta));
  ------------------
  |  |   38|    234|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1327|    234|  }
 1328|       |
 1329|       |  // Filters
 1330|  4.61k|  if (filters != NULL && filters_meta != NULL) {
  ------------------
  |  Branch (1330:7): [True: 234, False: 4.38k]
  |  Branch (1330:26): [True: 234, False: 0]
  ------------------
 1331|    234|    uint8_t nfilters = framep[FRAME_FILTER_PIPELINE];
  ------------------
  |  |   44|    234|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|    234|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    234|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|    234|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|    234|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|    234|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    234|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    234|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    234|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    234|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    234|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    234|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    234|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1332|    234|    if (nfilters > BLOSC2_MAX_FILTERS) {
  ------------------
  |  Branch (1332:9): [True: 0, False: 234]
  ------------------
 1333|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1334|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 1335|      0|    }
 1336|    234|    uint8_t *filters_ = framep + FRAME_FILTER_PIPELINE + 1;
  ------------------
  |  |   44|    234|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|    234|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    234|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|    234|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|    234|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|    234|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    234|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    234|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    234|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    234|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    234|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    234|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    234|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1337|    234|    uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   44|    234|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|    234|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    234|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|    234|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|    234|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|    234|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    234|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    234|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    234|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    234|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    234|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    234|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    234|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   53|    234|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
 1338|    846|    for (int i = 0; i < nfilters; i++) {
  ------------------
  |  Branch (1338:21): [True: 612, False: 234]
  ------------------
 1339|    612|      filters[i] = filters_[i];
 1340|    612|      filters_meta[i] = filters_meta_[i];
 1341|    612|    }
 1342|    234|  }
 1343|       |
 1344|  4.61k|  if (*nbytes > 0) {
  ------------------
  |  Branch (1344:7): [True: 4.34k, False: 272]
  ------------------
 1345|  4.34k|    if (*chunksize > 0) {
  ------------------
  |  Branch (1345:9): [True: 4.21k, False: 128]
  ------------------
 1346|       |      // We can compute the number of chunks directly when there is a fixed chunk size.
 1347|  4.21k|      *nchunks = *nbytes / *chunksize;
 1348|  4.21k|      if (*nbytes % *chunksize > 0) {
  ------------------
  |  Branch (1348:11): [True: 23, False: 4.19k]
  ------------------
 1349|     23|        *nchunks += 1;
 1350|     23|      }
 1351|       |
 1352|       |      // Sanity check for compressed sizes
 1353|  4.21k|      if ((*cbytes < 0) || ((int64_t)*nchunks * *chunksize < *nbytes)) {
  ------------------
  |  Branch (1353:11): [True: 1, False: 4.21k]
  |  Branch (1353:28): [True: 0, False: 4.21k]
  ------------------
 1354|      1|        BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1355|      1|        return BLOSC2_ERROR_INVALID_HEADER;
 1356|      1|      }
 1357|  4.21k|    }
 1358|    128|    else if (*chunksize == 0) {
  ------------------
  |  Branch (1358:14): [True: 127, False: 1]
  ------------------
 1359|    127|      int32_t coffsets_nbytes;
 1360|    127|      int rc2 = get_coffsets_nbytes(frame, *header_len, *cbytes, &coffsets_nbytes, io);
 1361|    127|      if (rc2 < 0) {
  ------------------
  |  Branch (1361:11): [True: 9, False: 118]
  ------------------
 1362|      9|        return rc2;
 1363|      9|      }
 1364|    118|      if (coffsets_nbytes < 0 || coffsets_nbytes % (int32_t)sizeof(int64_t) != 0) {
  ------------------
  |  Branch (1364:11): [True: 0, False: 118]
  |  Branch (1364:34): [True: 0, False: 118]
  ------------------
 1365|      0|        BLOSC_TRACE_ERROR("Invalid offsets chunk 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1366|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 1367|      0|      }
 1368|    118|      *nchunks = coffsets_nbytes / (int32_t)sizeof(int64_t);
 1369|    118|    }
 1370|      1|    else {
 1371|      1|      BLOSC_TRACE_ERROR("Invalid chunk size in frame header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1372|      1|      return BLOSC2_ERROR_INVALID_HEADER;
 1373|      1|    }
 1374|  4.34k|  } else {
 1375|    272|    *nchunks = 0;
 1376|    272|  }
 1377|       |
 1378|  4.60k|  if (*nchunks > 0) {
  ------------------
  |  Branch (1378:7): [True: 4.33k, False: 274]
  ------------------
 1379|  4.33k|    int32_t off_nbytes;
 1380|  4.33k|    if (!blosc2_nchunks_to_offsets_nbytes(*nchunks, &off_nbytes)) {
  ------------------
  |  Branch (1380:9): [True: 2, False: 4.32k]
  ------------------
 1381|      2|      BLOSC_TRACE_ERROR("Invalid number of chunks in frame header.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1382|      2|      return BLOSC2_ERROR_INVALID_HEADER;
 1383|      2|    }
 1384|  4.33k|  }
 1385|       |
 1386|  4.60k|  return 0;
 1387|  4.60k|}
get_trailer_offset:
 1390|    953|int64_t get_trailer_offset(blosc2_frame_s *frame, int32_t header_len, bool has_coffsets) {
 1391|    953|  if (!has_coffsets) {
  ------------------
  |  Branch (1391:7): [True: 177, False: 776]
  ------------------
 1392|       |    // No data chunks yet
 1393|    177|    return header_len;
 1394|    177|  }
 1395|    776|  return frame->len - frame->trailer_len;
 1396|    953|}
frame_check_stale:
 1582|    427|int frame_check_stale(blosc2_frame_s *frame) {
 1583|    427|  if (frame == NULL || frame->cframe != NULL || frame->schunk == NULL) {
  ------------------
  |  Branch (1583:7): [True: 0, False: 427]
  |  Branch (1583:24): [True: 427, False: 0]
  |  Branch (1583:49): [True: 0, False: 0]
  ------------------
 1584|    427|    return 0;
 1585|    427|  }
 1586|      0|  if (frame_lock(frame, false) < 0) {
  ------------------
  |  Branch (1586:7): [True: 0, False: 0]
  ------------------
 1587|      0|    return BLOSC2_ERROR_LOCK;
 1588|      0|  }
 1589|      0|  int32_t header_len;
 1590|      0|  int64_t frame_len;
 1591|      0|  int64_t nbytes;
 1592|      0|  int64_t cbytes;
 1593|      0|  int32_t blocksize;
 1594|      0|  int32_t chunksize;
 1595|      0|  int64_t nchunks;
 1596|      0|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 1597|      0|                           &blocksize, &chunksize, &nchunks,
 1598|      0|                           NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 1599|      0|                           frame->schunk->storage->io);
 1600|      0|  if (rc < 0) {
  ------------------
  |  Branch (1600:7): [True: 0, False: 0]
  ------------------
 1601|       |    // The on-disk header cannot be read right now (e.g. a freshly created
 1602|       |    // frame not yet flushed to disk, or another process mid-write).  The
 1603|       |    // poll is opportunistic: keep the cached view, exactly as before polling
 1604|       |    // existed.  A genuinely torn frame still errors out in the data-access
 1605|       |    // paths that need it.
 1606|      0|    frame_unlock(frame);
 1607|      0|    return 0;
 1608|      0|  }
 1609|      0|  rc = frame_refresh_if_stale(frame, frame_len);
 1610|      0|  if (rc > 0) {
  ------------------
  |  Branch (1610:7): [True: 0, False: 0]
  ------------------
 1611|      0|    frame->schunk->nbytes = nbytes;
 1612|      0|    frame->schunk->cbytes = cbytes;
 1613|      0|    frame->schunk->nchunks = nchunks;
 1614|      0|  }
 1615|      0|  frame_unlock(frame);
 1616|      0|  return rc;
 1617|      0|}
update_frame_len:
 1703|    865|int update_frame_len(blosc2_frame_s* frame, int64_t len) {
 1704|    865|  int rc = 1;
 1705|    865|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1706|    865|  if (io_cb == NULL) {
  ------------------
  |  Branch (1706:7): [True: 0, False: 865]
  ------------------
 1707|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1708|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1709|      0|  }
 1710|       |
 1711|    865|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1711:7): [True: 865, False: 0]
  ------------------
 1712|    865|    to_big(frame->cframe + FRAME_LEN, &len, sizeof(int64_t));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1713|    865|  }
 1714|      0|  else {
 1715|      0|    void* fp = NULL;
 1716|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1716:9): [True: 0, False: 0]
  ------------------
 1717|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 1718|      0|                             frame->schunk->storage->io);
 1719|      0|    }
 1720|      0|    else {
 1721|      0|      fp = frame_writer_acquire(frame, io_cb);
 1722|      0|    }
 1723|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1723:9): [True: 0, False: 0]
  ------------------
 1724|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1725|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1726|      0|    }
 1727|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1728|      0|    int64_t swap_len;
 1729|      0|    to_big(&swap_len, &len, sizeof(int64_t));
  ------------------
  |  |   37|      0|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1730|      0|    int64_t wbytes = io_cb->write(&swap_len, 1, sizeof(int64_t), io_pos, fp);
 1731|      0|    frame_writer_release(frame, io_cb, fp);
 1732|      0|    if (wbytes != sizeof(int64_t)) {
  ------------------
  |  Branch (1732:9): [True: 0, False: 0]
  ------------------
 1733|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1734|      0|      return BLOSC2_ERROR_FILE_WRITE;
 1735|      0|    }
 1736|      0|  }
 1737|    865|  return rc;
 1738|    865|}
frame_update_trailer:
 1741|    865|int frame_update_trailer(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 1742|    865|  if (frame != NULL && frame->len == 0) {
  ------------------
  |  Branch (1742:7): [True: 865, False: 0]
  |  Branch (1742:24): [True: 0, False: 865]
  ------------------
 1743|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1744|      0|  }
 1745|       |
 1746|       |  // Create the trailer in msgpack (see the frame format document)
 1747|    865|  uint32_t trailer_len = FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|    865|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 1748|    865|  uint8_t* trailer = (uint8_t*)calloc((size_t)trailer_len, 1);
 1749|    865|  uint8_t* ptrailer = trailer;
 1750|    865|  *ptrailer = 0x90 + 4;  // fixarray with 4 elements
 1751|    865|  ptrailer += 1;
 1752|       |  // Trailer format version
 1753|    865|  *ptrailer = FRAME_TRAILER_VERSION;
  ------------------
  |  |   56|    865|#define FRAME_TRAILER_VERSION (1U)        // can be up to 127
  ------------------
 1754|    865|  ptrailer += 1;
 1755|       |
 1756|    865|  int32_t current_trailer_len = (int32_t)(ptrailer - trailer);
 1757|       |
 1758|       |  // Now, deal with variable-length metalayers
 1759|    865|  int16_t nvlmetalayers = schunk->nvlmetalayers;
 1760|    865|  if (nvlmetalayers < 0 || nvlmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1895|    865|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (1760:7): [True: 0, False: 865]
  |  Branch (1760:28): [True: 0, False: 865]
  ------------------
 1761|      0|    return -1;
 1762|      0|  }
 1763|       |
 1764|       |  // Make space for the header of metalayers (array marker, size, map of offsets)
 1765|    865|  trailer = realloc(trailer, (size_t) current_trailer_len + 1 + 1 + 2 + 1 + 2);
 1766|    865|  ptrailer = trailer + current_trailer_len;
 1767|       |
 1768|       |  // The msgpack header for the metalayers (array_marker, size, map of offsets, list of metalayers)
 1769|    865|  *ptrailer = 0x90 + 3;  // array with 3 elements
 1770|    865|  ptrailer += 1;
 1771|       |
 1772|    865|  int32_t tsize = (int32_t)(ptrailer - trailer);
 1773|       |
 1774|       |  // Size for the map (index) of metalayer offsets, including this uint16 size (to be filled out later on)
 1775|    865|  *ptrailer = 0xcd;  // uint16
 1776|    865|  ptrailer += 1 + 2;
 1777|       |
 1778|       |  // Map (index) of offsets for optional metalayers
 1779|    865|  *ptrailer = 0xde;  // map 16 with N keys
 1780|    865|  ptrailer += 1;
 1781|    865|  to_big(ptrailer, &nvlmetalayers, sizeof(nvlmetalayers));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1782|    865|  ptrailer += sizeof(nvlmetalayers);
 1783|    865|  current_trailer_len = (int32_t)(ptrailer - trailer);
 1784|    865|  int32_t *offtodata = malloc(nvlmetalayers * sizeof(int32_t));
 1785|    865|  for (int nvlmetalayer = 0; nvlmetalayer < nvlmetalayers; nvlmetalayer++) {
  ------------------
  |  Branch (1785:30): [True: 0, False: 865]
  ------------------
 1786|      0|    if (frame == NULL) {
  ------------------
  |  Branch (1786:9): [True: 0, False: 0]
  ------------------
 1787|      0|      return -1;
 1788|      0|    }
 1789|      0|    blosc2_metalayer *vlmetalayer = schunk->vlmetalayers[nvlmetalayer];
 1790|      0|    uint8_t name_len = (uint8_t) strlen(vlmetalayer->name);
 1791|      0|    trailer = realloc(trailer, (size_t)current_trailer_len + 1 + name_len + 1 + 4);
 1792|      0|    ptrailer = trailer + current_trailer_len;
 1793|       |    // Store the vlmetalayer
 1794|      0|    if (name_len >= (1U << 5U)) {  // metalayer strings cannot be longer than 32 bytes
  ------------------
  |  Branch (1794:9): [True: 0, False: 0]
  ------------------
 1795|      0|      free(offtodata);
 1796|      0|      return -1;
 1797|      0|    }
 1798|      0|    *ptrailer = (uint8_t)0xa0 + name_len;  // str
 1799|      0|    ptrailer += 1;
 1800|      0|    memcpy(ptrailer, vlmetalayer->name, name_len);
 1801|      0|    ptrailer += name_len;
 1802|       |    // Space for storing the offset for the value of this vlmetalayer
 1803|      0|    *ptrailer = 0xd2;  // int32
 1804|      0|    ptrailer += 1;
 1805|      0|    offtodata[nvlmetalayer] = (int32_t)(ptrailer - trailer);
 1806|      0|    ptrailer += 4;
 1807|      0|    current_trailer_len += 1 + name_len + 1 + 4;
 1808|      0|  }
 1809|    865|  int32_t tsize2 = (int32_t)(ptrailer - trailer);
 1810|    865|  if (tsize2 != current_trailer_len) {  // sanity check
  ------------------
  |  Branch (1810:7): [True: 0, False: 865]
  ------------------
 1811|      0|    return -1;
 1812|      0|  }
 1813|       |
 1814|       |  // Map size + int16 size
 1815|    865|  if ((uint32_t) (tsize2 - tsize) >= (1U << 16U)) {
  ------------------
  |  Branch (1815:7): [True: 0, False: 865]
  ------------------
 1816|      0|    return -1;
 1817|      0|  }
 1818|    865|  uint16_t map_size = (uint16_t) (tsize2 - tsize);
 1819|    865|  to_big(trailer + 4, &map_size, sizeof(map_size));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1820|       |
 1821|       |  // Make space for an (empty) array
 1822|    865|  tsize = (int32_t)(ptrailer - trailer);
 1823|    865|  trailer = realloc(trailer, (size_t) tsize + 2 + 1 + 2);
 1824|    865|  ptrailer = trailer + tsize;
 1825|       |
 1826|       |  // Now, store the values in an array
 1827|    865|  *ptrailer = 0xdc;  // array 16 with N elements
 1828|    865|  ptrailer += 1;
 1829|    865|  to_big(ptrailer, &nvlmetalayers, sizeof(nvlmetalayers));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1830|    865|  ptrailer += sizeof(nvlmetalayers);
 1831|    865|  current_trailer_len = (int32_t)(ptrailer - trailer);
 1832|    865|  for (int nvlmetalayer = 0; nvlmetalayer < nvlmetalayers; nvlmetalayer++) {
  ------------------
  |  Branch (1832:30): [True: 0, False: 865]
  ------------------
 1833|      0|    if (frame == NULL) {
  ------------------
  |  Branch (1833:9): [True: 0, False: 0]
  ------------------
 1834|      0|      return -1;
 1835|      0|    }
 1836|      0|    blosc2_metalayer *vlmetalayer = schunk->vlmetalayers[nvlmetalayer];
 1837|      0|    trailer = realloc(trailer, (size_t)current_trailer_len + 1 + 4 + vlmetalayer->content_len);
 1838|      0|    ptrailer = trailer + current_trailer_len;
 1839|       |    // Store the serialized contents for this vlmetalayer
 1840|      0|    *ptrailer = 0xc6;  // bin32
 1841|      0|    ptrailer += 1;
 1842|      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)
  ------------------
 1843|      0|    ptrailer += 4;
 1844|      0|    memcpy(ptrailer, vlmetalayer->content, vlmetalayer->content_len);  // buffer, no need to swap
 1845|      0|    ptrailer += vlmetalayer->content_len;
 1846|       |    // Update the offset now that we know it
 1847|      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)
  ------------------
 1848|      0|    current_trailer_len += 1 + 4 + vlmetalayer->content_len;
 1849|      0|  }
 1850|    865|  free(offtodata);
 1851|    865|  tsize = (int32_t)(ptrailer - trailer);
 1852|    865|  if (tsize != current_trailer_len) {  // sanity check
  ------------------
  |  Branch (1852:7): [True: 0, False: 865]
  ------------------
 1853|      0|    return -1;
 1854|      0|  }
 1855|       |
 1856|    865|  trailer = realloc(trailer, (size_t)current_trailer_len + 23);
 1857|    865|  ptrailer = trailer + current_trailer_len;
 1858|    865|  trailer_len = (ptrailer - trailer) + 23;
 1859|       |
 1860|       |  // Trailer length
 1861|    865|  *ptrailer = 0xce;  // uint32
 1862|    865|  ptrailer += 1;
 1863|    865|  to_big(ptrailer, &trailer_len, sizeof(uint32_t));
  ------------------
  |  |   37|    865|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 1864|    865|  ptrailer += sizeof(uint32_t);
 1865|       |  // Up to 16 bytes for frame fingerprint (using XXH3 included in https://github.com/Cyan4973/xxHash)
 1866|       |  // Maybe someone would need 256-bit in the future, but for the time being 128-bit seems like a good tradeoff
 1867|    865|  *ptrailer = 0xd8;  // fixext 16
 1868|    865|  ptrailer += 1;
 1869|    865|  *ptrailer = 0;  // fingerprint type: 0 -> no fp; 1 -> 32-bit; 2 -> 64-bit; 3 -> 128-bit
 1870|    865|  ptrailer += 1;
 1871|       |
 1872|       |  // Remove call to memset when we compute an actual fingerprint
 1873|    865|  memset(ptrailer, 0, 16);
 1874|       |  // Uncomment call to memcpy when we compute an actual fingerprint
 1875|       |  // memcpy(ptrailer, xxh3_fingerprint, sizeof(xxh3_fingerprint));
 1876|    865|  ptrailer += 16;
 1877|       |
 1878|       |  // Sanity check
 1879|    865|  ptrdiff_t actual_trailer_len = ptrailer - trailer;
 1880|    865|  if (actual_trailer_len < 0 || (uint64_t)actual_trailer_len != (uint64_t)trailer_len) {
  ------------------
  |  Branch (1880:7): [True: 0, False: 865]
  |  Branch (1880:33): [True: 0, False: 865]
  ------------------
 1881|      0|    return BLOSC2_ERROR_DATA;
 1882|      0|  }
 1883|       |
 1884|    865|  int32_t header_len;
 1885|    865|  int64_t frame_len;
 1886|    865|  int64_t nbytes;
 1887|    865|  int64_t cbytes;
 1888|    865|  int32_t blocksize;
 1889|    865|  int32_t chunksize;
 1890|    865|  int64_t nchunks;
 1891|    865|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 1892|    865|                            &blocksize, &chunksize, &nchunks,
 1893|    865|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 1894|    865|                            frame->schunk->storage->io);
 1895|    865|  if (ret < 0) {
  ------------------
  |  Branch (1895:7): [True: 0, False: 865]
  ------------------
 1896|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1897|      0|    return ret;
 1898|      0|  }
 1899|       |
 1900|    865|  int64_t trailer_offset = get_trailer_offset(frame, header_len, nbytes > 0);
 1901|       |
 1902|    865|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (1902:7): [True: 0, False: 865]
  ------------------
 1903|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1904|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1905|      0|  }
 1906|       |
 1907|    865|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1908|    865|  if (io_cb == NULL) {
  ------------------
  |  Branch (1908:7): [True: 0, False: 865]
  ------------------
 1909|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1910|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1911|      0|  }
 1912|       |  // Update the trailer.  As there are no internal offsets to the trailer section,
 1913|       |  // and it is always at the end of the frame, we can just write (or overwrite) it
 1914|       |  // at the end of the frame.
 1915|    865|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1915:7): [True: 865, False: 0]
  ------------------
 1916|    865|    frame->cframe = realloc(frame->cframe, (size_t)(trailer_offset + trailer_len));
 1917|    865|    if (frame->cframe == NULL) {
  ------------------
  |  Branch (1917:9): [True: 0, False: 865]
  ------------------
 1918|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1919|      0|      free(trailer);
 1920|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 1921|      0|    }
 1922|    865|    memcpy(frame->cframe + trailer_offset, trailer, trailer_len);
 1923|    865|  }
 1924|      0|  else {
 1925|      0|    void* fp = NULL;
 1926|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1926:9): [True: 0, False: 0]
  ------------------
 1927|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 1928|      0|                             frame->schunk->storage->io);
 1929|      0|    }
 1930|      0|    else {
 1931|      0|      fp = frame_writer_acquire(frame, io_cb);
 1932|      0|    }
 1933|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1933:9): [True: 0, False: 0]
  ------------------
 1934|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1935|      0|      free(trailer);
 1936|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1937|      0|    }
 1938|      0|    int64_t io_pos = frame->file_offset + trailer_offset;
 1939|      0|    int64_t wbytes = io_cb->write(trailer, 1, trailer_len, io_pos, fp);
 1940|      0|    if (wbytes != trailer_len) {
  ------------------
  |  Branch (1940:9): [True: 0, False: 0]
  ------------------
 1941|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1942|      0|      frame->file_end = 0;  // a partial write may have moved the end of the file
 1943|      0|      frame_writer_release(frame, io_cb, fp);
 1944|      0|      free(trailer);
 1945|      0|      return BLOSC2_ERROR_FILE_WRITE;
 1946|      0|    }
 1947|      0|    int64_t trunc_pos = frame->file_offset + trailer_offset + trailer_len;
 1948|       |    // Only cut the file when the frame really got shorter than it.  A growing
 1949|       |    // frame leaves no stale bytes behind its trailer, and a truncate is never
 1950|       |    // free: on NFS it is a synchronous flush plus a SETATTR round trip, and XFS
 1951|       |    // flushes the file on the next close after any truncate that does not grow
 1952|       |    // it.  Other backends keep truncating unconditionally.
 1953|       |    //
 1954|       |    // file_end is the size we last left the file at.  A write that failed
 1955|       |    // halfway through an earlier update can have left bytes past it, which are
 1956|       |    // then only cut by the next update that shrinks the frame.  That is
 1957|       |    // harmless: the frame length is read from the header, not the file size.
 1958|      0|    bool must_truncate = true;
 1959|      0|    if (!frame->sframe && frame->schunk->storage->io->id == BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (1959:9): [True: 0, False: 0]
  |  Branch (1959:27): [True: 0, False: 0]
  ------------------
 1960|      0|      if (frame->file_end <= 0) {
  ------------------
  |  Branch (1960:11): [True: 0, False: 0]
  ------------------
 1961|      0|        frame->file_end = io_cb->size(fp);  // once per handle; negative on error
 1962|      0|      }
 1963|      0|      must_truncate = frame->file_end <= 0 || trunc_pos < frame->file_end;
  ------------------
  |  Branch (1963:23): [True: 0, False: 0]
  |  Branch (1963:47): [True: 0, False: 0]
  ------------------
 1964|      0|    }
 1965|      0|    if (must_truncate && io_cb->truncate(fp, trunc_pos) != 0) {
  ------------------
  |  Branch (1965:9): [True: 0, False: 0]
  |  Branch (1965:26): [True: 0, False: 0]
  ------------------
 1966|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1967|      0|      frame->file_end = 0;
 1968|      0|      frame_writer_release(frame, io_cb, fp);
 1969|      0|      free(trailer);
 1970|      0|      return BLOSC2_ERROR_FILE_TRUNCATE;
 1971|      0|    }
 1972|      0|    frame->file_end = trunc_pos;
 1973|      0|    frame_writer_release(frame, io_cb, fp);
 1974|       |
 1975|      0|  }
 1976|    865|  free(trailer);
 1977|       |
 1978|    865|  int rc = update_frame_len(frame, trailer_offset + trailer_len);
 1979|    865|  if (rc < 0) {
  ------------------
  |  Branch (1979:7): [True: 0, False: 865]
  ------------------
 1980|      0|    return rc;
 1981|      0|  }
 1982|    865|  frame->len = trailer_offset + trailer_len;
 1983|    865|  frame->trailer_len = trailer_len;
 1984|       |
 1985|    865|  return 1;
 1986|    865|}
frame_from_cframe:
 2224|    237|blosc2_frame_s* frame_from_cframe(uint8_t *cframe, int64_t len, bool copy) {
 2225|       |  // Get the length of the frame
 2226|    237|  const uint8_t* header = cframe;
 2227|    237|  int64_t frame_len;
 2228|    237|  if (len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    237|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    237|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    237|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    237|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    237|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    237|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    237|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    237|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    237|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    237|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    237|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    237|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    237|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    237|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2228:7): [True: 0, False: 237]
  ------------------
 2229|      0|    return NULL;
 2230|      0|  }
 2231|       |
 2232|    237|  from_big(&frame_len, header + FRAME_LEN, sizeof(frame_len));
  ------------------
  |  |   38|    237|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2233|    237|  if (frame_len != len) {   // sanity check
  ------------------
  |  Branch (2233:7): [True: 2, False: 235]
  ------------------
 2234|      2|    return NULL;
 2235|      2|  }
 2236|       |
 2237|    235|  blosc2_frame_s* frame = frame_alloc();
 2238|    235|  if (frame == NULL) {
  ------------------
  |  Branch (2238:7): [True: 0, False: 235]
  ------------------
 2239|      0|    return NULL;
 2240|      0|  }
 2241|    235|  frame->len = frame_len;
 2242|    235|  frame->file_offset = 0;
 2243|       |
 2244|       |  // Now, the trailer length
 2245|    235|  const uint8_t* trailer = cframe + frame_len - FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|    235|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 2246|    235|  int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   58|    235|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
                int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   59|    235|#define FRAME_TRAILER_LEN_OFFSET (22)  // offset to trailer length (counting from the end)
  ------------------
 2247|    235|  if (trailer[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (2247:7): [True: 0, False: 235]
  ------------------
 2248|      0|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 2249|      0|    free(frame);
 2250|      0|    return NULL;
 2251|      0|  }
 2252|    235|  uint32_t trailer_len;
 2253|    235|  from_big(&trailer_len, trailer + trailer_offset, sizeof(trailer_len));
  ------------------
  |  |   38|    235|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2254|    235|  if (trailer_len < FRAME_TRAILER_MINLEN || trailer_len > INT32_MAX ||
  ------------------
  |  |   58|    470|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (2254:7): [True: 0, False: 235]
  |  Branch (2254:45): [True: 0, False: 235]
  ------------------
 2255|    235|      (int64_t)trailer_len > frame_len ||
  ------------------
  |  Branch (2255:7): [True: 0, False: 235]
  ------------------
 2256|    235|      (int64_t)trailer_len > frame_len - FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    235|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    235|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    235|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    235|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    235|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    235|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    235|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    235|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    235|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    235|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    235|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    235|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    235|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    235|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2256:7): [True: 0, False: 235]
  ------------------
 2257|      0|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 2258|      0|    free(frame);
 2259|      0|    return NULL;
 2260|      0|  }
 2261|    235|  frame->trailer_len = trailer_len;
 2262|       |
 2263|    235|  if (copy) {
  ------------------
  |  Branch (2263:7): [True: 0, False: 235]
  ------------------
 2264|      0|    frame->cframe = malloc((size_t)len);
 2265|      0|    memcpy(frame->cframe, cframe, (size_t)len);
 2266|      0|  }
 2267|    235|  else {
 2268|    235|    frame->cframe = cframe;
 2269|    235|    frame->avoid_cframe_free = true;
 2270|    235|  }
 2271|       |
 2272|    235|  return frame;
 2273|    235|}
frame_from_schunk:
 2280|     87|int64_t frame_from_schunk(blosc2_schunk *schunk, blosc2_frame_s *frame) {
 2281|     87|  frame->file_offset = 0;
 2282|     87|  int64_t nchunks = schunk->nchunks;
 2283|     87|  int64_t cbytes = schunk->cbytes;
 2284|     87|  int32_t chunk_cbytes;
 2285|     87|  int32_t chunk_nbytes;
 2286|     87|  uint64_t* data_tmp = NULL;
 2287|     87|  uint8_t* off_chunk = NULL;
 2288|     87|  blosc2_io_cb* io_cb = NULL;
 2289|     87|  void* fp = NULL;
 2290|     87|  int rc;
 2291|       |
 2292|     87|  uint8_t* h2 = new_header_frame(schunk, frame);
 2293|     87|  if (h2 == NULL) {
  ------------------
  |  Branch (2293:7): [True: 0, False: 87]
  ------------------
 2294|      0|    return BLOSC2_ERROR_DATA;
 2295|      0|  }
 2296|     87|  uint32_t h2len;
 2297|     87|  from_big(&h2len, h2 + FRAME_HEADER_LEN, sizeof(h2len));
  ------------------
  |  |   38|     87|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2298|       |  // Build the offsets chunk
 2299|     87|  int32_t chunksize = -1;
 2300|     87|  int32_t off_cbytes = 0;
 2301|     87|  uint64_t coffset = 0;
 2302|     87|  int32_t off_nbytes;
 2303|     87|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &off_nbytes)) {
  ------------------
  |  Branch (2303:7): [True: 0, False: 87]
  ------------------
 2304|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2305|      0|    rc = BLOSC2_ERROR_DATA;
 2306|      0|    goto failed;
 2307|      0|  }
 2308|     87|  data_tmp = malloc((size_t)off_nbytes);
 2309|     87|  if (data_tmp == NULL) {
  ------------------
  |  Branch (2309:7): [True: 0, False: 87]
  ------------------
 2310|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2311|      0|    rc = BLOSC2_ERROR_MEMORY_ALLOC;
 2312|      0|    goto failed;
 2313|      0|  }
 2314|     87|  for (int64_t i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (2314:23): [True: 0, False: 87]
  ------------------
 2315|      0|    rc = blosc2_cbuffer_sizes(schunk->data[i], &chunk_nbytes, &chunk_cbytes, NULL);
 2316|      0|    if (rc < 0) {
  ------------------
  |  Branch (2316:9): [True: 0, False: 0]
  ------------------
 2317|      0|      goto failed;
 2318|      0|    }
 2319|      0|    data_tmp[i] = coffset;
 2320|      0|    coffset += chunk_cbytes;
 2321|      0|    if (i == 0) {
  ------------------
  |  Branch (2321:9): [True: 0, False: 0]
  ------------------
 2322|      0|      chunksize = chunk_nbytes;
 2323|      0|    }
 2324|      0|    else if (chunksize != chunk_nbytes) {
  ------------------
  |  Branch (2324:14): [True: 0, False: 0]
  ------------------
 2325|       |      // Variable size  // TODO: update flags for this (or do not use them at all)
 2326|      0|      chunksize = 0;
 2327|      0|    }
 2328|      0|  }
 2329|     87|  if ((int64_t)coffset != cbytes) {
  ------------------
  |  Branch (2329:7): [True: 0, False: 87]
  ------------------
 2330|      0|    rc = BLOSC2_ERROR_DATA;
 2331|      0|    goto failed;
 2332|      0|  }
 2333|     87|  if (nchunks > 0) {
  ------------------
  |  Branch (2333:7): [True: 0, False: 87]
  ------------------
 2334|      0|    off_cbytes = compress_offsets((const int64_t*)data_tmp, off_nbytes, off_nbytes + BLOSC2_MAX_OVERHEAD,
 2335|      0|                                  &off_chunk);
 2336|      0|    if (off_cbytes < 0) {
  ------------------
  |  Branch (2336:9): [True: 0, False: 0]
  ------------------
 2337|      0|      rc = off_cbytes;
 2338|      0|      goto failed;
 2339|      0|    }
 2340|      0|  }
 2341|     87|  else {
 2342|     87|    off_cbytes = 0;
 2343|     87|  }
 2344|       |
 2345|       |  // Now that we know them, fill the chunksize and frame length in header
 2346|     87|  to_big(h2 + FRAME_CHUNKSIZE, &chunksize, sizeof(chunksize));
  ------------------
  |  |   37|     87|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 2347|     87|  if (chunksize == 0) {
  ------------------
  |  Branch (2347:7): [True: 0, False: 87]
  ------------------
 2348|      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)
  ------------------
 2349|      0|  }
 2350|     87|  else {
 2351|     87|    h2[FRAME_FLAGS] &= (uint8_t)~FRAME_VARIABLE_CHUNKS;
  ------------------
  |  |   32|     87|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|     87|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|     87|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|     87|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  h2[FRAME_FLAGS] &= (uint8_t)~FRAME_VARIABLE_CHUNKS;
  ------------------
  |  |   26|     87|#define FRAME_VARIABLE_CHUNKS (1U << 6)
  ------------------
 2352|     87|  }
 2353|     87|  if (schunk->chunksize == 0 || (schunk->flags2 & BLOSC2_VL_BLOCKS)) {
  ------------------
  |  Branch (2353:7): [True: 0, False: 87]
  |  Branch (2353:33): [True: 0, False: 87]
  ------------------
 2354|      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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2355|      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)
  ------------------
 2356|      0|  }
 2357|     87|  else {
 2358|     87|    h2[FRAME_FLAGS] = (uint8_t)((h2[FRAME_FLAGS] & (uint8_t)~0x0fu) | BLOSC2_VERSION_FRAME_FORMAT_RC1);
  ------------------
  |  |   32|     87|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|     87|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|     87|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|     87|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  h2[FRAME_FLAGS] = (uint8_t)((h2[FRAME_FLAGS] & (uint8_t)~0x0fu) | BLOSC2_VERSION_FRAME_FORMAT_RC1);
  ------------------
  |  |   32|     87|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|     87|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|     87|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|     87|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2359|     87|    h2[FRAME_FLAGS] &= (uint8_t)~FRAME_VL_BLOCKS;
  ------------------
  |  |   32|     87|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|     87|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|     87|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|     87|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  h2[FRAME_FLAGS] &= (uint8_t)~FRAME_VL_BLOCKS;
  ------------------
  |  |   27|     87|#define FRAME_VL_BLOCKS (1U << 7)
  ------------------
 2360|     87|  }
 2361|     87|  frame->len = h2len + cbytes + off_cbytes + FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|     87|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 2362|     87|  if (frame->sframe) {
  ------------------
  |  Branch (2362:7): [True: 0, False: 87]
  ------------------
 2363|      0|    frame->len = h2len + off_cbytes + FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 2364|      0|  }
 2365|     87|  int64_t tbytes = frame->len;
 2366|     87|  to_big(h2 + FRAME_LEN, &tbytes, sizeof(tbytes));
  ------------------
  |  |   37|     87|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 2367|       |
 2368|     87|  const blosc2_io* io = frame->schunk->storage->io;
 2369|     87|  io_cb = blosc2_get_io_cb(io->id);
 2370|     87|  if (io_cb == NULL) {
  ------------------
  |  Branch (2370:7): [True: 0, False: 87]
  ------------------
 2371|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2372|      0|    rc = BLOSC2_ERROR_PLUGIN_IO;
 2373|      0|    goto failed;
 2374|      0|  }
 2375|       |
 2376|       |  // Create the frame and put the header at the beginning
 2377|     87|  int64_t io_pos = 0;
 2378|     87|  if (frame->urlpath == NULL) {
  ------------------
  |  Branch (2378:7): [True: 87, False: 0]
  ------------------
 2379|     87|    frame->cframe = malloc((size_t)frame->len);
 2380|     87|    memcpy(frame->cframe, h2, h2len);
 2381|     87|  }
 2382|      0|  else {
 2383|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2383:9): [True: 0, False: 0]
  ------------------
 2384|      0|      fp = sframe_open_index(frame->urlpath, "wb", io);
 2385|      0|    }
 2386|      0|    else {
 2387|       |      // The file is about to be recreated from scratch; drop any cached reader
 2388|      0|      frame_reader_invalidate(frame);
 2389|       |      // Where the handle can stay open as the cached writer (which is "rb+"
 2390|       |      // everywhere else), open it readable too
 2391|      0|      fp = io_cb->open(frame->urlpath, reader_cacheable(io) ? "wb+" : "wb", io->params);
  ------------------
  |  Branch (2391:40): [True: 0, False: 0]
  ------------------
 2392|      0|    }
 2393|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2393:9): [True: 0, False: 0]
  ------------------
 2394|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2395|      0|      rc = BLOSC2_ERROR_FILE_OPEN;
 2396|      0|      goto failed;
 2397|      0|    }
 2398|      0|    io_cb->write(h2, h2len, 1, io_pos, fp);
 2399|      0|    io_pos += h2len;
 2400|      0|  }
 2401|       |
 2402|       |  // Fill the frame with the actual data chunks
 2403|     87|  if (!frame->sframe) {
  ------------------
  |  Branch (2403:7): [True: 87, False: 0]
  ------------------
 2404|     87|    coffset = 0;
 2405|     87|    for (int64_t i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (2405:25): [True: 0, False: 87]
  ------------------
 2406|      0|      uint8_t* data_chunk = schunk->data[i];
 2407|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 2408|      0|      if (rc < 0) {
  ------------------
  |  Branch (2408:11): [True: 0, False: 0]
  ------------------
 2409|      0|        goto failed;
 2410|      0|      }
 2411|      0|      if (frame->urlpath == NULL) {
  ------------------
  |  Branch (2411:11): [True: 0, False: 0]
  ------------------
 2412|      0|        memcpy(frame->cframe + h2len + coffset, data_chunk, (size_t)chunk_cbytes);
 2413|      0|      } else {
 2414|      0|        io_cb->write(data_chunk, chunk_cbytes, 1, io_pos, fp);
 2415|      0|        io_pos += chunk_cbytes;
 2416|      0|      }
 2417|      0|      coffset += chunk_cbytes;
 2418|      0|    }
 2419|     87|    if ((int64_t)coffset != cbytes) {
  ------------------
  |  Branch (2419:9): [True: 0, False: 87]
  ------------------
 2420|      0|      rc = BLOSC2_ERROR_FAILURE;
 2421|      0|      goto failed;
 2422|      0|    }
 2423|     87|  }
 2424|       |
 2425|       |  // Copy the offsets chunk at the end of the frame (there is none without chunks)
 2426|     87|  if (frame->urlpath == NULL) {
  ------------------
  |  Branch (2426:7): [True: 87, False: 0]
  ------------------
 2427|     87|    if (off_cbytes > 0) {
  ------------------
  |  Branch (2427:9): [True: 0, False: 87]
  ------------------
 2428|      0|      memcpy(frame->cframe + h2len + cbytes, off_chunk, off_cbytes);
 2429|      0|    }
 2430|     87|  }
 2431|      0|  else {
 2432|      0|    if (off_cbytes > 0) {
  ------------------
  |  Branch (2432:9): [True: 0, False: 0]
  ------------------
 2433|      0|      io_cb->write(off_chunk, off_cbytes, 1, io_pos, fp);
 2434|      0|    }
 2435|       |    // Only a handle opened readable above can be adopted
 2436|      0|    if (!frame_writer_adopt(frame, io, fp)) {
  ------------------
  |  Branch (2436:9): [True: 0, False: 0]
  ------------------
 2437|      0|      io_cb->close(fp);
 2438|      0|    }
 2439|      0|    fp = NULL;
 2440|       |    // The file was created from scratch, so its size is exactly what we wrote
 2441|      0|    frame->file_end = frame->sframe ? 0 : io_pos + off_cbytes;
  ------------------
  |  Branch (2441:23): [True: 0, False: 0]
  ------------------
 2442|      0|  }
 2443|     87|  free(off_chunk);
 2444|     87|  free(data_tmp);
 2445|     87|  free(h2);
 2446|     87|  rc = frame_update_trailer(frame, schunk);
 2447|     87|  if (rc < 0) {
  ------------------
  |  Branch (2447:7): [True: 0, False: 87]
  ------------------
 2448|      0|    return rc;
 2449|      0|  }
 2450|       |
 2451|     87|  return frame->len;
 2452|       |
 2453|      0|  failed:
 2454|      0|  if (fp != NULL) {
  ------------------
  |  Branch (2454:7): [True: 0, False: 0]
  ------------------
 2455|      0|    io_cb->close(fp);
 2456|      0|  }
 2457|      0|  free(off_chunk);
 2458|      0|  free(data_tmp);
 2459|      0|  free(h2);
 2460|      0|  return rc;
 2461|     87|}
get_coffsets:
 2466|  3.46k|                      int64_t nchunks, int32_t *off_cbytes) {
 2467|  3.46k|  int32_t chunk_cbytes;
 2468|  3.46k|  int rc;
 2469|       |
 2470|  3.46k|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (2470:7): [True: 0, False: 3.46k]
  ------------------
 2471|      0|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2471:9): [True: 0, False: 0]
  ------------------
 2472|      0|      rc = blosc2_cbuffer_sizes(frame->coffsets, NULL, &chunk_cbytes, NULL);
 2473|      0|      if (rc < 0) {
  ------------------
  |  Branch (2473:11): [True: 0, False: 0]
  ------------------
 2474|      0|        return NULL;
 2475|      0|      }
 2476|      0|      *off_cbytes = (int32_t)chunk_cbytes;
 2477|      0|    }
 2478|      0|    return frame->coffsets;
 2479|      0|  }
 2480|  3.46k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2480:7): [True: 3.46k, False: 0]
  ------------------
 2481|  3.46k|    int64_t off_pos = header_len;
 2482|  3.46k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (2482:9): [True: 3.45k, False: 17]
  ------------------
 2483|  3.45k|      off_pos += cbytes;
 2484|  3.45k|    }
 2485|       |    // Check that there is enough room to read Blosc header
 2486|  3.46k|    if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (2486:9): [True: 0, False: 3.46k]
  |  Branch (2486:24): [True: 0, False: 3.46k]
  ------------------
 2487|  3.46k|        off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (2487:9): [True: 4, False: 3.46k]
  ------------------
 2488|      4|      BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2489|      4|      return NULL;
 2490|      4|    }
 2491|       |    // For in-memory frames, the coffset is just one pointer away
 2492|  3.46k|    uint8_t* off_start = frame->cframe + off_pos;
 2493|  3.46k|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2493:9): [True: 3.46k, False: 0]
  ------------------
 2494|  3.46k|      int32_t chunk_nbytes;
 2495|  3.46k|      int32_t chunk_blocksize;
 2496|  3.46k|      rc = blosc2_cbuffer_sizes(off_start, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 2497|  3.46k|      if (rc < 0) {
  ------------------
  |  Branch (2497:11): [True: 1, False: 3.46k]
  ------------------
 2498|      1|        return NULL;
 2499|      1|      }
 2500|  3.46k|      *off_cbytes = (int32_t)chunk_cbytes;
 2501|  3.46k|      if (*off_cbytes < 0 || off_pos + *off_cbytes > frame->len) {
  ------------------
  |  Branch (2501:11): [True: 0, False: 3.46k]
  |  Branch (2501:30): [True: 1, False: 3.46k]
  ------------------
 2502|      1|        BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2503|      1|        return NULL;
 2504|      1|      }
 2505|  3.46k|      int32_t expected_off_nbytes;
 2506|  3.46k|      if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &expected_off_nbytes)) {
  ------------------
  |  Branch (2506:11): [True: 0, False: 3.46k]
  ------------------
 2507|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2508|      0|        return NULL;
 2509|      0|      }
 2510|  3.46k|      if (chunk_nbytes != expected_off_nbytes) {
  ------------------
  |  Branch (2510:11): [True: 15, False: 3.44k]
  ------------------
 2511|     15|        BLOSC_TRACE_ERROR("The number of chunks in offset idx "
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2512|     15|                          "does not match the ones in the header frame.");
 2513|     15|        return NULL;
 2514|     15|      }
 2515|       |
 2516|  3.46k|    }
 2517|  3.44k|    return off_start;
 2518|  3.46k|  }
 2519|       |
 2520|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 2521|       |
 2522|      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 (2522:7): [True: 0, False: 0]
  |  Branch (2522:56): [True: 0, False: 0]
  ------------------
 2523|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2524|      0|    return NULL;
 2525|      0|  }
 2526|       |
 2527|      0|  int64_t coffsets_cbytes64;
 2528|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2528:7): [True: 0, False: 0]
  ------------------
 2529|      0|    coffsets_cbytes64 = trailer_offset - header_len;
 2530|      0|  }
 2531|      0|  else {
 2532|      0|    coffsets_cbytes64 = trailer_offset - (header_len + cbytes);
 2533|      0|  }
 2534|      0|  if (coffsets_cbytes64 <= 0 || coffsets_cbytes64 > INT32_MAX) {
  ------------------
  |  Branch (2534:7): [True: 0, False: 0]
  |  Branch (2534:33): [True: 0, False: 0]
  ------------------
 2535|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2536|      0|    return NULL;
 2537|      0|  }
 2538|      0|  int32_t coffsets_cbytes = (int32_t)coffsets_cbytes64;
 2539|       |
 2540|      0|  if (off_cbytes != NULL) {
  ------------------
  |  Branch (2540:7): [True: 0, False: 0]
  ------------------
 2541|      0|    *off_cbytes = coffsets_cbytes;
 2542|      0|  }
 2543|       |
 2544|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2545|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (2545:7): [True: 0, False: 0]
  ------------------
 2546|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2547|      0|    return NULL;
 2548|      0|  }
 2549|       |
 2550|      0|  void* fp = NULL;
 2551|      0|  uint8_t* coffsets;
 2552|      0|  if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2552:7): [True: 0, False: 0]
  ------------------
 2553|      0|    coffsets = malloc((size_t)coffsets_cbytes);
 2554|      0|    frame->coffsets_needs_free = true;
 2555|      0|  }
 2556|      0|  else {
 2557|      0|    frame->coffsets_needs_free = false;
 2558|      0|  }
 2559|       |
 2560|      0|  int64_t io_pos = 0;
 2561|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2561:7): [True: 0, False: 0]
  ------------------
 2562|      0|    fp = sframe_open_index(frame->urlpath, "rb",
 2563|      0|                           frame->schunk->storage->io);
 2564|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2564:9): [True: 0, False: 0]
  ------------------
 2565|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2566|      0|      return NULL;
 2567|      0|    }
 2568|      0|    io_pos = header_len + 0;
 2569|      0|  }
 2570|      0|  else {
 2571|      0|    fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2572|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2572:9): [True: 0, False: 0]
  ------------------
 2573|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2574|      0|      return NULL;
 2575|      0|    }
 2576|      0|    io_pos = frame->file_offset + header_len + cbytes;
 2577|      0|  }
 2578|      0|  int64_t rbytes = io_cb->read((void**)&coffsets, 1, coffsets_cbytes, io_pos, fp);
 2579|      0|  frame_reader_release(frame, io_cb, fp);
 2580|      0|  if (rbytes != coffsets_cbytes) {
  ------------------
  |  Branch (2580:7): [True: 0, False: 0]
  ------------------
 2581|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2582|      0|    if (frame->coffsets_needs_free)
  ------------------
  |  Branch (2582:9): [True: 0, False: 0]
  ------------------
 2583|      0|      free(coffsets);
 2584|      0|    return NULL;
 2585|      0|  }
 2586|      0|  frame->coffsets = coffsets;
 2587|      0|  return coffsets;
 2588|      0|}
frame_update_header:
 2648|    778|int frame_update_header(blosc2_frame_s* frame, blosc2_schunk* schunk, bool new) {
 2649|    778|  uint8_t* framep = frame->cframe;
 2650|    778|  uint8_t* header_ptr;
 2651|    778|  uint8_t header[FRAME_HEADER_MINLEN];
 2652|       |
 2653|    778|  if (frame->len <= 0) {
  ------------------
  |  Branch (2653:7): [True: 0, False: 778]
  ------------------
 2654|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2655|      0|  }
 2656|       |
 2657|    778|  if (new && schunk->cbytes > 0) {
  ------------------
  |  Branch (2657:7): [True: 87, False: 691]
  |  Branch (2657:14): [True: 0, False: 87]
  ------------------
 2658|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2659|      0|                      "has been appended.");
 2660|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2661|      0|  }
 2662|       |
 2663|    778|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2664|    778|  if (io_cb == NULL) {
  ------------------
  |  Branch (2664:7): [True: 0, False: 778]
  ------------------
 2665|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2666|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 2667|      0|  }
 2668|       |
 2669|    778|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (2669:7): [True: 0, False: 778]
  ------------------
 2670|      0|    int64_t rbytes = 0;
 2671|      0|    void* fp = NULL;
 2672|      0|    int64_t io_pos = 0;
 2673|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2673:9): [True: 0, False: 0]
  ------------------
 2674|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 2675|      0|                             frame->schunk->storage->io);
 2676|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2676:11): [True: 0, False: 0]
  ------------------
 2677|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2678|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2679|      0|      }
 2680|      0|    }
 2681|      0|    else {
 2682|      0|      frame_reader_revalidate(frame);
 2683|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2684|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2684:11): [True: 0, False: 0]
  ------------------
 2685|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2686|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2687|      0|      }
 2688|      0|      io_pos = frame->file_offset;
 2689|      0|    }
 2690|      0|    if (fp != NULL) {
  ------------------
  |  Branch (2690:9): [True: 0, False: 0]
  ------------------
 2691|      0|      if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (2691:11): [True: 0, False: 0]
  ------------------
 2692|      0|        header_ptr = header;
 2693|      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
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2694|      0|      frame_reader_release(frame, io_cb, fp);
 2695|      0|    }
 2696|      0|    (void) rbytes;
 2697|      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 (2697:9): [True: 0, False: 0]
  ------------------
 2698|      0|      return BLOSC2_ERROR_FILE_WRITE;
 2699|      0|    }
 2700|      0|    framep = header_ptr;
 2701|      0|  }
 2702|    778|  uint32_t prev_h2len;
 2703|    778|  from_big(&prev_h2len, framep + FRAME_HEADER_LEN, sizeof(prev_h2len));
  ------------------
  |  |   38|    778|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2704|       |
 2705|       |  // Build a new header
 2706|    778|  uint8_t* h2 = new_header_frame(schunk, frame);
 2707|    778|  if (h2 == NULL) {
  ------------------
  |  Branch (2707:7): [True: 0, False: 778]
  ------------------
 2708|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2709|      0|  }
 2710|    778|  uint32_t h2len;
 2711|    778|  from_big(&h2len, h2 + FRAME_HEADER_LEN, sizeof(h2len));
  ------------------
  |  |   38|    778|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2712|       |
 2713|       |  // The frame length is outdated when adding a new metalayer, so update it
 2714|    778|  if (new) {
  ------------------
  |  Branch (2714:7): [True: 87, False: 691]
  ------------------
 2715|     87|    int64_t frame_len = h2len;  // at adding time, we only have to worry of the header for now
 2716|     87|    to_big(h2 + FRAME_LEN, &frame_len, sizeof(frame_len));
  ------------------
  |  |   37|     87|#define to_big(dest, src, itemsize)       endian_handler(false, dest, src, itemsize)
  ------------------
 2717|     87|    frame->len = frame_len;
 2718|     87|  }
 2719|       |
 2720|    778|  if (!new && prev_h2len != h2len) {
  ------------------
  |  Branch (2720:7): [True: 691, False: 87]
  |  Branch (2720:15): [True: 0, False: 691]
  ------------------
 2721|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2722|      0|    free(h2);
 2723|      0|    return BLOSC2_ERROR_DATA;
 2724|      0|  }
 2725|       |
 2726|    778|  void* fp = NULL;
 2727|    778|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (2727:7): [True: 0, False: 778]
  ------------------
 2728|       |    // Write updated header down to file
 2729|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2729:9): [True: 0, False: 0]
  ------------------
 2730|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 2731|      0|                             frame->schunk->storage->io);
 2732|      0|    }
 2733|      0|    else {
 2734|      0|      fp = frame_writer_acquire(frame, io_cb);
 2735|      0|    }
 2736|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2736:9): [True: 0, False: 0]
  ------------------
 2737|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2738|      0|      free(h2);
 2739|      0|      return BLOSC2_ERROR_FILE_OPEN;
 2740|      0|    }
 2741|      0|    int64_t io_pos = frame->file_offset;
 2742|      0|    io_cb->write(h2, h2len, 1, io_pos, fp);
 2743|      0|    frame_writer_release(frame, io_cb, fp);
 2744|      0|  }
 2745|    778|  else {
 2746|    778|    if (new) {
  ------------------
  |  Branch (2746:9): [True: 87, False: 691]
  ------------------
 2747|     87|      void *new_cframe = realloc(frame->cframe, h2len);
 2748|     87|      if (new_cframe == NULL) {
  ------------------
  |  Branch (2748:11): [True: 0, False: 87]
  ------------------
 2749|      0|        free(h2);
 2750|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 2751|      0|      }
 2752|     87|      frame->cframe = new_cframe;
 2753|     87|    }
 2754|    778|    memcpy(frame->cframe, h2, h2len);
 2755|    778|  }
 2756|    778|  free(h2);
 2757|       |
 2758|    778|  return 1;
 2759|    778|}
frame_get_metalayers:
 2888|     90|int frame_get_metalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 2889|     90|  int32_t header_len;
 2890|     90|  int64_t frame_len;
 2891|     90|  int64_t nbytes;
 2892|     90|  int64_t cbytes;
 2893|     90|  int32_t blocksize;
 2894|     90|  int32_t chunksize;
 2895|     90|  int64_t nchunks;
 2896|     90|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 2897|     90|                            &blocksize, &chunksize, &nchunks,
 2898|     90|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 2899|     90|                            schunk->storage->io);
 2900|     90|  if (ret < 0) {
  ------------------
  |  Branch (2900:7): [True: 0, False: 90]
  ------------------
 2901|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2902|      0|    return ret;
 2903|      0|  }
 2904|       |
 2905|       |  // Get the header
 2906|     90|  uint8_t* header = NULL;
 2907|     90|  bool needs_free = false;
 2908|     90|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2908:7): [True: 90, False: 0]
  ------------------
 2909|     90|    header = frame->cframe;
 2910|     90|  } else {
 2911|      0|    int64_t rbytes = 0;
 2912|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2913|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (2913:9): [True: 0, False: 0]
  ------------------
 2914|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2915|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 2916|      0|    }
 2917|       |
 2918|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2918:9): [True: 0, False: 0]
  ------------------
 2919|      0|      header = malloc(header_len);
 2920|      0|      needs_free = true;
 2921|      0|    }
 2922|      0|    else {
 2923|      0|      needs_free = false;
 2924|      0|    }
 2925|       |
 2926|      0|    void* fp = NULL;
 2927|      0|    int64_t io_pos = 0;
 2928|      0|    if (frame->sframe) {
  ------------------
  |  Branch (2928:9): [True: 0, False: 0]
  ------------------
 2929|      0|      fp = sframe_open_index(frame->urlpath, "rb",
 2930|      0|                             frame->schunk->storage->io);
 2931|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2931:11): [True: 0, False: 0]
  ------------------
 2932|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2933|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2934|      0|      }
 2935|      0|    }
 2936|      0|    else {
 2937|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2938|      0|      if (fp == NULL) {
  ------------------
  |  Branch (2938:11): [True: 0, False: 0]
  ------------------
 2939|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2940|      0|        return BLOSC2_ERROR_FILE_OPEN;
 2941|      0|      }
 2942|      0|      io_pos = frame->file_offset;
 2943|      0|    }
 2944|      0|    if (fp != NULL) {
  ------------------
  |  Branch (2944:9): [True: 0, False: 0]
  ------------------
 2945|      0|      rbytes = io_cb->read((void**)&header, 1, header_len, io_pos, fp);
 2946|      0|      frame_reader_release(frame, io_cb, fp);
 2947|      0|    }
 2948|      0|    if (rbytes != header_len) {
  ------------------
  |  Branch (2948:9): [True: 0, False: 0]
  ------------------
 2949|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2950|      0|      if (needs_free)
  ------------------
  |  Branch (2950:11): [True: 0, False: 0]
  ------------------
 2951|      0|        free(header);
 2952|      0|      return BLOSC2_ERROR_FILE_READ;
 2953|      0|    }
 2954|      0|  }
 2955|       |
 2956|     90|  ret = get_meta_from_header(frame, schunk, header, header_len);
 2957|       |
 2958|     90|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (2958:7): [True: 0, False: 90]
  |  Branch (2958:32): [True: 0, False: 0]
  ------------------
 2959|      0|    free(header);
 2960|      0|  }
 2961|       |
 2962|     90|  return ret;
 2963|     90|}
frame_get_vlmetalayers:
 3099|     88|int frame_get_vlmetalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 3100|     88|  int32_t header_len;
 3101|     88|  int64_t frame_len;
 3102|     88|  int64_t nbytes;
 3103|     88|  int64_t cbytes;
 3104|     88|  int32_t blocksize;
 3105|     88|  int32_t chunksize;
 3106|     88|  int64_t nchunks;
 3107|     88|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3108|     88|                            &blocksize, &chunksize, &nchunks,
 3109|     88|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3110|     88|                            schunk->storage->io);
 3111|     88|  if (ret < 0) {
  ------------------
  |  Branch (3111:7): [True: 0, False: 88]
  ------------------
 3112|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3113|      0|    return ret;
 3114|      0|  }
 3115|       |
 3116|     88|  int64_t trailer_offset = get_trailer_offset(frame, header_len, nbytes > 0);
 3117|     88|  int32_t trailer_len = (int32_t) frame->trailer_len;
 3118|       |
 3119|     88|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + trailer_len > frame->len) {
  ------------------
  |  Branch (3119:7): [True: 0, False: 88]
  |  Branch (3119:56): [True: 3, False: 85]
  ------------------
 3120|      3|    BLOSC_TRACE_ERROR("Cannot access the trailer out of the frame.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3121|      3|    return BLOSC2_ERROR_READ_BUFFER;
 3122|      3|  }
 3123|       |
 3124|       |  // Get the trailer
 3125|     85|  uint8_t* trailer = NULL;
 3126|     85|  bool needs_free = false;
 3127|     85|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (3127:7): [True: 85, False: 0]
  ------------------
 3128|     85|    trailer = frame->cframe + trailer_offset;
 3129|     85|  } else {
 3130|      0|    int64_t rbytes = 0;
 3131|       |
 3132|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3133|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (3133:9): [True: 0, False: 0]
  ------------------
 3134|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3135|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 3136|      0|    }
 3137|       |
 3138|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3138:9): [True: 0, False: 0]
  ------------------
 3139|      0|      trailer = malloc(trailer_len);
 3140|      0|      needs_free = true;
 3141|      0|    }
 3142|      0|    else {
 3143|      0|      needs_free = false;
 3144|      0|    }
 3145|       |
 3146|      0|    void* fp = NULL;
 3147|      0|    int64_t io_pos = 0;
 3148|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3148:9): [True: 0, False: 0]
  ------------------
 3149|       |      // Check for overflow before calculating length
 3150|      0|      if (strlen(frame->urlpath) > SIZE_MAX - strlen("/chunks.b2frame") - 1) {
  ------------------
  |  Branch (3150:11): [True: 0, False: 0]
  ------------------
 3151|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3152|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (3152:13): [True: 0, False: 0]
  ------------------
 3153|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 3154|      0|      }
 3155|      0|      size_t _len = strlen(frame->urlpath) + strlen("/chunks.b2frame") + 1;
 3156|      0|      char* eframe_name = malloc(_len);
 3157|      0|      if (eframe_name == NULL) {
  ------------------
  |  Branch (3157:11): [True: 0, False: 0]
  ------------------
 3158|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3159|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (3159:13): [True: 0, False: 0]
  ------------------
 3160|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 3161|      0|      }
 3162|      0|      int _w = snprintf(eframe_name, _len, "%s/chunks.b2frame", frame->urlpath);
 3163|      0|      if (_w < 0 || (size_t)_w >= _len) {
  ------------------
  |  Branch (3163:11): [True: 0, False: 0]
  |  Branch (3163:21): [True: 0, False: 0]
  ------------------
 3164|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3165|      0|        free(eframe_name);
 3166|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (3166:13): [True: 0, False: 0]
  ------------------
 3167|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 3168|      0|      }
 3169|      0|      fp = io_cb->open(eframe_name, "rb", frame->schunk->storage->io->params);
 3170|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3170:11): [True: 0, False: 0]
  ------------------
 3171|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3172|      0|        free(eframe_name);
 3173|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3174|      0|      }
 3175|      0|      free(eframe_name);
 3176|      0|      io_pos = trailer_offset;
 3177|      0|    }
 3178|      0|    else {
 3179|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 3180|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3180:11): [True: 0, False: 0]
  ------------------
 3181|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3182|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3183|      0|      }
 3184|      0|      io_pos = frame->file_offset + trailer_offset;
 3185|      0|    }
 3186|      0|    if (fp != NULL) {
  ------------------
  |  Branch (3186:9): [True: 0, False: 0]
  ------------------
 3187|      0|      rbytes = io_cb->read((void**)&trailer, 1, trailer_len, io_pos, fp);
 3188|      0|      frame_reader_release(frame, io_cb, fp);
 3189|      0|    }
 3190|      0|    if (rbytes != trailer_len) {
  ------------------
  |  Branch (3190:9): [True: 0, False: 0]
  ------------------
 3191|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3192|      0|      if (needs_free)
  ------------------
  |  Branch (3192:11): [True: 0, False: 0]
  ------------------
 3193|      0|        free(trailer);
 3194|      0|      return BLOSC2_ERROR_FILE_READ;
 3195|      0|    }
 3196|      0|  }
 3197|       |
 3198|     85|  ret = get_vlmeta_from_trailer(frame, schunk, trailer, trailer_len);
 3199|       |
 3200|     85|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (3200:7): [True: 0, False: 85]
  |  Branch (3200:32): [True: 0, False: 0]
  ------------------
 3201|      0|    free(trailer);
 3202|      0|  }
 3203|       |
 3204|     85|  return ret;
 3205|     85|}
get_new_storage:
 3211|    307|                                const blosc2_io* iodefaults) {
 3212|       |
 3213|    307|  blosc2_storage* new_storage = (blosc2_storage*)calloc(1, sizeof(blosc2_storage));
 3214|    307|  memcpy(new_storage, storage, sizeof(blosc2_storage));
 3215|    307|  if (storage->urlpath != NULL) {
  ------------------
  |  Branch (3215:7): [True: 0, False: 307]
  ------------------
 3216|      0|    char* urlpath = normalize_urlpath(storage->urlpath);
 3217|      0|    new_storage->urlpath = malloc(strlen(urlpath) + 1);
 3218|      0|    strcpy(new_storage->urlpath, urlpath);
 3219|      0|  }
 3220|       |
 3221|       |  // cparams
 3222|    307|  blosc2_cparams* cparams = malloc(sizeof(blosc2_cparams));
 3223|    307|  if (storage->cparams != NULL) {
  ------------------
  |  Branch (3223:7): [True: 87, False: 220]
  ------------------
 3224|     87|    memcpy(cparams, storage->cparams, sizeof(blosc2_cparams));
 3225|    220|  } else {
 3226|    220|    memcpy(cparams, cdefaults, sizeof(blosc2_cparams));
 3227|    220|  }
 3228|    307|  new_storage->cparams = cparams;
 3229|       |
 3230|       |  // dparams
 3231|    307|  blosc2_dparams* dparams = malloc(sizeof(blosc2_dparams));
 3232|    307|  if (storage->dparams != NULL) {
  ------------------
  |  Branch (3232:7): [True: 87, False: 220]
  ------------------
 3233|     87|    memcpy(dparams, storage->dparams, sizeof(blosc2_dparams));
 3234|     87|  }
 3235|    220|  else {
 3236|    220|    memcpy(dparams, ddefaults, sizeof(blosc2_dparams));
 3237|    220|  }
 3238|    307|  new_storage->dparams = dparams;
 3239|       |
 3240|       |  // iodefaults
 3241|    307|  blosc2_io* udio = malloc(sizeof(blosc2_io));
 3242|    307|  if (storage->io != NULL) {
  ------------------
  |  Branch (3242:7): [True: 0, False: 307]
  ------------------
 3243|      0|    memcpy(udio, storage->io, sizeof(blosc2_io));
 3244|      0|  }
 3245|    307|  else {
 3246|    307|    memcpy(udio, iodefaults, sizeof(blosc2_io));
 3247|    307|  }
 3248|    307|  new_storage->io = udio;
 3249|       |
 3250|    307|  return new_storage;
 3251|    307|}
frame_to_schunk:
 3315|    235|blosc2_schunk* frame_to_schunk(blosc2_frame_s* frame, bool copy, const blosc2_io *udio) {
 3316|    235|  int32_t header_len;
 3317|    235|  int64_t frame_len;
 3318|    235|  int rc;
 3319|    235|  bool frame_attached = true;
 3320|    235|  blosc2_schunk* schunk = calloc(1, sizeof(blosc2_schunk));
 3321|    235|  blosc2_cparams *cparams = NULL;
 3322|    235|  blosc2_dparams *dparams = NULL;
 3323|    235|  int64_t *offsets = NULL;
 3324|    235|  if (schunk == NULL) {
  ------------------
  |  Branch (3324:7): [True: 0, False: 235]
  ------------------
 3325|      0|    return NULL;
 3326|      0|  }
 3327|    235|  schunk->frame = (blosc2_frame*)frame;
 3328|    235|  frame->schunk = schunk;
 3329|       |
 3330|    235|  rc = get_header_info(frame, &header_len, &frame_len, &schunk->nbytes,
 3331|    235|                       &schunk->cbytes, &schunk->blocksize,
 3332|    235|                       &schunk->chunksize, &schunk->nchunks, &schunk->typesize,
 3333|    235|                       &schunk->compcode, &schunk->compcode_meta, &schunk->clevel, schunk->filters,
 3334|    235|                       schunk->filters_meta, &schunk->splitmode, &schunk->use_dict, udio);
 3335|    235|  if (rc < 0) {
  ------------------
  |  Branch (3335:7): [True: 14, False: 221]
  ------------------
 3336|     14|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|     14|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     14|    do {                                            \
  |  |  |  |   98|     14|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     14|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 14, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     14|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3337|     14|    goto error;
 3338|     14|  }
 3339|    221|  int64_t nchunks = schunk->nchunks;
 3340|    221|  int64_t nbytes = schunk->nbytes;
 3341|    221|  (void) nbytes;
 3342|    221|  int64_t cbytes = schunk->cbytes;
 3343|       |
 3344|       |  // Compression and decompression contexts
 3345|    221|  blosc2_schunk_get_cparams(schunk, &cparams);
 3346|    221|  schunk->cctx = blosc2_create_cctx(*cparams);
 3347|    221|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (3347:7): [True: 1, False: 220]
  ------------------
 3348|      1|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3349|      1|    goto error;
 3350|      1|  }
 3351|    220|  blosc2_schunk_get_dparams(schunk, &dparams);
 3352|    220|  schunk->dctx = blosc2_create_dctx(*dparams);
 3353|    220|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (3353:7): [True: 0, False: 220]
  ------------------
 3354|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3355|      0|    goto error;
 3356|      0|  }
 3357|    220|  blosc2_storage storage = {.contiguous = copy ? false : true};
  ------------------
  |  Branch (3357:43): [True: 0, False: 220]
  ------------------
 3358|    220|  schunk->storage = get_new_storage(&storage, cparams, dparams, udio);
 3359|    220|  free(cparams);
 3360|    220|  cparams = NULL;
 3361|    220|  free(dparams);
 3362|    220|  dparams = NULL;
 3363|    220|  if (nchunks > 0) {
  ------------------
  |  Branch (3363:7): [True: 215, False: 5]
  ------------------
 3364|    215|    rc = validate_offsets_chunk(frame, header_len, cbytes, nchunks);
 3365|    215|    if (rc < 0) {
  ------------------
  |  Branch (3365:9): [True: 123, False: 92]
  ------------------
 3366|    123|      BLOSC_TRACE_ERROR("Cannot validate frame offsets.");
  ------------------
  |  |   93|    123|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    123|    do {                                            \
  |  |  |  |   98|    123|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    123|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 123, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    123|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3367|    123|      goto error;
 3368|    123|    }
 3369|    215|  }
 3370|     97|  if (nchunks > 0) {
  ------------------
  |  Branch (3370:7): [True: 92, False: 5]
  ------------------
 3371|     92|    uint8_t *chunk;
 3372|     92|    bool needs_free;
 3373|       |    // A lazy chunk is enough here: only the header is needed for the flags2 byte
 3374|     92|    rc = frame_get_lazychunk(frame, 0, &chunk, &needs_free);
 3375|     92|    if (rc < 0) {
  ------------------
  |  Branch (3375:9): [True: 7, False: 85]
  ------------------
 3376|      7|      BLOSC_TRACE_ERROR("Cannot inspect the first chunk in frame.");
  ------------------
  |  |   93|      7|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      7|    do {                                            \
  |  |  |  |   98|      7|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      7|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 7, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      7|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3377|      7|      goto error;
 3378|      7|    }
 3379|     85|    schunk->flags2 = (rc >= BLOSC_EXTENDED_HEADER_LENGTH) ? chunk[BLOSC2_CHUNK_BLOSC2_FLAGS2] : 0;
  ------------------
  |  Branch (3379:22): [True: 85, False: 0]
  ------------------
 3380|     85|    if (needs_free) {
  ------------------
  |  Branch (3380:9): [True: 0, False: 85]
  ------------------
 3381|      0|      free(chunk);
 3382|      0|    }
 3383|     85|  }
 3384|     90|  if (!copy) {
  ------------------
  |  Branch (3384:7): [True: 90, False: 0]
  ------------------
 3385|     90|    goto out;
 3386|     90|  }
 3387|       |
 3388|       |  // We are not attached to a frame anymore
 3389|      0|  schunk->frame = NULL;
 3390|      0|  frame_attached = false;
 3391|       |
 3392|      0|  if (nchunks == 0) {
  ------------------
  |  Branch (3392:7): [True: 0, False: 0]
  ------------------
 3393|      0|    frame->schunk = NULL;
 3394|      0|    goto out;
 3395|      0|  }
 3396|       |
 3397|       |  // Get the compressed offsets
 3398|      0|  int32_t coffsets_cbytes = 0;
 3399|      0|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 3400|      0|  if (coffsets == NULL) {
  ------------------
  |  Branch (3400:7): [True: 0, False: 0]
  ------------------
 3401|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3402|      0|    goto error;
 3403|      0|  }
 3404|       |
 3405|       |  // Decompress offsets
 3406|      0|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 3407|      0|  blosc2_context *dctx = blosc2_create_dctx(off_dparams);
 3408|      0|  if (dctx == NULL) {
  ------------------
  |  Branch (3408:7): [True: 0, False: 0]
  ------------------
 3409|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3410|      0|    goto error;
 3411|      0|  }
 3412|      0|  int32_t offsets_nbytes;
 3413|      0|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (3413:7): [True: 0, False: 0]
  ------------------
 3414|      0|    blosc2_free_ctx(dctx);
 3415|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3416|      0|    goto error;
 3417|      0|  }
 3418|      0|  offsets = (int64_t *) malloc((size_t)offsets_nbytes);
 3419|      0|  if (offsets == NULL) {
  ------------------
  |  Branch (3419:7): [True: 0, False: 0]
  ------------------
 3420|      0|    blosc2_free_ctx(dctx);
 3421|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3422|      0|    goto error;
 3423|      0|  }
 3424|      0|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 3425|      0|                                             offsets, offsets_nbytes);
 3426|      0|  blosc2_free_ctx(dctx);
 3427|      0|  if (off_nbytes < 0) {
  ------------------
  |  Branch (3427:7): [True: 0, False: 0]
  ------------------
 3428|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3429|      0|    goto error;
 3430|      0|  }
 3431|       |
 3432|       |  // We want the contiguous schunk, so create the actual data chunks (and, while doing this,
 3433|       |  // get a guess at the blocksize used in this frame)
 3434|      0|  int64_t acc_nbytes = 0;
 3435|      0|  int64_t acc_cbytes = 0;
 3436|      0|  int32_t blocksize = 0;
 3437|      0|  int32_t chunk_nbytes;
 3438|      0|  int32_t chunk_cbytes;
 3439|      0|  int32_t chunk_blocksize;
 3440|      0|  size_t prev_alloc = BLOSC_EXTENDED_HEADER_LENGTH;
 3441|      0|  uint8_t* data_chunk = NULL;
 3442|      0|  bool needs_free = false;
 3443|      0|  const blosc2_io_cb *io_cb = blosc2_get_io_cb(udio->id);
 3444|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (3444:7): [True: 0, False: 0]
  ------------------
 3445|      0|    blosc2_schunk_free(schunk);
 3446|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3447|      0|    return NULL;
 3448|      0|  }
 3449|       |
 3450|      0|  void* fp = NULL;
 3451|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3451:7): [True: 0, False: 0]
  ------------------
 3452|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3452:9): [True: 0, False: 0]
  ------------------
 3453|      0|      data_chunk = malloc((size_t)prev_alloc);
 3454|      0|      needs_free = true;
 3455|      0|    }
 3456|      0|    else {
 3457|      0|      needs_free = false;
 3458|      0|    }
 3459|       |
 3460|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3460:9): [True: 0, False: 0]
  ------------------
 3461|       |      // If not the chunks won't be in the frame
 3462|      0|      fp = frame_reader_acquire(frame, udio);
 3463|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3463:11): [True: 0, False: 0]
  ------------------
 3464|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3465|      0|        rc = BLOSC2_ERROR_FILE_OPEN;
 3466|      0|        goto end;
 3467|      0|      }
 3468|      0|    }
 3469|      0|  }
 3470|       |  /* calloc(): the loop below can stop at a bad chunk, and the error path frees
 3471|       |     every data[i] with i < nchunks, also the ones never set */
 3472|      0|  schunk->data = calloc(nchunks, sizeof(void*));
 3473|      0|  if (schunk->data == NULL && nchunks > 0) {
  ------------------
  |  Branch (3473:7): [True: 0, False: 0]
  |  Branch (3473:31): [True: 0, False: 0]
  ------------------
 3474|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3475|      0|    rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3476|      0|    goto end;
 3477|      0|  }
 3478|      0|  for (int64_t i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (3478:23): [True: 0, False: 0]
  ------------------
 3479|      0|    if (frame->cframe != NULL) {
  ------------------
  |  Branch (3479:9): [True: 0, False: 0]
  ------------------
 3480|      0|      if (needs_free) {
  ------------------
  |  Branch (3480:11): [True: 0, False: 0]
  ------------------
 3481|      0|        free(data_chunk);
 3482|      0|      }
 3483|      0|      if (offsets[i] < 0) {
  ------------------
  |  Branch (3483:11): [True: 0, False: 0]
  ------------------
 3484|      0|        int64_t rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3485|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3485:13): [True: 0, False: 0]
  ------------------
 3486|      0|          break;
 3487|      0|        }
 3488|      0|      }
 3489|      0|      else {
 3490|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3490:13): [True: 0, False: 0]
  ------------------
 3491|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3491:13): [True: 0, False: 0]
  ------------------
 3492|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3492:13): [True: 0, False: 0]
  ------------------
 3493|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3494|      0|          break;
 3495|      0|        }
 3496|      0|        data_chunk = frame->cframe + header_len + offsets[i];
 3497|      0|        needs_free = false;
 3498|      0|      }
 3499|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3500|      0|      if (rc < 0) {
  ------------------
  |  Branch (3500:11): [True: 0, False: 0]
  ------------------
 3501|      0|        break;
 3502|      0|      }
 3503|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3503:11): [True: 0, False: 0]
  ------------------
 3504|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3504:12): [True: 0, False: 0]
  ------------------
 3505|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3505:12): [True: 0, False: 0]
  ------------------
 3506|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3506:12): [True: 0, False: 0]
  ------------------
 3507|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3508|      0|        break;
 3509|      0|      }
 3510|      0|    }
 3511|      0|    else {
 3512|      0|      int64_t rbytes;
 3513|      0|      if (offsets[i] < 0 || frame->sframe) {
  ------------------
  |  Branch (3513:11): [True: 0, False: 0]
  |  Branch (3513:29): [True: 0, False: 0]
  ------------------
 3514|      0|        if (needs_free) {
  ------------------
  |  Branch (3514:13): [True: 0, False: 0]
  ------------------
 3515|      0|          free(data_chunk);
 3516|      0|        }
 3517|      0|        rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3518|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3518:13): [True: 0, False: 0]
  ------------------
 3519|      0|          break;
 3520|      0|        }
 3521|      0|      }
 3522|      0|      else {
 3523|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3523:13): [True: 0, False: 0]
  ------------------
 3524|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3524:13): [True: 0, False: 0]
  ------------------
 3525|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3525:13): [True: 0, False: 0]
  ------------------
 3526|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3527|      0|          break;
 3528|      0|        }
 3529|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3530|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 3531|      0|      }
 3532|      0|      if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3532:11): [True: 0, False: 0]
  ------------------
 3533|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 3534|      0|        break;
 3535|      0|      }
 3536|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3537|      0|      if (rc < 0) {
  ------------------
  |  Branch (3537:11): [True: 0, False: 0]
  ------------------
 3538|      0|        break;
 3539|      0|      }
 3540|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3540:11): [True: 0, False: 0]
  ------------------
 3541|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3541:12): [True: 0, False: 0]
  ------------------
 3542|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3542:12): [True: 0, False: 0]
  ------------------
 3543|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3543:12): [True: 0, False: 0]
  ------------------
 3544|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3545|      0|        break;
 3546|      0|      }
 3547|      0|      if (chunk_cbytes > (int32_t)prev_alloc) {
  ------------------
  |  Branch (3547:11): [True: 0, False: 0]
  ------------------
 3548|      0|        if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (3548:13): [True: 0, False: 0]
  ------------------
 3549|      0|          data_chunk = realloc(data_chunk, chunk_cbytes);
 3550|      0|        if (data_chunk == NULL) {
  ------------------
  |  Branch (3550:13): [True: 0, False: 0]
  ------------------
 3551|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3552|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3553|      0|          break;
 3554|      0|        }
 3555|      0|        prev_alloc = chunk_cbytes;
 3556|      0|      }
 3557|      0|      if (!frame->sframe) {
  ------------------
  |  Branch (3557:11): [True: 0, False: 0]
  ------------------
 3558|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3559|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, chunk_cbytes, io_pos, fp);
 3560|      0|        if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (3560:13): [True: 0, False: 0]
  ------------------
 3561|      0|          rc = BLOSC2_ERROR_READ_BUFFER;
 3562|      0|          break;
 3563|      0|        }
 3564|      0|      }
 3565|      0|    }
 3566|      0|    uint8_t* new_chunk = malloc(chunk_cbytes);
 3567|      0|    memcpy(new_chunk, data_chunk, chunk_cbytes);
 3568|      0|    schunk->data[i] = new_chunk;
 3569|      0|    rc = blosc2_cbuffer_sizes(data_chunk, &chunk_nbytes, NULL, &chunk_blocksize);
 3570|      0|    if (rc < 0) {
  ------------------
  |  Branch (3570:9): [True: 0, False: 0]
  ------------------
 3571|      0|      break;
 3572|      0|    }
 3573|      0|    acc_nbytes += chunk_nbytes;
 3574|      0|    acc_cbytes += chunk_cbytes;
 3575|      0|    if (i == 0) {
  ------------------
  |  Branch (3575:9): [True: 0, False: 0]
  ------------------
 3576|      0|      blocksize = chunk_blocksize;
 3577|      0|    }
 3578|      0|    else if (blocksize != chunk_blocksize) {
  ------------------
  |  Branch (3578:14): [True: 0, False: 0]
  ------------------
 3579|       |      // Blocksize varies
 3580|      0|      blocksize = 0;
 3581|      0|    }
 3582|      0|  }
 3583|       |
 3584|       |  // We are not attached to a schunk anymore
 3585|      0|  frame->schunk = NULL;
 3586|       |
 3587|      0|  end:
 3588|      0|  if (needs_free) {
  ------------------
  |  Branch (3588:7): [True: 0, False: 0]
  ------------------
 3589|      0|    free(data_chunk);
 3590|      0|  }
 3591|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3591:7): [True: 0, False: 0]
  ------------------
 3592|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3592:9): [True: 0, False: 0]
  ------------------
 3593|      0|      frame_reader_release(frame, io_cb, fp);
 3594|      0|    }
 3595|      0|  }
 3596|      0|  free(offsets);
 3597|       |  // Avoid a double-free in the `error:` cleanup below, which is reached
 3598|       |  // when frame_get_metalayers / frame_get_vlmetalayers reject a malformed
 3599|       |  // metalayer index after we've already freed `offsets` here.
 3600|      0|  offsets = NULL;
 3601|       |
 3602|       |  // cframes and sframes have different ways to store chunks with special values:
 3603|       |  // 1) cframes represent special chunks as negative offsets
 3604|       |  // 2) sframes does not have the concept of offsets, but rather of data pointers (.data)
 3605|       |  //    so they always have a pointer to a special chunk
 3606|       |  // This is why cframes and sframes have different cbytes and hence, we cannot enforce acc_bytes == schunk->cbytes
 3607|       |  // In the future, maybe we could provide special meanings for .data[i] > 0x7FFFFFFF, but not there yet
 3608|       |  // if (rc < 0 || acc_nbytes != nbytes || acc_cbytes != cbytes) {
 3609|      0|  if (rc < 0 || acc_nbytes != nbytes) {
  ------------------
  |  Branch (3609:7): [True: 0, False: 0]
  |  Branch (3609:17): [True: 0, False: 0]
  ------------------
 3610|      0|    goto error;
 3611|      0|  }
 3612|       |  // Update counters
 3613|      0|  schunk->cbytes = acc_cbytes;
 3614|      0|  schunk->blocksize = blocksize;
 3615|       |
 3616|     90|  out:
 3617|     90|  rc = frame_get_metalayers(frame, schunk);
 3618|     90|  if (rc < 0) {
  ------------------
  |  Branch (3618:7): [True: 2, False: 88]
  ------------------
 3619|      2|    BLOSC_TRACE_ERROR("Cannot access the metalayers.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3620|      2|    goto error;
 3621|      2|  }
 3622|       |
 3623|     88|  rc = frame_get_vlmetalayers(frame, schunk);
 3624|     88|  if (rc < 0) {
  ------------------
  |  Branch (3624:7): [True: 3, False: 85]
  ------------------
 3625|      3|    BLOSC_TRACE_ERROR("Cannot access the vlmetalayers.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3626|      3|    goto error;
 3627|      3|  }
 3628|       |
 3629|     85|  return schunk;
 3630|       |
 3631|    150|error:
 3632|    150|  free(cparams);
 3633|    150|  free(dparams);
 3634|    150|  free(offsets);
 3635|    150|  if (schunk != NULL) {
  ------------------
  |  Branch (3635:7): [True: 150, False: 0]
  ------------------
 3636|    150|    blosc2_schunk_free(schunk);
 3637|    150|  }
 3638|    150|  if (!frame_attached) {
  ------------------
  |  Branch (3638:7): [True: 0, False: 150]
  ------------------
 3639|      0|    frame->schunk = NULL;
 3640|      0|    frame_free(frame);
 3641|      0|  }
 3642|       |  return NULL;
 3643|     88|}
get_coffset:
 3665|  2.47k|                int64_t nchunk, int64_t nchunks, int64_t *offset) {
 3666|  2.47k|  int32_t off_cbytes;
 3667|       |  // Get the offset to nchunk
 3668|  2.47k|  uint8_t *coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &off_cbytes);
 3669|  2.47k|  if (coffsets == NULL) {
  ------------------
  |  Branch (3669:7): [True: 0, False: 2.47k]
  ------------------
 3670|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3671|      0|    return BLOSC2_ERROR_DATA;
 3672|      0|  }
 3673|       |
 3674|       |  // Get the 64-bit offset
 3675|  2.47k|  int rc = blosc2_getitem(coffsets, off_cbytes, (int32_t)nchunk, 1, offset, (int32_t)sizeof(int64_t));
 3676|  2.47k|  if (rc < 0) {
  ------------------
  |  Branch (3676:7): [True: 2, False: 2.47k]
  ------------------
 3677|      2|    BLOSC_TRACE_ERROR("Problems retrieving a chunk offset.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3678|  2.47k|  } else if (!frame->sframe && *offset >= 0) {
  ------------------
  |  Branch (3678:14): [True: 2.47k, False: 0]
  |  Branch (3678:32): [True: 1.81k, False: 664]
  ------------------
 3679|  1.81k|    if (cbytes < 0 || cbytes > INT64_MAX - header_len) {
  ------------------
  |  Branch (3679:9): [True: 0, False: 1.81k]
  |  Branch (3679:23): [True: 0, False: 1.81k]
  ------------------
 3680|      0|      BLOSC_TRACE_ERROR("Invalid compressed 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3681|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3682|      0|    }
 3683|  1.81k|    if (*offset > INT64_MAX - header_len) {
  ------------------
  |  Branch (3683:9): [True: 0, False: 1.81k]
  ------------------
 3684|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3685|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3686|      0|    }
 3687|  1.81k|    int64_t chunk_pos = header_len + *offset;
 3688|  1.81k|    int64_t data_limit = header_len + cbytes;
 3689|  1.81k|    if (chunk_pos < header_len ||
  ------------------
  |  Branch (3689:9): [True: 0, False: 1.81k]
  ------------------
 3690|  1.81k|        chunk_pos > data_limit - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3690:9): [True: 0, False: 1.81k]
  ------------------
 3691|  1.81k|        chunk_pos > frame->len - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3691:9): [True: 0, False: 1.81k]
  ------------------
 3692|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3693|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3694|      0|    }
 3695|  1.81k|  }
 3696|       |
 3697|  2.47k|  return rc;
 3698|  2.47k|}
frame_get_chunks_special:
 3769|    170|int frame_get_chunks_special(blosc2_frame_s *frame, const int64_t *nchunks, int64_t n, uint8_t *special) {
 3770|    170|  int64_t *off;
 3771|    170|  int64_t lo;
 3772|    170|  int64_t span_end;
 3773|    170|  int32_t header_len;
 3774|    170|  int64_t cbytes;
 3775|    170|  int32_t chunksize;
 3776|    170|  int rc = frame_read_index_span(frame, nchunks, n, 0, &off, &lo, &span_end, &header_len, &cbytes, &chunksize);
 3777|    170|  if (rc < 0 || off == NULL) {
  ------------------
  |  Branch (3777:7): [True: 0, False: 170]
  |  Branch (3777:17): [True: 0, False: 170]
  ------------------
 3778|      0|    return rc;
 3779|      0|  }
 3780|  1.37k|  for (int64_t k = 0; k < n; ++k) {
  ------------------
  |  Branch (3780:23): [True: 1.20k, False: 170]
  ------------------
 3781|  1.20k|    int64_t offset = off[nchunks[k] - lo];
 3782|  1.20k|    special[k] = offset < 0 ? (uint8_t) (((uint64_t) offset >> (8 * 7)) & BLOSC2_SPECIAL_MASK) : 0;
  ------------------
  |  Branch (3782:18): [True: 0, False: 1.20k]
  ------------------
 3783|  1.20k|  }
 3784|    170|  free(off);
 3785|    170|  return BLOSC2_ERROR_SUCCESS;
 3786|    170|}
frame_get_lazychunk:
 4090|     92|int frame_get_lazychunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 4091|     92|  int32_t header_len;
 4092|     92|  int64_t frame_len;
 4093|     92|  int64_t nbytes;
 4094|     92|  int64_t cbytes;
 4095|     92|  int32_t blocksize;
 4096|     92|  int32_t chunksize;
 4097|     92|  int64_t nchunks;
 4098|     92|  int32_t typesize;
 4099|     92|  int32_t lazychunk_cbytes;
 4100|     92|  int64_t offset;
 4101|     92|  void* fp = NULL;
 4102|     92|  int32_t* block_csizes = NULL;
 4103|     92|  struct csize_idx *csize_idx = NULL;
 4104|       |
 4105|     92|  *chunk = NULL;
 4106|     92|  *needs_free = false;
 4107|     92|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 4108|     92|                           &blocksize, &chunksize, &nchunks,
 4109|     92|                           &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 4110|     92|                           frame->schunk->storage->io);
 4111|     92|  if (rc < 0) {
  ------------------
  |  Branch (4111:7): [True: 0, False: 92]
  ------------------
 4112|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4113|      0|    return rc;
 4114|      0|  }
 4115|     92|  rc = frame_refresh_if_stale(frame, frame_len);
 4116|     92|  if (rc < 0) {
  ------------------
  |  Branch (4116:7): [True: 0, False: 92]
  ------------------
 4117|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4118|      0|    return rc;
 4119|      0|  }
 4120|     92|  if (rc > 0) {
  ------------------
  |  Branch (4120:7): [True: 0, False: 92]
  ------------------
 4121|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state
 4122|       |    // (see frame_get_chunk).
 4123|      0|    frame->schunk->nbytes = nbytes;
 4124|      0|    frame->schunk->cbytes = cbytes;
 4125|      0|    frame->schunk->nchunks = nchunks;
 4126|      0|  }
 4127|       |
 4128|     92|  if (nchunk >= nchunks) {
  ------------------
  |  Branch (4128:7): [True: 0, False: 92]
  ------------------
 4129|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4130|      0|                      "('%" PRId64 "') in frame.", nchunk, nchunks);
 4131|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4132|      0|  }
 4133|       |
 4134|       |  // Get the offset to nchunk
 4135|     92|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 4136|     92|  if (rc < 0) {
  ------------------
  |  Branch (4136:7): [True: 2, False: 90]
  ------------------
 4137|      2|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4138|      2|    return rc;
 4139|      2|  }
 4140|       |
 4141|     90|  if (offset < 0) {
  ------------------
  |  Branch (4141:7): [True: 5, False: 85]
  ------------------
 4142|       |    // Special value
 4143|      5|    if (chunksize <= 0) {
  ------------------
  |  Branch (4143:9): [True: 5, False: 0]
  ------------------
 4144|      5|      BLOSC_TRACE_ERROR("Cannot synthesize special chunk with chunksize <= 0.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4145|      5|      return BLOSC2_ERROR_INVALID_HEADER;
 4146|      5|    }
 4147|      0|    lazychunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 4148|      0|    int32_t chunksize_ = chunksize;
 4149|      0|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (4149:9): [True: 0, False: 0]
  |  Branch (4149:36): [True: 0, False: 0]
  ------------------
 4150|       |      // Last chunk is incomplete.  Compute its actual size.
 4151|      0|      chunksize_ = (int32_t) (nbytes % chunksize);
 4152|      0|    }
 4153|      0|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk,
 4154|      0|                             (int32_t)lazychunk_cbytes, needs_free);
 4155|      0|    goto end;
 4156|      5|  }
 4157|       |
 4158|     85|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 4159|     85|  if (io_cb == NULL) {
  ------------------
  |  Branch (4159:7): [True: 0, False: 85]
  ------------------
 4160|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4161|      0|    rc = BLOSC2_ERROR_PLUGIN_IO;
 4162|      0|    goto end;
 4163|      0|  }
 4164|       |
 4165|     85|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (4165:7): [True: 0, False: 85]
  ------------------
 4166|       |    // TODO: make this portable across different endianness
 4167|       |    // Get info for building a lazy chunk
 4168|      0|    int32_t chunk_nbytes;
 4169|      0|    int32_t chunk_cbytes;
 4170|      0|    int32_t chunk_blocksize;
 4171|      0|    uint8_t* header_ptr;
 4172|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 4173|      0|    int64_t io_pos = 0;
 4174|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4174:9): [True: 0, False: 0]
  ------------------
 4175|       |      // The chunk is not in the frame
 4176|      0|      fp = sframe_open_chunk(frame->urlpath, offset, "rb",
 4177|      0|                             frame->schunk->storage->io);
 4178|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4178:11): [True: 0, False: 0]
  ------------------
 4179|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4180|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4181|      0|      }
 4182|      0|    }
 4183|      0|    else {
 4184|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 4185|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4185:11): [True: 0, False: 0]
  ------------------
 4186|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4187|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4188|      0|      }
 4189|      0|      io_pos = frame->file_offset + header_len + offset;
 4190|      0|    }
 4191|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (4191:9): [True: 0, False: 0]
  ------------------
 4192|      0|      header_ptr = header;
 4193|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 4194|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4194:9): [True: 0, False: 0]
  ------------------
 4195|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4196|      0|      rc = BLOSC2_ERROR_FILE_READ;
 4197|      0|      goto end;
 4198|      0|    }
 4199|      0|    rc = blosc2_cbuffer_sizes(header_ptr, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 4200|      0|    if (rc < 0) {
  ------------------
  |  Branch (4200:9): [True: 0, False: 0]
  ------------------
 4201|      0|      goto end;
 4202|      0|    }
 4203|      0|    if (chunk_nbytes < 0 || chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH || chunk_blocksize <= 0) {
  ------------------
  |  Branch (4203:9): [True: 0, False: 0]
  |  Branch (4203:29): [True: 0, False: 0]
  |  Branch (4203:76): [True: 0, False: 0]
  ------------------
 4204|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4205|      0|      goto end;
 4206|      0|    }
 4207|      0|    bool vlblocks = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS2] & BLOSC2_VL_BLOCKS) != 0;
 4208|      0|    size_t nblocks;
 4209|      0|    size_t leftover_block = 0;
 4210|      0|    if (vlblocks) {
  ------------------
  |  Branch (4210:9): [True: 0, False: 0]
  ------------------
 4211|      0|      nblocks = (size_t)chunk_blocksize;
 4212|      0|    }
 4213|      0|    else {
 4214|      0|      nblocks = (size_t)chunk_nbytes / (size_t)chunk_blocksize;
 4215|      0|      leftover_block = (size_t)chunk_nbytes % (size_t)chunk_blocksize;
 4216|      0|      if (leftover_block) {
  ------------------
  |  Branch (4216:11): [True: 0, False: 0]
  ------------------
 4217|      0|        if (nblocks == SIZE_MAX) {
  ------------------
  |  Branch (4217:13): [True: 0, False: 0]
  ------------------
 4218|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4219|      0|          goto end;
 4220|      0|        }
 4221|      0|        nblocks += 1;
 4222|      0|      }
 4223|      0|    }
 4224|      0|    if (nblocks == 0 || nblocks > (size_t)INT_MAX) {
  ------------------
  |  Branch (4224:9): [True: 0, False: 0]
  |  Branch (4224:25): [True: 0, False: 0]
  ------------------
 4225|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4226|      0|      goto end;
 4227|      0|    }
 4228|       |    // Allocate space for the lazy chunk
 4229|      0|    int32_t special_type = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
 4230|      0|    int memcpyed = header_ptr[BLOSC2_CHUNK_FLAGS] & (uint8_t) BLOSC_MEMCPYED;
 4231|       |
 4232|      0|    int32_t trailer_offset;
 4233|      0|    size_t streams_offset = BLOSC_EXTENDED_HEADER_LENGTH;
 4234|      0|    size_t trailer_offset_sz = BLOSC_EXTENDED_HEADER_LENGTH;
 4235|      0|    size_t trailer_len_sz = 0;
 4236|      0|    size_t lazychunk_cbytes_sz = 0;
 4237|      0|    size_t bstarts_nbytes = 0;
 4238|      0|    if (special_type == 0) {
  ------------------
  |  Branch (4238:9): [True: 0, False: 0]
  ------------------
 4239|      0|      if (nblocks > SIZE_MAX / sizeof(int32_t)) {
  ------------------
  |  Branch (4239:11): [True: 0, False: 0]
  ------------------
 4240|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4241|      0|        goto end;
 4242|      0|      }
 4243|      0|      bstarts_nbytes = nblocks * sizeof(int32_t);
 4244|       |
 4245|      0|      if (!memcpyed) {
  ------------------
  |  Branch (4245:11): [True: 0, False: 0]
  ------------------
 4246|      0|        if ((size_t)chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4246:13): [True: 0, False: 0]
  ------------------
 4247|      0|            bstarts_nbytes > (size_t)chunk_cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4247:13): [True: 0, False: 0]
  ------------------
 4248|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4249|      0|          goto end;
 4250|      0|        }
 4251|      0|      }
 4252|       |
 4253|      0|      if (bstarts_nbytes > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (4253:11): [True: 0, False: 0]
  ------------------
 4254|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4255|      0|        goto end;
 4256|      0|      }
 4257|      0|      trailer_offset_sz += bstarts_nbytes;
 4258|       |      // Regular values have offsets for blocks
 4259|      0|      if (!memcpyed) {
  ------------------
  |  Branch (4259:11): [True: 0, False: 0]
  ------------------
 4260|      0|        if (bstarts_nbytes > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (4260:13): [True: 0, False: 0]
  ------------------
 4261|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4262|      0|          goto end;
 4263|      0|        }
 4264|      0|        streams_offset += bstarts_nbytes;
 4265|      0|      }
 4266|       |
 4267|      0|      if (bstarts_nbytes > SIZE_MAX - (sizeof(int32_t) + sizeof(int64_t))) {
  ------------------
  |  Branch (4267:11): [True: 0, False: 0]
  ------------------
 4268|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4269|      0|        goto end;
 4270|      0|      }
 4271|      0|      trailer_len_sz = sizeof(int32_t) + sizeof(int64_t) + bstarts_nbytes;
 4272|      0|      if (trailer_len_sz > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (4272:11): [True: 0, False: 0]
  ------------------
 4273|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4274|      0|        goto end;
 4275|      0|      }
 4276|      0|      lazychunk_cbytes_sz = trailer_offset_sz + trailer_len_sz;
 4277|      0|    }
 4278|      0|    else if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (4278:14): [True: 0, False: 0]
  ------------------
 4279|      0|      if (typesize <= 0) {
  ------------------
  |  Branch (4279:11): [True: 0, False: 0]
  ------------------
 4280|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4281|      0|        goto end;
 4282|      0|      }
 4283|      0|      if ((size_t)typesize > SIZE_MAX - trailer_offset_sz ||
  ------------------
  |  Branch (4283:11): [True: 0, False: 0]
  ------------------
 4284|      0|          (size_t)typesize > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (4284:11): [True: 0, False: 0]
  ------------------
 4285|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4286|      0|        goto end;
 4287|      0|      }
 4288|      0|      trailer_offset_sz += (size_t)typesize;
 4289|      0|      streams_offset += (size_t)typesize;
 4290|      0|      lazychunk_cbytes_sz = trailer_offset_sz;
 4291|      0|    }
 4292|      0|    else {
 4293|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4294|      0|      goto end;
 4295|      0|    }
 4296|       |
 4297|      0|    if (streams_offset > (size_t)chunk_cbytes ||
  ------------------
  |  Branch (4297:9): [True: 0, False: 0]
  ------------------
 4298|      0|        trailer_offset_sz > INT32_MAX ||
  ------------------
  |  Branch (4298:9): [True: 0, False: 0]
  ------------------
 4299|      0|        trailer_len_sz > INT32_MAX ||
  ------------------
  |  Branch (4299:9): [True: 0, False: 0]
  ------------------
 4300|      0|        lazychunk_cbytes_sz > INT32_MAX) {
  ------------------
  |  Branch (4300:9): [True: 0, False: 0]
  ------------------
 4301|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4302|      0|      goto end;
 4303|      0|    }
 4304|       |
 4305|      0|    trailer_offset = (int32_t)trailer_offset_sz;
 4306|      0|    lazychunk_cbytes = (int32_t)lazychunk_cbytes_sz;
 4307|       |
 4308|       |    // Read just the full header and bstarts section too (lazy partial length)
 4309|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4309:9): [True: 0, False: 0]
  ------------------
 4310|      0|      io_pos = 0;
 4311|      0|    }
 4312|      0|    else {
 4313|      0|      io_pos = frame->file_offset + header_len + offset;
 4314|      0|    }
 4315|       |
 4316|       |    // The case here is a bit special because more memory is allocated than read from the file
 4317|       |    // and the chunk is modified after reading. Due to the modification, we cannot directly use
 4318|       |    // the memory provided by the io
 4319|      0|    *chunk = malloc((size_t)lazychunk_cbytes);
 4320|      0|    if (*chunk == NULL) {
  ------------------
  |  Branch (4320:9): [True: 0, False: 0]
  ------------------
 4321|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 4322|      0|      goto end;
 4323|      0|    }
 4324|      0|    *needs_free = true;
 4325|       |
 4326|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (4326:9): [True: 0, False: 0]
  ------------------
 4327|      0|      rbytes = io_cb->read((void**)chunk, 1, (int64_t)streams_offset, io_pos, fp);
 4328|      0|    }
 4329|      0|    else {
 4330|       |      // The io hands out its own memory (mmap) and none at all for a read past
 4331|       |      // its end, which a damaged offset or header asks for: copy only after a
 4332|       |      // complete read
 4333|      0|      uint8_t* chunk_ptr = NULL;
 4334|      0|      rbytes = io_cb->read((void**)&chunk_ptr, 1, (int64_t)streams_offset, io_pos, fp);
 4335|      0|      if (rbytes == (int64_t)streams_offset && chunk_ptr != NULL) {
  ------------------
  |  Branch (4335:11): [True: 0, False: 0]
  |  Branch (4335:48): [True: 0, False: 0]
  ------------------
 4336|      0|        memcpy(*chunk, chunk_ptr, streams_offset);
 4337|      0|      }
 4338|      0|      else {
 4339|      0|        rbytes = BLOSC2_ERROR_FILE_READ;
 4340|      0|      }
 4341|      0|    }
 4342|       |
 4343|      0|    if (rbytes != (int64_t)streams_offset) {
  ------------------
  |  Branch (4343:9): [True: 0, False: 0]
  ------------------
 4344|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4345|      0|      rc = BLOSC2_ERROR_FILE_READ;
 4346|      0|      goto end;
 4347|      0|    }
 4348|      0|    if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (4348:9): [True: 0, False: 0]
  ------------------
 4349|       |      // Value runlen is not returning a lazy chunk.  We are done.
 4350|      0|      goto end;
 4351|      0|    }
 4352|       |
 4353|       |    // Mark chunk as lazy
 4354|      0|    uint8_t* blosc2_flags = *chunk + BLOSC2_CHUNK_BLOSC2_FLAGS;
 4355|      0|    *blosc2_flags |= 0x08U;
 4356|       |
 4357|       |    // Add the trailer (currently, nchunk + offset + block_csizes)
 4358|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4358:9): [True: 0, False: 0]
  ------------------
 4359|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)offset;   // offset is nchunk for sframes
 4360|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = offset;
 4361|      0|    }
 4362|      0|    else {
 4363|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)nchunk;
 4364|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = header_len + offset;
 4365|      0|    }
 4366|       |
 4367|      0|    block_csizes = malloc(nblocks * sizeof(int32_t));
 4368|      0|    if (block_csizes == NULL) {
  ------------------
  |  Branch (4368:9): [True: 0, False: 0]
  ------------------
 4369|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 4370|      0|      goto end;
 4371|      0|    }
 4372|       |
 4373|      0|    if (memcpyed) {
  ------------------
  |  Branch (4373:9): [True: 0, False: 0]
  ------------------
 4374|       |      // When memcpyed the blocksizes are trivial to compute
 4375|      0|      for (size_t i = 0; i + 1 < nblocks; i++) {
  ------------------
  |  Branch (4375:26): [True: 0, False: 0]
  ------------------
 4376|      0|        block_csizes[i] = (int)chunk_blocksize;
 4377|      0|      }
 4378|       |      // The last block could be incomplete, mainly due to the fact that the block size is not divisible
 4379|       |      // by the typesize
 4380|      0|      block_csizes[nblocks - 1] = (int32_t)leftover_block ? (int32_t)leftover_block : chunk_blocksize;
  ------------------
  |  Branch (4380:35): [True: 0, False: 0]
  ------------------
 4381|      0|    }
 4382|      0|    else {
 4383|       |      // In regular, compressed chunks, we need to sort the bstarts (they can be out
 4384|       |      // of order because of multi-threading), and get a reverse index too.
 4385|      0|      memcpy(block_csizes, *chunk + BLOSC_EXTENDED_HEADER_LENGTH, nblocks * sizeof(int32_t));
 4386|       |      // Helper structure to keep track of original indexes
 4387|      0|      csize_idx = malloc(nblocks * sizeof(struct csize_idx));
 4388|      0|      if (csize_idx == NULL) {
  ------------------
  |  Branch (4388:11): [True: 0, False: 0]
  ------------------
 4389|      0|        rc = BLOSC2_ERROR_MEMORY_ALLOC;
 4390|      0|        goto end;
 4391|      0|      }
 4392|      0|      for (size_t n = 0; n < nblocks; n++) {
  ------------------
  |  Branch (4392:26): [True: 0, False: 0]
  ------------------
 4393|       |        // A block starts within its chunk, at or after streams_offset; damaged
 4394|       |        // starts would point into chunk headers or overflow the differences below
 4395|       |        // (and in sort_offset())
 4396|      0|        if (block_csizes[n] < (int64_t)streams_offset || block_csizes[n] > chunk_cbytes) {
  ------------------
  |  Branch (4396:13): [True: 0, False: 0]
  |  Branch (4396:58): [True: 0, False: 0]
  ------------------
 4397|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4398|      0|          goto end;
 4399|      0|        }
 4400|      0|        csize_idx[n].val = block_csizes[n];
 4401|      0|        csize_idx[n].idx = (int)n;
 4402|      0|      }
 4403|      0|      qsort(csize_idx, nblocks, sizeof(struct csize_idx), &sort_offset);
 4404|       |      // Compute the actual csizes
 4405|      0|      int idx;
 4406|      0|      for (size_t n = 0; n + 1 < nblocks; n++) {
  ------------------
  |  Branch (4406:26): [True: 0, False: 0]
  ------------------
 4407|      0|        idx = csize_idx[n].idx;
 4408|      0|        block_csizes[idx] = csize_idx[n + 1].val - csize_idx[n].val;
 4409|      0|      }
 4410|      0|      idx = csize_idx[nblocks - 1].idx;
 4411|      0|      block_csizes[idx] = chunk_cbytes - csize_idx[nblocks - 1].val;
 4412|      0|      free(csize_idx);
 4413|      0|      csize_idx = NULL;
 4414|      0|    }
 4415|       |    // Copy the csizes at the end of the trailer
 4416|      0|    void *trailer_csizes = *chunk + lazychunk_cbytes - nblocks * sizeof(int32_t);
 4417|      0|    memcpy(trailer_csizes, block_csizes, nblocks * sizeof(int32_t));
 4418|      0|    free(block_csizes);
 4419|      0|    block_csizes = NULL;
 4420|     85|  } else {
 4421|       |    // The chunk is in memory and just one pointer away
 4422|     85|    int64_t chunk_header_offset = header_len + offset;
 4423|     85|    int64_t chunk_cbytes_offset = chunk_header_offset + BLOSC_MIN_HEADER_LENGTH;
 4424|       |
 4425|     85|    *chunk = frame->cframe + chunk_header_offset;
 4426|       |
 4427|     85|    if (chunk_header_offset < 0 ||
  ------------------
  |  Branch (4427:9): [True: 0, False: 85]
  ------------------
 4428|     85|        chunk_cbytes_offset < chunk_header_offset ||
  ------------------
  |  Branch (4428:9): [True: 0, False: 85]
  ------------------
 4429|     85|        chunk_cbytes_offset > frame->len) {
  ------------------
  |  Branch (4429:9): [True: 0, False: 85]
  ------------------
 4430|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4431|      0|      rc = BLOSC2_ERROR_READ_BUFFER;
 4432|     85|    } else {
 4433|     85|      int32_t chunk_blocksize = 0;
 4434|     85|      rc = blosc2_cbuffer_sizes(*chunk, NULL, &lazychunk_cbytes, &chunk_blocksize);
 4435|     85|      if (rc < 0) {
  ------------------
  |  Branch (4435:11): [True: 0, False: 85]
  ------------------
 4436|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4437|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 4438|      0|      }
 4439|     85|      else if (chunk_blocksize <= 0) {
  ------------------
  |  Branch (4439:16): [True: 0, False: 85]
  ------------------
 4440|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4441|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4442|      0|      }
 4443|     85|      else if (lazychunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4443:16): [True: 0, False: 85]
  ------------------
 4444|     85|               chunk_header_offset > INT64_MAX - lazychunk_cbytes ||
  ------------------
  |  Branch (4444:16): [True: 0, False: 85]
  ------------------
 4445|     85|               chunk_header_offset + lazychunk_cbytes > frame_len) {
  ------------------
  |  Branch (4445:16): [True: 0, False: 85]
  ------------------
 4446|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4447|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 4448|      0|      }
 4449|     85|    }
 4450|     85|  }
 4451|       |
 4452|     85|  end:
 4453|     85|  if (csize_idx != NULL) {
  ------------------
  |  Branch (4453:7): [True: 0, False: 85]
  ------------------
 4454|      0|    free(csize_idx);
 4455|      0|  }
 4456|     85|  if (block_csizes != NULL) {
  ------------------
  |  Branch (4456:7): [True: 0, False: 85]
  ------------------
 4457|      0|    free(block_csizes);
 4458|      0|  }
 4459|     85|  if (fp != NULL) {
  ------------------
  |  Branch (4459:7): [True: 0, False: 85]
  ------------------
 4460|      0|    frame_reader_release(frame, io_cb, fp);
 4461|      0|  }
 4462|     85|  if (rc < 0) {
  ------------------
  |  Branch (4462:7): [True: 0, False: 85]
  ------------------
 4463|      0|    if (*needs_free) {
  ------------------
  |  Branch (4463:9): [True: 0, False: 0]
  ------------------
 4464|      0|      free(*chunk);
 4465|      0|      *chunk = NULL;
 4466|      0|      *needs_free = false;
 4467|      0|    }
 4468|      0|    return rc;
 4469|      0|  }
 4470|       |
 4471|     85|  return (int)lazychunk_cbytes;
 4472|     85|}
frame_get_chunk_header:
 4599|  1.17k|int frame_get_chunk_header(blosc2_frame_s* frame, int64_t nchunk, uint8_t* header) {
 4600|  1.17k|  frame_fields f;
 4601|  1.17k|  int rc = get_frame_fields(frame, &f);
 4602|  1.17k|  if (rc < 0) {
  ------------------
  |  Branch (4602:7): [True: 0, False: 1.17k]
  ------------------
 4603|      0|    return rc;
 4604|      0|  }
 4605|  1.17k|  int64_t offset;
 4606|       |  return read_frame_chunk_header(frame, &f, nchunk, NULL, header, &offset);
 4607|  1.17k|}
frame_fill_special:
 4612|     87|                       int32_t chunksize, blosc2_schunk* schunk) {
 4613|     87|  int32_t header_len;
 4614|     87|  int64_t frame_len;
 4615|     87|  int64_t nbytes;
 4616|     87|  int64_t cbytes;
 4617|     87|  int32_t blocksize;
 4618|     87|  int32_t typesize;
 4619|     87|  int64_t nchunks;
 4620|       |
 4621|     87|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes, &blocksize, NULL,
 4622|     87|                           &nchunks, &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 4623|     87|                           schunk->storage->io);
 4624|     87|  if (rc < 0) {
  ------------------
  |  Branch (4624:7): [True: 0, False: 87]
  ------------------
 4625|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4626|      0|    return BLOSC2_ERROR_DATA;
 4627|      0|  }
 4628|       |
 4629|     87|  if (nitems == 0) {
  ------------------
  |  Branch (4629:7): [True: 0, False: 87]
  ------------------
 4630|      0|    return frame_len;
 4631|      0|  }
 4632|       |
 4633|     87|  if ((nitems / chunksize) > INT_MAX) {
  ------------------
  |  Branch (4633:7): [True: 0, False: 87]
  ------------------
 4634|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4635|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4636|      0|  }
 4637|       |
 4638|     87|  if ((nbytes > 0) || (cbytes > 0)) {
  ------------------
  |  Branch (4638:7): [True: 0, False: 87]
  |  Branch (4638:23): [True: 0, False: 87]
  ------------------
 4639|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4640|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4641|      0|  }
 4642|       |
 4643|       |  // Compute the number of chunks and the length of the offsets chunk
 4644|     87|  int32_t chunkitems = chunksize / typesize;
 4645|     87|  if (chunkitems <= 0) {
  ------------------
  |  Branch (4645:7): [True: 0, False: 87]
  ------------------
 4646|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4647|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4648|      0|  }
 4649|     87|  nchunks = nitems / chunkitems;
 4650|     87|  int32_t leftover_items = (int32_t)(nitems % chunkitems);
 4651|     87|  if (leftover_items) {
  ------------------
  |  Branch (4651:7): [True: 0, False: 87]
  ------------------
 4652|      0|    nchunks += 1;
 4653|      0|  }
 4654|       |
 4655|     87|  blosc2_cparams* cparams;
 4656|     87|  blosc2_schunk_get_cparams(schunk, &cparams);
 4657|       |
 4658|       |  // Build the offsets with a special chunk
 4659|     87|  int new_off_cbytes = BLOSC_EXTENDED_HEADER_LENGTH + sizeof(int64_t);
 4660|     87|  uint8_t* off_chunk = malloc(new_off_cbytes);
 4661|     87|  uint64_t offset_value = ((uint64_t)1 << 63);
 4662|     87|  uint8_t* sample_chunk = malloc(BLOSC_EXTENDED_HEADER_LENGTH);
 4663|     87|  if (off_chunk == NULL || sample_chunk == NULL) {
  ------------------
  |  Branch (4663:7): [True: 0, False: 87]
  |  Branch (4663:28): [True: 0, False: 87]
  ------------------
 4664|      0|    free(off_chunk);
 4665|      0|    free(sample_chunk);
 4666|      0|    free(cparams);
 4667|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4668|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 4669|      0|  }
 4670|     87|  int csize;
 4671|     87|  switch (special_value) {
 4672|     87|    case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (4672:5): [True: 87, False: 0]
  ------------------
 4673|     87|      offset_value += (uint64_t) BLOSC2_SPECIAL_ZERO << (8 * 7);
 4674|     87|      csize = blosc2_chunk_zeros(*cparams, chunksize, sample_chunk, BLOSC_EXTENDED_HEADER_LENGTH);
 4675|     87|      break;
 4676|      0|    case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (4676:5): [True: 0, False: 87]
  ------------------
 4677|      0|      offset_value += (uint64_t) BLOSC2_SPECIAL_UNINIT << (8 * 7);
 4678|      0|      csize = blosc2_chunk_uninit(*cparams, chunksize, sample_chunk, BLOSC_EXTENDED_HEADER_LENGTH);
 4679|      0|      break;
 4680|      0|    case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (4680:5): [True: 0, False: 87]
  ------------------
 4681|      0|      offset_value += (uint64_t)BLOSC2_SPECIAL_NAN << (8 * 7);
 4682|      0|      csize = blosc2_chunk_nans(*cparams, chunksize, sample_chunk, BLOSC_EXTENDED_HEADER_LENGTH);
 4683|      0|      break;
 4684|      0|    default:
  ------------------
  |  Branch (4684:5): [True: 0, False: 87]
  ------------------
 4685|      0|      free(off_chunk);
 4686|      0|      free(sample_chunk);
 4687|      0|      free(cparams);
 4688|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4689|      0|      return BLOSC2_ERROR_FRAME_SPECIAL;
 4690|     87|  }
 4691|     87|  if (csize < 0) {
  ------------------
  |  Branch (4691:7): [True: 0, False: 87]
  ------------------
 4692|      0|    free(off_chunk);
 4693|      0|    free(sample_chunk);
 4694|      0|    free(cparams);
 4695|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4696|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4697|      0|  }
 4698|     87|  cparams->typesize = sizeof(int64_t);  // change it to offsets typesize
 4699|       |  // cparams->blocksize = 0;   // automatic blocksize
 4700|     87|  cparams->blocksize = 8 * 2 * 1024;  // based on experiments with create_frame.c bench
 4701|     87|  cparams->clevel = 5;
 4702|     87|  cparams->compcode = BLOSC_BLOSCLZ;
 4703|     87|  int32_t special_nbytes;
 4704|     87|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &special_nbytes)) {
  ------------------
  |  Branch (4704:7): [True: 0, False: 87]
  ------------------
 4705|      0|    free(off_chunk);
 4706|      0|    free(sample_chunk);
 4707|      0|    free(cparams);
 4708|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4709|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4710|      0|  }
 4711|     87|  rc = blosc2_chunk_repeatval(*cparams, special_nbytes, off_chunk, new_off_cbytes, &offset_value);
 4712|     87|  free(cparams);
 4713|     87|  if (rc < 0) {
  ------------------
  |  Branch (4713:7): [True: 0, False: 87]
  ------------------
 4714|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4715|      0|    return BLOSC2_ERROR_DATA;
 4716|      0|  }
 4717|       |
 4718|       |  // Get the blocksize associated to the sample chunk
 4719|     87|  blosc2_cbuffer_sizes(sample_chunk, NULL, NULL, &blocksize);
 4720|     87|  free(sample_chunk);
 4721|       |  // and use it for the super-chunk
 4722|     87|  schunk->blocksize = blocksize;
 4723|       |  // schunk->blocksize = 0;  // for experimenting with automatic blocksize
 4724|       |
 4725|       |  // We have the new offsets; update the frame.
 4726|     87|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 4727|     87|  if (io_cb == NULL) {
  ------------------
  |  Branch (4727:7): [True: 0, False: 87]
  ------------------
 4728|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4729|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 4730|      0|  }
 4731|       |
 4732|     87|  int64_t new_frame_len = header_len + new_off_cbytes + frame->trailer_len;
 4733|     87|  void* fp = NULL;
 4734|     87|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (4734:7): [True: 87, False: 0]
  ------------------
 4735|     87|    uint8_t* framep = frame->cframe;
 4736|       |    /* Make space for the new chunk and copy it */
 4737|     87|    frame->cframe = framep = realloc(framep, (size_t)new_frame_len);
 4738|     87|    if (framep == NULL) {
  ------------------
  |  Branch (4738:9): [True: 0, False: 87]
  ------------------
 4739|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4740|      0|      return BLOSC2_ERROR_FRAME_SPECIAL;
 4741|      0|    }
 4742|       |    /* Copy the offsets */
 4743|     87|    memcpy(framep + header_len, off_chunk, (size_t)new_off_cbytes);
 4744|     87|  }
 4745|      0|  else {
 4746|      0|    size_t wbytes;
 4747|      0|    int64_t io_pos = 0;
 4748|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4748:9): [True: 0, False: 0]
  ------------------
 4749|       |      // Update the offsets chunk in the chunks frame
 4750|      0|      fp = sframe_open_index(frame->urlpath, "rb+", frame->schunk->storage->io);
 4751|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4751:11): [True: 0, False: 0]
  ------------------
 4752|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4753|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4754|      0|      }
 4755|      0|      io_pos = frame->file_offset + header_len;
 4756|      0|    }
 4757|      0|    else {
 4758|       |      // Regular frame
 4759|      0|      fp = frame_writer_acquire(frame, io_cb);
 4760|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4760:11): [True: 0, False: 0]
  ------------------
 4761|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4762|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4763|      0|      }
 4764|      0|      io_pos = frame->file_offset + header_len + cbytes;
 4765|      0|    }
 4766|      0|    wbytes = io_cb->write(off_chunk, 1, new_off_cbytes, io_pos, fp);  // the new offsets
 4767|      0|    frame_writer_release(frame, io_cb, fp);
 4768|      0|    if (wbytes != (size_t)new_off_cbytes) {
  ------------------
  |  Branch (4768:9): [True: 0, False: 0]
  ------------------
 4769|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4770|      0|      return BLOSC2_ERROR_FRAME_SPECIAL;
 4771|      0|    }
 4772|      0|  }
 4773|       |
 4774|       |  // Invalidate the cache for chunk offsets
 4775|     87|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (4775:7): [True: 0, False: 87]
  ------------------
 4776|      0|    if (frame->coffsets_needs_free)
  ------------------
  |  Branch (4776:9): [True: 0, False: 0]
  ------------------
 4777|      0|      free(frame->coffsets);
 4778|      0|    frame->coffsets = NULL;
 4779|      0|  }
 4780|     87|  free(off_chunk);
 4781|       |
 4782|     87|  frame->len = new_frame_len;
 4783|     87|  rc = frame_update_header(frame, schunk, false);
 4784|     87|  if (rc < 0) {
  ------------------
  |  Branch (4784:7): [True: 0, False: 87]
  ------------------
 4785|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4786|      0|  }
 4787|       |
 4788|     87|  rc = frame_update_trailer(frame, schunk);
 4789|     87|  if (rc < 0) {
  ------------------
  |  Branch (4789:7): [True: 0, False: 87]
  ------------------
 4790|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
 4791|      0|  }
 4792|       |
 4793|     87|  return frame->len;
 4794|     87|}
frame_update_chunk:
 6010|    604|                         int32_t cbytes_old) {
 6011|    604|  uint8_t *chunk_ = (uint8_t *) chunk;
 6012|    604|  int64_t* offsets = NULL;
 6013|    604|  uint8_t* off_chunk = NULL;
 6014|    604|  int32_t header_len;
 6015|    604|  int64_t frame_len;
 6016|    604|  int64_t nbytes;
 6017|    604|  int64_t cbytes;
 6018|    604|  int32_t blocksize;
 6019|    604|  int32_t chunksize;
 6020|    604|  int64_t nchunks;
 6021|    604|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 6022|    604|                           &blocksize, &chunksize, &nchunks,
 6023|    604|                           NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 6024|    604|                           frame->schunk->storage->io);
 6025|    604|  if (rc < 0) {
  ------------------
  |  Branch (6025:7): [True: 0, False: 604]
  ------------------
 6026|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6027|      0|    goto failed;
 6028|      0|  }
 6029|    604|  rc = frame_refresh_if_stale(frame, frame_len);
 6030|    604|  if (rc < 0) {
  ------------------
  |  Branch (6030:7): [True: 0, False: 604]
  ------------------
 6031|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6032|      0|    goto failed;
 6033|      0|  }
 6034|    604|  if (nchunk >= nchunks) {
  ------------------
  |  Branch (6034:7): [True: 0, False: 604]
  ------------------
 6035|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6036|      0|    goto failed;
 6037|      0|  }
 6038|       |
 6039|    604|  int32_t chunk_cbytes;
 6040|    604|  rc = blosc2_cbuffer_sizes(chunk, NULL, &chunk_cbytes, NULL);
 6041|    604|  if (rc < 0) {
  ------------------
  |  Branch (6041:7): [True: 0, False: 604]
  ------------------
 6042|      0|    goto failed;
 6043|      0|  }
 6044|       |
 6045|       |  // Get the current offsets
 6046|    604|  int32_t off_nbytes;
 6047|    604|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &off_nbytes)) {
  ------------------
  |  Branch (6047:7): [True: 0, False: 604]
  ------------------
 6048|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6049|      0|    goto failed;
 6050|      0|  }
 6051|    604|  offsets = (int64_t *) malloc((size_t)off_nbytes);
 6052|    604|  if (offsets == NULL) {
  ------------------
  |  Branch (6052:7): [True: 0, False: 604]
  ------------------
 6053|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6054|      0|    goto failed;
 6055|      0|  }
 6056|    604|  if (nchunks > 0) {
  ------------------
  |  Branch (6056:7): [True: 604, False: 0]
  ------------------
 6057|    604|    int32_t coffsets_cbytes = 0;
 6058|    604|    uint8_t *coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 6059|    604|    if (coffsets == NULL) {
  ------------------
  |  Branch (6059:9): [True: 0, False: 604]
  ------------------
 6060|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6061|      0|      goto failed;
 6062|      0|    }
 6063|       |    // Decompress offsets
 6064|    604|    blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 6065|    604|    blosc2_context *dctx = blosc2_create_dctx(off_dparams);
 6066|    604|    if (dctx == NULL) {
  ------------------
  |  Branch (6066:9): [True: 0, False: 604]
  ------------------
 6067|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6068|      0|      goto failed;
 6069|      0|    }
 6070|    604|    int32_t prev_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes, offsets, off_nbytes);
 6071|    604|    blosc2_free_ctx(dctx);
 6072|    604|    if (prev_nbytes < 0) {
  ------------------
  |  Branch (6072:9): [True: 0, False: 604]
  ------------------
 6073|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6074|      0|      goto failed;
 6075|      0|    }
 6076|    604|  }
 6077|    604|  int64_t old_offset = 0;
 6078|    604|  if (!frame->sframe) {
  ------------------
  |  Branch (6078:7): [True: 604, False: 0]
  ------------------
 6079|    604|    old_offset = offsets[nchunk];
 6080|    604|  }
 6081|       |
 6082|       |  // Add the new offset
 6083|    604|  int64_t sframe_chunk_id = -1;
 6084|    604|  int64_t old_sframe_chunk_id = -1;
 6085|    604|  int64_t delta_cbytes = 0;
 6086|    604|  bool old_chunk_is_regular = (!frame->sframe && old_offset >= 0);
  ------------------
  |  Branch (6086:32): [True: 604, False: 0]
  |  Branch (6086:50): [True: 0, False: 604]
  ------------------
 6087|    604|  bool new_chunk_is_regular = true;
 6088|    604|  int64_t new_chunk_offset = cbytes;
 6089|       |  // Inside frame_begin_updates(), a resized chunk leaves a hole instead of moving the payload behind it
 6090|    604|  bool defer = !frame->sframe && frame->updates_depth > 0;
  ------------------
  |  Branch (6090:16): [True: 604, False: 0]
  |  Branch (6090:34): [True: 604, False: 0]
  ------------------
 6091|    604|  if (frame->sframe) {
  ------------------
  |  Branch (6091:7): [True: 0, False: 604]
  ------------------
 6092|      0|    if (offsets[nchunk] < 0) {
  ------------------
  |  Branch (6092:9): [True: 0, False: 0]
  ------------------
 6093|      0|      sframe_chunk_id = -1;
 6094|      0|    }
 6095|      0|    else {
 6096|       |      // In case there was a reorder in a sframe
 6097|      0|      sframe_chunk_id = offsets[nchunk];
 6098|      0|      old_sframe_chunk_id = offsets[nchunk];
 6099|      0|    }
 6100|      0|  }
 6101|    604|  int special_value = chunk_special_in_offset(chunk_, chunk_cbytes);
 6102|    604|  bool is_special_chunk = special_value != 0;
 6103|    604|  if (is_special_chunk) {
  ------------------
  |  Branch (6103:7): [True: 0, False: 604]
  ------------------
 6104|      0|    special_offset(offsets + nchunk, special_value);
 6105|      0|  }
 6106|    604|  else if (frame->sframe) {
  ------------------
  |  Branch (6106:12): [True: 0, False: 604]
  ------------------
 6107|      0|    if (sframe_chunk_id < 0) {
  ------------------
  |  Branch (6107:9): [True: 0, False: 0]
  ------------------
 6108|      0|      for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (6108:27): [True: 0, False: 0]
  ------------------
 6109|      0|        if (offsets[i] > sframe_chunk_id) {
  ------------------
  |  Branch (6109:13): [True: 0, False: 0]
  ------------------
 6110|      0|          sframe_chunk_id = offsets[i];
 6111|      0|        }
 6112|      0|      }
 6113|      0|      offsets[nchunk] = ++sframe_chunk_id;
 6114|      0|    }
 6115|      0|  }
 6116|    604|  else {
 6117|    604|    if (old_chunk_is_regular) {
  ------------------
  |  Branch (6117:9): [True: 0, False: 604]
  ------------------
 6118|      0|      new_chunk_offset = old_offset;
 6119|      0|    }
 6120|    604|    offsets[nchunk] = new_chunk_offset;
 6121|    604|  }
 6122|    604|  if (is_special_chunk) {
  ------------------
  |  Branch (6122:7): [True: 0, False: 604]
  ------------------
 6123|      0|    chunk_cbytes = 0;   // Special chunks are encoded in offsets and have no stored payload.
 6124|      0|    new_chunk_is_regular = false;
 6125|      0|  }
 6126|    604|  if (defer) {
  ------------------
  |  Branch (6126:7): [True: 604, False: 0]
  ------------------
 6127|    604|    if (old_chunk_is_regular || new_chunk_is_regular) {
  ------------------
  |  Branch (6127:9): [True: 0, False: 604]
  |  Branch (6127:33): [True: 604, False: 0]
  ------------------
 6128|    604|      int64_t payload_end = cbytes;
 6129|    604|      new_chunk_offset = holes_place(frame, old_chunk_is_regular ? old_offset : -1, cbytes_old, chunk_cbytes,
  ------------------
  |  Branch (6129:45): [True: 0, False: 604]
  ------------------
 6130|    604|                                     &payload_end);
 6131|    604|      delta_cbytes = payload_end - cbytes;
 6132|    604|      if (new_chunk_is_regular) {
  ------------------
  |  Branch (6132:11): [True: 604, False: 0]
  ------------------
 6133|    604|        offsets[nchunk] = new_chunk_offset;
 6134|    604|      }
 6135|    604|    }
 6136|    604|  }
 6137|      0|  else if (!frame->sframe) {
  ------------------
  |  Branch (6137:12): [True: 0, False: 0]
  ------------------
 6138|      0|    if (old_chunk_is_regular) {
  ------------------
  |  Branch (6138:9): [True: 0, False: 0]
  ------------------
 6139|      0|      delta_cbytes = (int64_t)chunk_cbytes - cbytes_old;
 6140|      0|      for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (6140:27): [True: 0, False: 0]
  ------------------
 6141|      0|        if (i == nchunk || offsets[i] < 0) {
  ------------------
  |  Branch (6141:13): [True: 0, False: 0]
  |  Branch (6141:28): [True: 0, False: 0]
  ------------------
 6142|      0|          continue;
 6143|      0|        }
 6144|      0|        if (offsets[i] > old_offset) {
  ------------------
  |  Branch (6144:13): [True: 0, False: 0]
  ------------------
 6145|      0|          offsets[i] += delta_cbytes;
 6146|      0|        }
 6147|      0|      }
 6148|      0|    }
 6149|      0|    else if (new_chunk_is_regular) {
  ------------------
  |  Branch (6149:14): [True: 0, False: 0]
  ------------------
 6150|      0|      delta_cbytes = chunk_cbytes;
 6151|      0|    }
 6152|      0|  }
 6153|       |  // Re-compress the offsets again
 6154|    604|  int32_t new_off_cbytes = compress_offsets(offsets, off_nbytes, off_nbytes + BLOSC2_MAX_OVERHEAD,
 6155|    604|                                            &off_chunk);
 6156|    604|  free(offsets);
 6157|    604|  offsets = NULL;
 6158|    604|  if (new_off_cbytes < 0) {
  ------------------
  |  Branch (6158:7): [True: 0, False: 604]
  ------------------
 6159|      0|    goto failed;
 6160|      0|  }
 6161|       |
 6162|    604|  int64_t new_cbytes = cbytes;
 6163|    604|  if (!frame->sframe) {
  ------------------
  |  Branch (6163:7): [True: 604, False: 0]
  ------------------
 6164|    604|    new_cbytes += delta_cbytes;
 6165|    604|  }
 6166|      0|  else {
 6167|      0|    new_cbytes = schunk->cbytes;
 6168|      0|  }
 6169|    604|  int64_t new_frame_len;
 6170|    604|  if (frame->sframe) {
  ------------------
  |  Branch (6170:7): [True: 0, False: 604]
  ------------------
 6171|       |    // The chunk is not stored in the frame
 6172|      0|    new_frame_len = header_len + 0 + new_off_cbytes + frame->trailer_len;
 6173|      0|  }
 6174|    604|  else {
 6175|    604|    new_frame_len = header_len + new_cbytes + new_off_cbytes + frame->trailer_len;
 6176|    604|  }
 6177|       |
 6178|    604|  void* fp = NULL;
 6179|    604|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (6179:7): [True: 604, False: 0]
  ------------------
 6180|    604|    uint8_t* framep = frame->cframe;
 6181|    604|    if (new_frame_len > frame->len) {
  ------------------
  |  Branch (6181:9): [True: 604, False: 0]
  ------------------
 6182|       |      // Keep the frame if the realloc fails
 6183|    604|      framep = realloc(framep, (size_t)new_frame_len);
 6184|    604|      if (framep == NULL) {
  ------------------
  |  Branch (6184:11): [True: 0, False: 604]
  ------------------
 6185|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6186|      0|        goto failed;
 6187|      0|      }
 6188|    604|      frame->cframe = framep;
 6189|    604|    }
 6190|    604|    if (!frame->sframe && old_chunk_is_regular && !defer) {
  ------------------
  |  Branch (6190:9): [True: 604, False: 0]
  |  Branch (6190:27): [True: 0, False: 604]
  |  Branch (6190:51): [True: 0, False: 0]
  ------------------
 6191|      0|      int64_t tail_src_offset = old_offset + cbytes_old;
 6192|      0|      int64_t tail_dst_offset = old_offset + chunk_cbytes;
 6193|      0|      int64_t tail_nbytes = cbytes - tail_src_offset;
 6194|      0|      if (tail_nbytes > 0 && tail_src_offset != tail_dst_offset) {
  ------------------
  |  Branch (6194:11): [True: 0, False: 0]
  |  Branch (6194:30): [True: 0, False: 0]
  ------------------
 6195|      0|        memmove(framep + header_len + tail_dst_offset, framep + header_len + tail_src_offset, (size_t)tail_nbytes);
 6196|      0|      }
 6197|      0|    }
 6198|    604|    if (!frame->sframe && new_chunk_is_regular) {
  ------------------
  |  Branch (6198:9): [True: 604, False: 0]
  |  Branch (6198:27): [True: 604, False: 0]
  ------------------
 6199|    604|      memcpy(framep + header_len + new_chunk_offset, chunk, (size_t)chunk_cbytes);
 6200|    604|    }
 6201|       |    /* Copy the offsets */
 6202|    604|    memcpy(framep + header_len + new_cbytes, off_chunk, (size_t)new_off_cbytes);
 6203|    604|  } else {
 6204|      0|    int64_t wbytes;
 6205|       |
 6206|      0|    int64_t io_pos = 0;
 6207|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 6208|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (6208:9): [True: 0, False: 0]
  ------------------
 6209|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6210|      0|      goto failed;
 6211|      0|    }
 6212|       |
 6213|      0|    if (frame->sframe) {
  ------------------
  |  Branch (6213:9): [True: 0, False: 0]
  ------------------
 6214|       |      // Create or update chunk file only for chunks with stored payload (regular or VALUE)
 6215|      0|      if (!is_special_chunk && sframe_chunk_id >= 0) {
  ------------------
  |  Branch (6215:11): [True: 0, False: 0]
  |  Branch (6215:32): [True: 0, False: 0]
  ------------------
 6216|      0|        if (sframe_create_chunk(frame, chunk, sframe_chunk_id, chunk_cbytes) == NULL) {
  ------------------
  |  Branch (6216:13): [True: 0, False: 0]
  ------------------
 6217|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6218|      0|          goto failed;
 6219|      0|        }
 6220|      0|      }
 6221|       |      // Update the offsets chunk in the chunks frame
 6222|      0|      fp = sframe_open_index(frame->urlpath, "rb+",
 6223|      0|                             frame->schunk->storage->io);
 6224|      0|      if (fp == NULL) {
  ------------------
  |  Branch (6224:11): [True: 0, False: 0]
  ------------------
 6225|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6226|      0|        goto failed;
 6227|      0|      }
 6228|      0|      io_pos = frame->file_offset + header_len + 0;
 6229|      0|    }
 6230|      0|    else {
 6231|       |      // Regular frame
 6232|      0|      fp = frame_writer_acquire(frame, io_cb);
 6233|      0|      if (fp == NULL) {
  ------------------
  |  Branch (6233:11): [True: 0, False: 0]
  ------------------
 6234|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6235|      0|        goto failed;
 6236|      0|      }
 6237|      0|      if (old_chunk_is_regular && !defer) {
  ------------------
  |  Branch (6237:11): [True: 0, False: 0]
  |  Branch (6237:35): [True: 0, False: 0]
  ------------------
 6238|      0|        int64_t tail_src_offset = old_offset + cbytes_old;
 6239|      0|        int64_t tail_dst_offset = old_offset + chunk_cbytes;
 6240|      0|        int64_t tail_nbytes = cbytes - tail_src_offset;
 6241|      0|        if (tail_nbytes < 0) {
  ------------------
  |  Branch (6241:13): [True: 0, False: 0]
  ------------------
 6242|      0|          frame_writer_release(frame, io_cb, fp);
 6243|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6244|      0|          goto failed;
 6245|      0|        }
 6246|      0|        if (tail_nbytes > 0 && tail_src_offset != tail_dst_offset) {
  ------------------
  |  Branch (6246:13): [True: 0, False: 0]
  |  Branch (6246:32): [True: 0, False: 0]
  ------------------
 6247|      0|          int rc_move = frame_move_range(io_cb, fp,
 6248|      0|                                         frame->file_offset + header_len + tail_src_offset,
 6249|      0|                                         frame->file_offset + header_len + tail_dst_offset,
 6250|      0|                                         tail_nbytes, 0);
 6251|      0|          if (rc_move < 0) {
  ------------------
  |  Branch (6251:15): [True: 0, False: 0]
  ------------------
 6252|      0|            frame->file_end = 0;
 6253|      0|            frame_writer_release(frame, io_cb, fp);
 6254|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6255|      0|            goto failed;
 6256|      0|          }
 6257|      0|        }
 6258|      0|      }
 6259|      0|      if (new_chunk_is_regular) {
  ------------------
  |  Branch (6259:11): [True: 0, False: 0]
  ------------------
 6260|      0|        io_pos = frame->file_offset + header_len + new_chunk_offset;
 6261|      0|        wbytes = io_cb->write(chunk, 1, chunk_cbytes, io_pos, fp);  // the new chunk
 6262|      0|        if (wbytes != chunk_cbytes) {
  ------------------
  |  Branch (6262:13): [True: 0, False: 0]
  ------------------
 6263|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6264|      0|                            " bytes at position %" PRId64 ", nchunk=%" PRId64 ").",
 6265|      0|                            wbytes, (int64_t)chunk_cbytes, io_pos, nchunk);
 6266|      0|          frame->file_end = 0;
 6267|      0|          frame_writer_release(frame, io_cb, fp);
 6268|      0|          goto failed;
 6269|      0|        }
 6270|      0|      }
 6271|      0|      io_pos = frame->file_offset + header_len + new_cbytes;
 6272|      0|    }
 6273|      0|    wbytes = io_cb->write(off_chunk, 1, new_off_cbytes, io_pos, fp);  // the new offsets
 6274|      0|    frame_writer_release(frame, io_cb, fp);
 6275|      0|    if (wbytes != new_off_cbytes) {
  ------------------
  |  Branch (6275:9): [True: 0, False: 0]
  ------------------
 6276|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6277|      0|      frame->file_end = 0;
 6278|      0|      goto failed;
 6279|      0|    }
 6280|       |    // Invalidate the cache for chunk offsets
 6281|      0|    if (frame->coffsets != NULL) {
  ------------------
  |  Branch (6281:9): [True: 0, False: 0]
  ------------------
 6282|      0|      if (frame->coffsets_needs_free)
  ------------------
  |  Branch (6282:11): [True: 0, False: 0]
  ------------------
 6283|      0|        free(frame->coffsets);
 6284|      0|      frame->coffsets = NULL;
 6285|      0|    }
 6286|      0|  }
 6287|    604|  free(off_chunk);
 6288|    604|  off_chunk = NULL;
 6289|       |
 6290|    604|  if (defer) {
  ------------------
  |  Branch (6290:7): [True: 604, False: 0]
  ------------------
 6291|       |    // The header describes the payload as it lies, holes included
 6292|    604|    schunk->cbytes = new_cbytes;
 6293|    604|  }
 6294|    604|  frame->len = new_frame_len;
 6295|    604|  rc = frame_update_header(frame, schunk, false);
 6296|    604|  if (rc < 0) {
  ------------------
  |  Branch (6296:7): [True: 0, False: 604]
  ------------------
 6297|      0|    frame->len = frame_len;
 6298|      0|    goto failed;
 6299|      0|  }
 6300|       |
 6301|    604|  rc = frame_update_trailer(frame, schunk);
 6302|    604|  if (rc < 0) {
  ------------------
  |  Branch (6302:7): [True: 0, False: 604]
  ------------------
 6303|      0|    frame->len = frame_len;
 6304|      0|    goto failed;
 6305|      0|  }
 6306|       |
 6307|    604|  if (frame->sframe && is_special_chunk && old_sframe_chunk_id >= 0) {
  ------------------
  |  Branch (6307:7): [True: 0, False: 604]
  |  Branch (6307:24): [True: 0, False: 0]
  |  Branch (6307:44): [True: 0, False: 0]
  ------------------
 6308|      0|    const blosc2_io *io = (frame->schunk && frame->schunk->storage) ? frame->schunk->storage->io : NULL;
  ------------------
  |  Branch (6308:28): [True: 0, False: 0]
  |  Branch (6308:45): [True: 0, False: 0]
  ------------------
 6309|      0|    int err = sframe_delete_chunk(frame->urlpath, old_sframe_chunk_id, io);
 6310|      0|    if (err != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (6310:9): [True: 0, False: 0]
  ------------------
 6311|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6312|      0|                          old_sframe_chunk_id, err);
 6313|       |      // Do not return NULL: the update was already committed to the index and trailer.
 6314|       |      // Distinguish orphan cleanup failure from failure to commit the update.
 6315|      0|    }
 6316|      0|  }
 6317|       |
 6318|    604|  return frame;
 6319|       |
 6320|      0|  failed:
 6321|      0|  free(offsets);
 6322|      0|  free(off_chunk);
 6323|       |  return NULL;
 6324|    604|}
frame_begin_updates:
 6507|     87|int frame_begin_updates(blosc2_frame_s* frame) {
 6508|     87|  if (frame == NULL) {
  ------------------
  |  Branch (6508:7): [True: 0, False: 87]
  ------------------
 6509|      0|    return BLOSC2_ERROR_SUCCESS;
 6510|      0|  }
 6511|     87|  int rc = frame_lock(frame, true);
 6512|     87|  if (rc < 0) {
  ------------------
  |  Branch (6512:7): [True: 0, False: 87]
  ------------------
 6513|      0|    return rc;
 6514|      0|  }
 6515|     87|  if (!frame->sframe && frame->updates_depth++ == 0) {
  ------------------
  |  Branch (6515:7): [True: 87, False: 0]
  |  Branch (6515:25): [True: 87, False: 0]
  ------------------
 6516|     87|    frame->nholes = 0;
 6517|       |    frame->holes_lost = false;
 6518|     87|  }
 6519|     87|  return BLOSC2_ERROR_SUCCESS;
 6520|     87|}
frame_end_updates:
 6523|     87|int frame_end_updates(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 6524|     87|  if (frame == NULL) {
  ------------------
  |  Branch (6524:7): [True: 0, False: 87]
  ------------------
 6525|      0|    return BLOSC2_ERROR_SUCCESS;
 6526|      0|  }
 6527|     87|  int rc = BLOSC2_ERROR_SUCCESS;
 6528|     87|  if (!frame->sframe && frame->updates_depth > 0 && --frame->updates_depth == 0) {
  ------------------
  |  Branch (6528:7): [True: 87, False: 0]
  |  Branch (6528:25): [True: 87, False: 0]
  |  Branch (6528:53): [True: 87, False: 0]
  ------------------
 6529|     87|    if (frame->holes_lost) {
  ------------------
  |  Branch (6529:9): [True: 0, False: 87]
  ------------------
 6530|       |      // Valid, just larger: the holes stay as dead space, like the space of deleted chunks
 6531|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6532|      0|    }
 6533|     87|    else if (frame->nholes > 0) {
  ------------------
  |  Branch (6533:14): [True: 0, False: 87]
  ------------------
 6534|      0|      rc = frame_compact(frame, schunk);
 6535|      0|    }
 6536|     87|    frame->nholes = 0;
 6537|     87|    frame->holes_lost = false;
 6538|     87|  }
 6539|     87|  int unlock_rc = frame_unlock(frame);
 6540|     87|  return rc < 0 ? rc : unlock_rc;
  ------------------
  |  Branch (6540:10): [True: 0, False: 87]
  ------------------
 6541|     87|}
frame_decompress_chunk:
 6872|  1.20k|int frame_decompress_chunk(blosc2_context *dctx, blosc2_frame_s* frame, int64_t nchunk, void *dest, int32_t nbytes) {
 6873|  1.20k|  uint8_t* src = NULL;
 6874|  1.20k|  bool needs_free = false;
 6875|  1.20k|  int32_t srcsize;
 6876|  1.20k|  int32_t chunk_nbytes;
 6877|  1.20k|  int32_t chunk_cbytes;
 6878|  1.20k|  int rc;
 6879|       |
 6880|  1.20k|  size_t capacity = 0;
 6881|  1.20k|  rc = get_chunk(frame, nchunk, &src, &needs_free, &capacity);
 6882|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (6882:7): [True: 0, False: 1.20k]
  ------------------
 6883|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6884|      0|    goto end;
 6885|      0|  }
 6886|  1.20k|  srcsize = rc;
 6887|  1.20k|  if (srcsize < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (6887:7): [True: 0, False: 1.20k]
  ------------------
 6888|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6889|      0|    rc = BLOSC2_ERROR_READ_BUFFER;
 6890|      0|    goto end;
 6891|      0|  }
 6892|       |
 6893|  1.20k|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 6894|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (6894:7): [True: 0, False: 1.20k]
  ------------------
 6895|      0|    goto end;
 6896|      0|  }
 6897|       |  /* The header cbytes is used as srcsize below, so it must fit in what was read */
 6898|  1.20k|  if (chunk_cbytes > srcsize) {
  ------------------
  |  Branch (6898:7): [True: 0, False: 1.20k]
  ------------------
 6899|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6900|      0|    rc = BLOSC2_ERROR_INVALID_HEADER;
 6901|      0|    goto end;
 6902|      0|  }
 6903|       |
 6904|       |  /* Create a buffer for destination */
 6905|  1.20k|  if (chunk_nbytes > nbytes) {
  ------------------
  |  Branch (6905:7): [True: 0, False: 1.20k]
  ------------------
 6906|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6907|      0|    rc = BLOSC2_ERROR_WRITE_BUFFER;
 6908|      0|    goto end;
 6909|      0|  }
 6910|       |  /* And decompress it */
 6911|  1.20k|  dctx->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 6912|  1.20k|  int chunksize = rc = blosc2_decompress_ctx(dctx, src, chunk_cbytes, dest, nbytes);
 6913|  1.20k|  if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (6913:7): [True: 0, False: 1.20k]
  |  Branch (6913:24): [True: 0, False: 1.20k]
  ------------------
 6914|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6915|      0|    if (chunksize >= 0)
  ------------------
  |  Branch (6915:9): [True: 0, False: 0]
  ------------------
 6916|      0|      rc = BLOSC2_ERROR_FAILURE;
 6917|      0|  }
 6918|  1.20k|  end:
 6919|  1.20k|  if (needs_free) {
  ------------------
  |  Branch (6919:7): [True: 0, False: 1.20k]
  ------------------
 6920|      0|    blosc2_tmp_free(src, capacity);
 6921|      0|  }
 6922|  1.20k|  return rc;
 6923|  1.20k|}
frame.c:frame_writer_close_locked:
  424|    322|static void frame_writer_close_locked(blosc2_frame_s* frame) {
  425|    322|  if (frame->write_fp != NULL) {
  ------------------
  |  Branch (425:7): [True: 0, False: 322]
  ------------------
  426|       |    /* Only the filesystem backend ever populates write_fp */
  427|      0|    blosc2_stdio_close(frame->write_fp);
  428|      0|    frame->write_fp = NULL;
  429|      0|#if !defined(_WIN32)
  430|      0|    reader_cache_return();
  431|      0|#endif
  432|      0|  }
  433|       |  frame->write_fp_stale = false;
  434|    322|  frame->file_end = 0;
  435|    322|}
frame.c:frame_reader_close_locked:
  395|    322|static bool frame_reader_close_locked(blosc2_frame_s* frame, bool force) {
  396|    322|  if (frame->read_fp == NULL) {
  ------------------
  |  Branch (396:7): [True: 322, False: 0]
  ------------------
  397|    322|    return true;
  398|    322|  }
  399|      0|  if (frame->read_fp_refs > 0 && !force) {
  ------------------
  |  Branch (399:7): [True: 0, False: 0]
  |  Branch (399:34): [True: 0, False: 0]
  ------------------
  400|       |    /* A caller up the stack is reading through it (frame_to_schunk holds it
  401|       |       across its whole chunk loop, and that loop re-enters get_header_info).
  402|       |       Closing it here would hand that caller a dangling handle, and its own
  403|       |       release would then close it a second time.  Leave it: the operation in
  404|       |       flight finishes on the file it started on, and the next revalidate --
  405|       |       past that release -- drops it. */
  406|      0|    return false;
  407|      0|  }
  408|       |  /* read_fp only ever comes from the filesystem backend, so close it directly:
  409|       |     blosc2_get_io_cb() would return NULL after a blosc2_destroy(), and then the
  410|       |     descriptor would leak while its cache slot got handed back anyway. */
  411|      0|  blosc2_stdio_close(frame->read_fp);
  412|      0|  frame->read_fp = NULL;
  413|      0|  frame->read_fp_refs = 0;
  414|      0|#if !defined(_WIN32)
  415|      0|  reader_cache_return();
  416|      0|#endif
  417|       |  return true;
  418|      0|}
frame.c:frame_alloc:
  288|    322|static blosc2_frame_s* frame_alloc(void) {
  289|    322|  blosc2_frame_s* frame = calloc(1, sizeof(blosc2_frame_s));
  290|    322|  if (frame != NULL) {
  ------------------
  |  Branch (290:7): [True: 322, False: 0]
  ------------------
  291|    322|    blosc2_pthread_mutex_init(&frame->read_fp_mutex, NULL);
  ------------------
  |  |   90|    322|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
  292|    322|  }
  293|    322|  return frame;
  294|    322|}
frame.c:frame_refresh_if_stale:
 1405|  3.25k|static int frame_refresh_if_stale(blosc2_frame_s *frame, int64_t frame_len_on_disk) {
 1406|  3.25k|  if (frame->cframe != NULL || frame->schunk == NULL ||
  ------------------
  |  Branch (1406:7): [True: 3.25k, False: 0]
  |  Branch (1406:32): [True: 0, False: 0]
  ------------------
 1407|  3.25k|      (!frame->force_refresh && frame_len_on_disk == frame->len)) {
  ------------------
  |  Branch (1407:8): [True: 0, False: 0]
  |  Branch (1407:33): [True: 0, False: 0]
  ------------------
 1408|  3.25k|    return 0;
 1409|  3.25k|  }
 1410|       |  // Saved so the metalayer-reload retry loop below can roll back to a fully
 1411|       |  // consistent state on exhaustion, rather than leaving frame->len/trailer_len
 1412|       |  // committed to the new value with no metalayers to match it.
 1413|      0|  int64_t old_len = frame->len;
 1414|      0|  uint32_t old_trailer_len = frame->trailer_len;
 1415|       |
 1416|      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 (1416:7): [True: 0, False: 0]
  ------------------
 1417|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1418|      0|    return BLOSC2_ERROR_FILE_READ;
 1419|      0|  }
 1420|       |
 1421|       |  // Read and validate the trailer *before* mutating any frame state below,
 1422|       |  // so a transient torn read (a writer without locking has no coordination
 1423|       |  // preventing a reader from landing mid-rewrite here -- the documented
 1424|       |  // SWMR-without-locking tradeoff) can be handled opportunistically: keep
 1425|       |  // the old cached view and let the next access retry, the same way
 1426|       |  // frame_check_stale()'s header read already does a few lines up in the
 1427|       |  // caller. Once frame->len/coffsets are overwritten below, a failure
 1428|       |  // partway through would leave the frame in a self-inconsistent state
 1429|       |  // (new length, stale trailer/offsets), so those mutations only happen
 1430|       |  // after the trailer is confirmed good.
 1431|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1432|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1432:7): [True: 0, False: 0]
  ------------------
 1433|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1434|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1435|      0|  }
 1436|      0|  void* fp;
 1437|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1437:7): [True: 0, False: 0]
  ------------------
 1438|      0|    fp = sframe_open_index(frame->urlpath, "rb", frame->schunk->storage->io);
 1439|      0|  }
 1440|      0|  else {
 1441|      0|    fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 1442|      0|  }
 1443|      0|  if (fp == NULL) {
  ------------------
  |  Branch (1443:7): [True: 0, False: 0]
  ------------------
 1444|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1445|      0|    return BLOSC2_ERROR_FILE_OPEN;
 1446|      0|  }
 1447|      0|  uint8_t trailer[FRAME_TRAILER_MINLEN];
 1448|      0|  uint8_t* trailer_ptr = trailer;
 1449|      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)
  ------------------
 1450|      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)
  ------------------
 1451|      0|  frame_reader_release(frame, io_cb, fp);
 1452|      0|  if (rbytes != FRAME_TRAILER_MINLEN) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1452:7): [True: 0, False: 0]
  ------------------
 1453|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1454|      0|    return 0;  // opportunistic: transient, keep the cached view, retry later
 1455|      0|  }
 1456|      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)
  ------------------
 1457|      0|  if (trailer_ptr[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (1457:7): [True: 0, False: 0]
  ------------------
 1458|       |    // Not a valid trailer; most likely we are reading a frame in the middle of
 1459|       |    // being rewritten by another handle without locking (locked handles
 1460|       |    // fully serialize, so this only happens under the no-locking contract).
 1461|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1462|      0|    return 0;  // opportunistic, same reasoning as above
 1463|      0|  }
 1464|      0|  uint32_t trailer_len;
 1465|      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)
  ------------------
 1466|      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 (1466:7): [True: 0, False: 0]
  |  Branch (1466:45): [True: 0, False: 0]
  ------------------
 1467|      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 (1467:7): [True: 0, False: 0]
  ------------------
 1468|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1469|      0|    return 0;  // opportunistic, same reasoning as above
 1470|      0|  }
 1471|       |
 1472|       |  // Trailer confirmed good: now safe to commit the new length. The lock
 1473|       |  // generation counter (see frame_lock) may have flagged a mutation that
 1474|       |  // left the frame length unchanged; only clear that flag here, once a
 1475|       |  // refresh has actually happened -- clearing it earlier and then bailing
 1476|       |  // out opportunistically above would permanently lose a same-length
 1477|       |  // mutation notification on a torn-read retry. The cached offsets index is
 1478|       |  // dropped further down, only once the metalayer/vlmetalayer reload below
 1479|       |  // has actually succeeded -- neither of those touches frame->coffsets, so
 1480|       |  // deferring this keeps the old view of it fully intact for the
 1481|       |  // opportunistic rollback path below, exactly as strong as the trailer
 1482|       |  // read's own bail-outs above.
 1483|      0|  frame->force_refresh = false;
 1484|      0|  frame->len = frame_len_on_disk;
 1485|      0|  frame->file_end = 0;  // another handle wrote the file; its size is unknown again
 1486|      0|  if (frame->nholes > 0) {
  ------------------
  |  Branch (1486:7): [True: 0, False: 0]
  ------------------
 1487|       |    // Nor do we know its free space any more (only an unlocked writer gets here inside frame_begin_updates())
 1488|      0|    frame->nholes = 0;
 1489|      0|    frame->holes_lost = true;
 1490|      0|  }
 1491|      0|  frame->trailer_len = trailer_len;
 1492|       |
 1493|       |  // The header metalayers and trailer vlmetalayers were cached at open time;
 1494|       |  // reload them so metadata changes made by another handle (e.g. a b2nd shape
 1495|       |  // update) become visible too.  The guard protects against re-entering from
 1496|       |  // the reload path itself (get_header_info does not refresh, but cheap
 1497|       |  // insurance against future changes there).
 1498|       |  //
 1499|       |  // frame_get_metalayers()/frame_get_vlmetalayers() each do their own fully
 1500|       |  // independent header/trailer re-read (separate from the trailer read
 1501|       |  // above), so without locking they can hit the same transient torn-read
 1502|       |  // window. Unlike that trailer read, there's no way to validate first and
 1503|       |  // commit after: schunk_free_metalayers()/schunk_free_vlmetalayers() must
 1504|       |  // run before a reload attempt (the parsers write straight into
 1505|       |  // schunk->metalayers[]/vlmetalayers[] as they go), so a single failed
 1506|       |  // attempt already discards the old cached set. Retry a bounded number of
 1507|       |  // times -- both free helpers are NULL-safe and re-run cleanly against a
 1508|       |  // partial prior attempt, and each attempt is a fresh independent read, so
 1509|       |  // this self-heals once the writer's rewrite stabilizes.
 1510|       |  //
 1511|       |  // This reasoning only holds without locking, though: frame_check_stale()
 1512|       |  // (the only caller) holds the shared frame lock across this entire call
 1513|       |  // when frame->locking is set, which fully excludes writers for its
 1514|       |  // duration -- so under locking a reload failure here cannot be a torn
 1515|       |  // read, it is a genuine problem (corruption or a real I/O error), and
 1516|       |  // retrying 50 times would just waste ~50ms holding that shared lock
 1517|       |  // before silently masking it. Retry once (i.e. don't retry) and propagate
 1518|       |  // the error under locking; keep the opportunistic bounded retry + silent
 1519|       |  // rollback for the no-locking case only.
 1520|       |  //
 1521|       |  // On exhaustion in the no-locking case, roll back frame->len/trailer_len
 1522|       |  // to what they were before this call and force a full retry on the next
 1523|       |  // poll (frame->force_refresh = true) -- otherwise frame_len_on_disk ==
 1524|       |  // frame->len would short-circuit every subsequent call at the top of this
 1525|       |  // function, permanently stranding this handle with an empty metalayer set.
 1526|      0|  if (!frame->refreshing) {
  ------------------
  |  Branch (1526:7): [True: 0, False: 0]
  ------------------
 1527|      0|    frame->refreshing = true;
 1528|      0|    int rc = -1;
 1529|      0|    const int max_attempts = frame->locking ? 1 : 50;
  ------------------
  |  Branch (1529:30): [True: 0, False: 0]
  ------------------
 1530|      0|    for (int attempt = 0; attempt < max_attempts; attempt++) {
  ------------------
  |  Branch (1530:27): [True: 0, False: 0]
  ------------------
 1531|      0|      schunk_free_metalayers(frame->schunk);
 1532|      0|      rc = frame_get_metalayers(frame, frame->schunk);
 1533|      0|      if (rc >= 0) {
  ------------------
  |  Branch (1533:11): [True: 0, False: 0]
  ------------------
 1534|      0|        schunk_free_vlmetalayers(frame->schunk);
 1535|      0|        rc = frame_get_vlmetalayers(frame, frame->schunk);
 1536|      0|      }
 1537|      0|      if (rc >= 0 || attempt + 1 == max_attempts) {
  ------------------
  |  Branch (1537:11): [True: 0, False: 0]
  |  Branch (1537:22): [True: 0, False: 0]
  ------------------
 1538|      0|        break;
 1539|      0|      }
 1540|       |#if defined(_WIN32)
 1541|       |      Sleep(1);
 1542|       |#else
 1543|      0|      usleep(1000);
 1544|      0|#endif
 1545|      0|    }
 1546|      0|    frame->refreshing = false;
 1547|      0|    if (rc < 0) {
  ------------------
  |  Branch (1547:9): [True: 0, False: 0]
  ------------------
 1548|      0|      if (frame->locking) {
  ------------------
  |  Branch (1548:11): [True: 0, False: 0]
  ------------------
 1549|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1550|      0|                          "(locked handle: this is not a transient race).");
 1551|      0|        return rc;
 1552|      0|      }
 1553|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1554|      0|                        "after retries; rolling back to the previous cached view.");
 1555|      0|      frame->len = old_len;
 1556|      0|      frame->trailer_len = old_trailer_len;
 1557|      0|      frame->force_refresh = true;
 1558|      0|      return 0;
 1559|      0|    }
 1560|      0|  }
 1561|      0|  frame->schunk->change_tick++;
 1562|       |
 1563|       |  // Cached offsets index invalidated only now, after a fully successful
 1564|       |  // refresh: recomputed lazily from the fresh trailer on demand.
 1565|      0|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (1565:7): [True: 0, False: 0]
  ------------------
 1566|      0|    if (frame->coffsets_needs_free) {
  ------------------
  |  Branch (1566:9): [True: 0, False: 0]
  ------------------
 1567|      0|      free(frame->coffsets);
 1568|      0|    }
 1569|      0|    frame->coffsets = NULL;
 1570|      0|  }
 1571|       |
 1572|      0|  return 1;
 1573|      0|}
frame.c:get_coffsets_nbytes:
 1620|    127|                               int32_t *coffsets_nbytes, const blosc2_io *io) {
 1621|    127|  int32_t chunk_cbytes;
 1622|    127|  int rc;
 1623|    127|  int64_t off_pos = header_len;
 1624|    127|  if (!frame->sframe) {
  ------------------
  |  Branch (1624:7): [True: 127, False: 0]
  ------------------
 1625|    127|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (1625:9): [True: 125, False: 2]
  ------------------
 1626|    125|      off_pos += cbytes;
 1627|    125|    }
 1628|    127|  }
 1629|       |
 1630|    127|  if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (1630:7): [True: 3, False: 124]
  |  Branch (1630:22): [True: 0, False: 124]
  ------------------
 1631|    124|      off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (1631:7): [True: 2, False: 122]
  ------------------
 1632|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1633|      5|    return BLOSC2_ERROR_INVALID_HEADER;
 1634|      5|  }
 1635|       |
 1636|    122|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1636:7): [True: 122, False: 0]
  ------------------
 1637|    122|    uint8_t *off_start = frame->cframe + off_pos;
 1638|    122|    rc = blosc2_cbuffer_sizes(off_start, coffsets_nbytes, &chunk_cbytes, NULL);
 1639|    122|    if (rc < 0) {
  ------------------
  |  Branch (1639:9): [True: 4, False: 118]
  ------------------
 1640|      4|      return rc;
 1641|      4|    }
 1642|    118|    if (chunk_cbytes < 0 || off_pos + chunk_cbytes > frame->len) {
  ------------------
  |  Branch (1642:9): [True: 0, False: 118]
  |  Branch (1642:29): [True: 0, False: 118]
  ------------------
 1643|      0|      BLOSC_TRACE_ERROR("Cannot read the cbytes 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1644|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 1645|      0|    }
 1646|    118|    return 0;
 1647|    118|  }
 1648|       |
 1649|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 1650|      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 (1650:7): [True: 0, False: 0]
  |  Branch (1650:56): [True: 0, False: 0]
  ------------------
 1651|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1652|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1653|      0|  }
 1654|       |
 1655|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
 1656|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1656:7): [True: 0, False: 0]
  ------------------
 1657|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1658|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1659|      0|  }
 1660|       |
 1661|      0|  uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 1662|      0|  uint8_t *header_ptr = header;
 1663|      0|  void *fp = NULL;
 1664|      0|  int64_t io_pos = 0;
 1665|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1665:7): [True: 0, False: 0]
  ------------------
 1666|      0|    fp = sframe_open_index(frame->urlpath, "rb", io);
 1667|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1667:9): [True: 0, False: 0]
  ------------------
 1668|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1669|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1670|      0|    }
 1671|      0|    io_pos = off_pos;
 1672|      0|  }
 1673|      0|  else {
 1674|      0|    fp = frame_reader_acquire(frame, io);
 1675|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1675:9): [True: 0, False: 0]
  ------------------
 1676|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1677|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1678|      0|    }
 1679|      0|    io_pos = frame->file_offset + off_pos;
 1680|      0|  }
 1681|      0|  int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 1682|      0|  frame_reader_release(frame, io_cb, fp);
 1683|      0|  if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (1683:7): [True: 0, False: 0]
  ------------------
 1684|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1685|      0|    return BLOSC2_ERROR_FILE_READ;
 1686|      0|  }
 1687|       |
 1688|      0|  rc = blosc2_cbuffer_sizes(header_ptr, coffsets_nbytes, &chunk_cbytes, NULL);
 1689|      0|  if (rc < 0) {
  ------------------
  |  Branch (1689:7): [True: 0, False: 0]
  ------------------
 1690|      0|    return rc;
 1691|      0|  }
 1692|       |
 1693|      0|  if (chunk_cbytes < 0 || off_pos + chunk_cbytes > trailer_offset) {
  ------------------
  |  Branch (1693:7): [True: 0, False: 0]
  |  Branch (1693:27): [True: 0, False: 0]
  ------------------
 1694|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1695|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1696|      0|  }
 1697|       |
 1698|      0|  return 0;
 1699|      0|}
frame.c:get_meta_from_header:
 2763|     90|                                int32_t header_len) {
 2764|     90|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|     90|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2765|     90|  int64_t header_pos = FRAME_IDX_SIZE;
  ------------------
  |  |   51|     90|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|     90|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|     90|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|     90|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|     90|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|     90|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|     90|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|     90|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|     90|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|     90|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|     90|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|     90|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|     90|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|     90|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|     90|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|     90|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2766|       |
 2767|       |  // Get the size for the index of metalayers
 2768|     90|  uint16_t idx_size;
 2769|     90|  header_pos += sizeof(idx_size);
 2770|     90|  if (header_len < header_pos) {
  ------------------
  |  Branch (2770:7): [True: 0, False: 90]
  ------------------
 2771|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2772|      0|  }
 2773|     90|  from_big(&idx_size, header + FRAME_IDX_SIZE, sizeof(idx_size));
  ------------------
  |  |   38|     90|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2774|       |
 2775|       |  // Get the actual index of metalayers
 2776|     90|  uint8_t* metalayers_idx = header + FRAME_IDX_SIZE + 2;
  ------------------
  |  |   51|     90|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|     90|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|     90|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|     90|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|     90|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|     90|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|     90|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|     90|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|     90|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|     90|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|     90|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|     90|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|     90|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|     90|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|     90|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|     90|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2777|     90|  header_pos += 1;
 2778|     90|  if (header_len < header_pos) {
  ------------------
  |  Branch (2778:7): [True: 0, False: 90]
  ------------------
 2779|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2780|      0|  }
 2781|     90|  if (metalayers_idx[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2781:7): [True: 1, False: 89]
  ------------------
 2782|      1|    return BLOSC2_ERROR_DATA;
 2783|      1|  }
 2784|     89|  uint8_t* idxp = metalayers_idx + 1;
 2785|     89|  uint16_t nmetalayers;
 2786|     89|  header_pos += sizeof(nmetalayers);
 2787|     89|  if (header_len < header_pos) {
  ------------------
  |  Branch (2787:7): [True: 1, False: 88]
  ------------------
 2788|      1|    return BLOSC2_ERROR_READ_BUFFER;
 2789|      1|  }
 2790|     88|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|     88|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2791|     88|  idxp += 2;
 2792|     88|  if (nmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1895|     88|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (2792:7): [True: 0, False: 88]
  ------------------
 2793|      0|    return BLOSC2_ERROR_DATA;
 2794|      0|  }
 2795|     88|  schunk->nmetalayers = nmetalayers;
 2796|       |
 2797|       |  // Populate the metalayers and its serialized values
 2798|    173|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2798:28): [True: 85, False: 88]
  ------------------
 2799|     85|    header_pos += 1;
 2800|     85|    if (header_len < header_pos) {
  ------------------
  |  Branch (2800:9): [True: 0, False: 85]
  ------------------
 2801|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2802|      0|    }
 2803|     85|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (2803:9): [True: 0, False: 85]
  ------------------
 2804|      0|      return BLOSC2_ERROR_DATA;
 2805|      0|    }
 2806|     85|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 2807|     85|    if (metalayer == NULL) {
  ------------------
  |  Branch (2807:9): [True: 0, False: 85]
  ------------------
 2808|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2809|      0|    }
 2810|     85|    schunk->metalayers[nmetalayer] = metalayer;
 2811|       |
 2812|       |    // Populate the metalayer string
 2813|     85|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 2814|     85|    idxp += 1;
 2815|     85|    header_pos += nslen;
 2816|     85|    if (header_len < header_pos) {
  ------------------
  |  Branch (2816:9): [True: 0, False: 85]
  ------------------
 2817|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2818|      0|    }
 2819|     85|    char* ns = malloc((size_t)nslen + 1);
 2820|     85|    if (ns == NULL) {
  ------------------
  |  Branch (2820:9): [True: 0, False: 85]
  ------------------
 2821|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2822|      0|    }
 2823|     85|    memcpy(ns, idxp, nslen);
 2824|     85|    ns[nslen] = '\0';
 2825|     85|    idxp += nslen;
 2826|     85|    metalayer->name = ns;
 2827|       |
 2828|       |    // Populate the serialized value for this metalayer
 2829|       |    // Get the offset
 2830|     85|    header_pos += 1;
 2831|     85|    if (header_len < header_pos) {
  ------------------
  |  Branch (2831:9): [True: 0, False: 85]
  ------------------
 2832|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2833|      0|    }
 2834|     85|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (2834:9): [True: 0, False: 85]
  ------------------
 2835|      0|      return BLOSC2_ERROR_DATA;
 2836|      0|    }
 2837|     85|    idxp += 1;
 2838|     85|    int32_t offset;
 2839|     85|    header_pos += sizeof(offset);
 2840|     85|    if (header_len < header_pos) {
  ------------------
  |  Branch (2840:9): [True: 0, False: 85]
  ------------------
 2841|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2842|      0|    }
 2843|     85|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|     85|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2844|     85|    idxp += 4;
 2845|     85|    if (offset < 0 || offset >= header_len) {
  ------------------
  |  Branch (2845:9): [True: 0, False: 85]
  |  Branch (2845:23): [True: 0, False: 85]
  ------------------
 2846|       |      // Offset is less than zero or exceeds header length
 2847|      0|      return BLOSC2_ERROR_DATA;
 2848|      0|    }
 2849|       |    // Go to offset and see if we have the correct marker
 2850|     85|    uint8_t* content_marker = header + offset;
 2851|     85|    if ((int64_t)header_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (2851:9): [True: 0, False: 85]
  ------------------
 2852|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2853|      0|    }
 2854|     85|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (2854:9): [True: 0, False: 85]
  ------------------
 2855|      0|      return BLOSC2_ERROR_DATA;
 2856|      0|    }
 2857|       |
 2858|       |    // Read the size of the content
 2859|     85|    int32_t content_len;
 2860|     85|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|     85|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2861|     85|    if (content_len < 0) {
  ------------------
  |  Branch (2861:9): [True: 0, False: 85]
  ------------------
 2862|      0|      return BLOSC2_ERROR_DATA;
 2863|      0|    }
 2864|     85|    metalayer->content_len = content_len;
 2865|       |
 2866|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 2867|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 2868|       |    // bounds check, which would let memcpy below read past the header buffer.
 2869|     85|    if ((int64_t)header_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (2869:9): [True: 0, False: 85]
  ------------------
 2870|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2871|      0|    }
 2872|     85|    char* content = malloc((size_t)content_len);
 2873|       |    // malloc(0) is allowed to return NULL, and blosc2_meta_add accepts
 2874|       |    // content_len == 0, so only treat NULL as an allocation failure when
 2875|       |    // a non-zero allocation was requested.
 2876|     85|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (2876:9): [True: 85, False: 0]
  |  Branch (2876:28): [True: 0, False: 85]
  ------------------
 2877|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 2878|      0|    }
 2879|     85|    if (content_len > 0) {
  ------------------
  |  Branch (2879:9): [True: 85, False: 0]
  ------------------
 2880|     85|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 2881|     85|    }
 2882|     85|    metalayer->content = (uint8_t*)content;
 2883|     85|  }
 2884|       |
 2885|     88|  return 1;
 2886|     88|}
frame.c:get_vlmeta_from_trailer:
 2966|     85|                                   int32_t trailer_len) {
 2967|       |
 2968|     85|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|     85|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2969|     85|  int64_t trailer_pos = FRAME_TRAILER_VLMETALAYERS + 2;
  ------------------
  |  |   60|     85|#define FRAME_TRAILER_VLMETALAYERS (2)
  ------------------
 2970|     85|  uint8_t* idxp = trailer + trailer_pos;
 2971|       |
 2972|       |  // Get the size for the index of metalayers
 2973|     85|  trailer_pos += 2;
 2974|     85|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2974:7): [True: 0, False: 85]
  ------------------
 2975|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2976|      0|  }
 2977|     85|  uint16_t idx_size;
 2978|     85|  from_big(&idx_size, idxp, sizeof(idx_size));
  ------------------
  |  |   38|     85|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2979|     85|  idxp += 2;
 2980|       |
 2981|     85|  trailer_pos += 1;
 2982|       |  // Get the actual index of metalayers
 2983|     85|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2983:7): [True: 0, False: 85]
  ------------------
 2984|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2985|      0|  }
 2986|     85|  if (idxp[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2986:7): [True: 0, False: 85]
  ------------------
 2987|      0|    return BLOSC2_ERROR_DATA;
 2988|      0|  }
 2989|     85|  idxp += 1;
 2990|       |
 2991|       |  // The on-wire encoding is unsigned (uint16 follows the msgpack `0xde`
 2992|       |  // map16 marker), but `schunk->nvlmetalayers` is int16_t. Decoding into a
 2993|       |  // signed local would let raw bytes like 0xff 0xff slip past the
 2994|       |  // `> BLOSC2_MAX_VLMETALAYERS` ceiling as a negative count, after which
 2995|       |  // a later `blosc2_vlmeta_add` would write through `vlmetalayers[-1]`
 2996|       |  // and corrupt adjacent schunk fields. Decode unsigned, then narrow.
 2997|     85|  uint16_t nmetalayers;
 2998|     85|  trailer_pos += sizeof(nmetalayers);
 2999|     85|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (2999:7): [True: 0, False: 85]
  ------------------
 3000|      0|    return BLOSC2_ERROR_READ_BUFFER;
 3001|      0|  }
 3002|     85|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|     85|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3003|     85|  idxp += 2;
 3004|     85|  if (nmetalayers > BLOSC2_MAX_VLMETALAYERS) {
  ------------------
  |  | 1901|     85|#define BLOSC2_MAX_VLMETALAYERS (8 * 1024)
  ------------------
  |  Branch (3004:7): [True: 0, False: 85]
  ------------------
 3005|      0|    return BLOSC2_ERROR_DATA;
 3006|      0|  }
 3007|     85|  schunk->nvlmetalayers = (int16_t)nmetalayers;
 3008|       |
 3009|       |  // Populate the metalayers and its serialized values
 3010|     85|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (3010:28): [True: 0, False: 85]
  ------------------
 3011|      0|    trailer_pos += 1;
 3012|      0|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3012:9): [True: 0, False: 0]
  ------------------
 3013|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3014|      0|    }
 3015|      0|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (3015:9): [True: 0, False: 0]
  ------------------
 3016|      0|      return BLOSC2_ERROR_DATA;
 3017|      0|    }
 3018|      0|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 3019|      0|    if (metalayer == NULL) {
  ------------------
  |  Branch (3019:9): [True: 0, False: 0]
  ------------------
 3020|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3021|      0|    }
 3022|      0|    schunk->vlmetalayers[nmetalayer] = metalayer;
 3023|       |
 3024|       |    // Populate the metalayer string
 3025|      0|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 3026|      0|    idxp += 1;
 3027|      0|    trailer_pos += nslen;
 3028|      0|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3028:9): [True: 0, False: 0]
  ------------------
 3029|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3030|      0|    }
 3031|      0|    char* ns = malloc((size_t)nslen + 1);
 3032|      0|    if (ns == NULL) {
  ------------------
  |  Branch (3032:9): [True: 0, False: 0]
  ------------------
 3033|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3034|      0|    }
 3035|      0|    memcpy(ns, idxp, nslen);
 3036|      0|    ns[nslen] = '\0';
 3037|      0|    idxp += nslen;
 3038|      0|    metalayer->name = ns;
 3039|       |
 3040|       |    // Populate the serialized value for this metalayer
 3041|       |    // Get the offset
 3042|      0|    trailer_pos += 1;
 3043|      0|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3043:9): [True: 0, False: 0]
  ------------------
 3044|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3045|      0|    }
 3046|      0|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (3046:9): [True: 0, False: 0]
  ------------------
 3047|      0|      return BLOSC2_ERROR_DATA;
 3048|      0|    }
 3049|      0|    idxp += 1;
 3050|      0|    int32_t offset;
 3051|      0|    trailer_pos += sizeof(offset);
 3052|      0|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3052:9): [True: 0, False: 0]
  ------------------
 3053|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3054|      0|    }
 3055|      0|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|      0|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3056|      0|    idxp += 4;
 3057|      0|    if (offset < 0 || offset >= trailer_len) {
  ------------------
  |  Branch (3057:9): [True: 0, False: 0]
  |  Branch (3057:23): [True: 0, False: 0]
  ------------------
 3058|       |      // Offset is less than zero or exceeds trailer length
 3059|      0|      return BLOSC2_ERROR_DATA;
 3060|      0|    }
 3061|       |    // Go to offset and see if we have the correct marker
 3062|      0|    uint8_t* content_marker = trailer + offset;
 3063|      0|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (3063:9): [True: 0, False: 0]
  ------------------
 3064|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3065|      0|    }
 3066|      0|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (3066:9): [True: 0, False: 0]
  ------------------
 3067|      0|      return BLOSC2_ERROR_DATA;
 3068|      0|    }
 3069|       |
 3070|       |    // Read the size of the content
 3071|      0|    int32_t content_len;
 3072|      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)
  ------------------
 3073|      0|    if (content_len < 0) {
  ------------------
  |  Branch (3073:9): [True: 0, False: 0]
  ------------------
 3074|      0|      return BLOSC2_ERROR_DATA;
 3075|      0|    }
 3076|      0|    metalayer->content_len = content_len;
 3077|       |
 3078|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 3079|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 3080|       |    // bounds check, which would let memcpy below read past the trailer buffer.
 3081|      0|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (3081:9): [True: 0, False: 0]
  ------------------
 3082|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3083|      0|    }
 3084|      0|    char* content = malloc((size_t)content_len);
 3085|       |    // Same zero-length carve-out as in get_meta_from_header: malloc(0) may
 3086|       |    // return NULL on some platforms, and the public API allows
 3087|       |    // content_len == 0, so don't reject a valid empty vlmetalayer.
 3088|      0|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (3088:9): [True: 0, False: 0]
  |  Branch (3088:28): [True: 0, False: 0]
  ------------------
 3089|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3090|      0|    }
 3091|      0|    if (content_len > 0) {
  ------------------
  |  Branch (3091:9): [True: 0, False: 0]
  ------------------
 3092|      0|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 3093|      0|    }
 3094|      0|    metalayer->content = (uint8_t*)content;
 3095|      0|  }
 3096|     85|  return 1;
 3097|     85|}
frame.c:validate_offsets_chunk:
 3255|    215|                                  int64_t nchunks) {
 3256|    215|  int32_t coffsets_cbytes = 0;
 3257|    215|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 3258|    215|  if (coffsets == NULL) {
  ------------------
  |  Branch (3258:7): [True: 21, False: 194]
  ------------------
 3259|     21|    BLOSC_TRACE_ERROR("Cannot get compressed offsets from frame.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3260|     21|    return BLOSC2_ERROR_DATA;
 3261|     21|  }
 3262|       |
 3263|    194|  int32_t offsets_nbytes;
 3264|    194|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (3264:7): [True: 0, False: 194]
  ------------------
 3265|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3266|      0|    return BLOSC2_ERROR_FAILURE;
 3267|      0|  }
 3268|       |
 3269|    194|  int64_t* offsets = (int64_t*)malloc((size_t)offsets_nbytes);
 3270|    194|  if (offsets == NULL) {
  ------------------
  |  Branch (3270:7): [True: 0, False: 194]
  ------------------
 3271|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3272|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 3273|      0|  }
 3274|       |
 3275|    194|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 3276|    194|  blosc2_context* dctx = blosc2_create_dctx(off_dparams);
 3277|    194|  if (dctx == NULL) {
  ------------------
  |  Branch (3277:7): [True: 0, False: 194]
  ------------------
 3278|      0|    free(offsets);
 3279|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3280|      0|    return BLOSC2_ERROR_FAILURE;
 3281|      0|  }
 3282|       |
 3283|    194|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 3284|    194|                                             offsets, offsets_nbytes);
 3285|    194|  blosc2_free_ctx(dctx);
 3286|    194|  if (off_nbytes != offsets_nbytes) {
  ------------------
  |  Branch (3286:7): [True: 77, False: 117]
  ------------------
 3287|     77|    free(offsets);
 3288|     77|    BLOSC_TRACE_ERROR("Cannot decompress offsets chunk.");
  ------------------
  |  |   93|     77|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     77|    do {                                            \
  |  |  |  |   98|     77|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     77|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 77, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     77|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3289|     77|    return BLOSC2_ERROR_DATA;
 3290|     77|  }
 3291|       |
 3292|   271M|  for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (3292:23): [True: 271M, False: 92]
  ------------------
 3293|   271M|    int64_t offset = offsets[i];
 3294|   271M|    if (offset < 0) {
  ------------------
  |  Branch (3294:9): [True: 271M, False: 629]
  ------------------
 3295|   271M|      continue;
 3296|   271M|    }
 3297|    629|    if (offset > INT64_MAX - header_len || offset > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3297:9): [True: 0, False: 629]
  |  Branch (3297:44): [True: 25, False: 604]
  ------------------
 3298|     25|      free(offsets);
 3299|     25|      BLOSC_TRACE_ERROR("Offset for chunk %" PRId64 " is out of bounds.", i);
  ------------------
  |  |   93|     25|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     25|    do {                                            \
  |  |  |  |   98|     25|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     25|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 25, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     25|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3300|     25|      return BLOSC2_ERROR_INVALID_HEADER;
 3301|     25|    }
 3302|       |    /* Offsets do not need to be monotonic.  Frame mutations like insert can append
 3303|       |     * chunk payloads at the end of the cframe while updating the logical chunk order
 3304|       |     * only in the offsets table, so a valid frame may legitimately contain
 3305|       |     * non-monotonic non-negative offsets.
 3306|       |     */
 3307|    629|  }
 3308|       |
 3309|     92|  free(offsets);
 3310|     92|  return 0;
 3311|    117|}
frame.c:frame_read_index_span:
 3711|    170|                                 int64_t *cbytes, int32_t *chunksize) {
 3712|    170|  *off = NULL;
 3713|    170|  int64_t frame_len;
 3714|    170|  int64_t frame_nbytes;
 3715|    170|  int32_t blocksize;
 3716|    170|  int64_t frame_nchunks;
 3717|    170|  int rc = get_header_info(frame, header_len, &frame_len, &frame_nbytes, cbytes, &blocksize, chunksize,
 3718|    170|                           &frame_nchunks, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3719|    170|                           frame->schunk->storage->io);
 3720|    170|  if (rc < 0) {
  ------------------
  |  Branch (3720:7): [True: 0, False: 170]
  ------------------
 3721|      0|    return rc;
 3722|      0|  }
 3723|       |  // A different handle may have changed the index, including a same-length
 3724|       |  // reorder flagged by frame_lock().  Refresh before reusing cached offsets.
 3725|    170|  rc = frame_refresh_if_stale(frame, frame_len);
 3726|    170|  if (rc < 0) {
  ------------------
  |  Branch (3726:7): [True: 0, False: 170]
  ------------------
 3727|      0|    return rc;
 3728|      0|  }
 3729|    170|  if (rc > 0) {
  ------------------
  |  Branch (3729:7): [True: 0, False: 170]
  ------------------
 3730|      0|    frame->schunk->nbytes = frame_nbytes;
 3731|      0|    frame->schunk->cbytes = *cbytes;
 3732|      0|    frame->schunk->nchunks = frame_nchunks;
 3733|      0|  }
 3734|    170|  int64_t hi = -1;
 3735|    170|  *lo = INT64_MAX;
 3736|  1.37k|  for (int64_t k = 0; k < n; ++k) {
  ------------------
  |  Branch (3736:23): [True: 1.20k, False: 170]
  ------------------
 3737|  1.20k|    if (nchunks[k] < 0 || nchunks[k] >= frame_nchunks) {
  ------------------
  |  Branch (3737:9): [True: 0, False: 1.20k]
  |  Branch (3737:27): [True: 0, False: 1.20k]
  ------------------
 3738|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3739|      0|                        nchunks[k], frame_nchunks);
 3740|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 3741|      0|    }
 3742|  1.20k|    *lo = nchunks[k] < *lo ? nchunks[k] : *lo;
  ------------------
  |  Branch (3742:11): [True: 170, False: 1.03k]
  ------------------
 3743|  1.20k|    hi = nchunks[k] > hi ? nchunks[k] : hi;
  ------------------
  |  Branch (3743:10): [True: 1.20k, False: 0]
  ------------------
 3744|  1.20k|  }
 3745|    170|  if (n <= 0) {
  ------------------
  |  Branch (3745:7): [True: 0, False: 170]
  ------------------
 3746|      0|    return BLOSC2_ERROR_SUCCESS;
 3747|      0|  }
 3748|    170|  int32_t off_cbytes;
 3749|    170|  uint8_t *coffsets = get_coffsets(frame, *header_len, *cbytes, frame_nchunks, &off_cbytes);
 3750|    170|  if (coffsets == NULL) {
  ------------------
  |  Branch (3750:7): [True: 0, False: 170]
  ------------------
 3751|      0|    return BLOSC2_ERROR_DATA;
 3752|      0|  }
 3753|    170|  *span_end = hi + 1 + lookahead < frame_nchunks ? hi + 1 + lookahead : frame_nchunks;
  ------------------
  |  Branch (3753:15): [True: 0, False: 170]
  ------------------
 3754|    170|  *off = malloc((size_t) (*span_end - *lo) * sizeof(int64_t));
 3755|    170|  if (*off == NULL) {
  ------------------
  |  Branch (3755:7): [True: 0, False: 170]
  ------------------
 3756|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 3757|      0|  }
 3758|    170|  rc = blosc2_getitem(coffsets, off_cbytes, (int32_t) *lo, (int32_t) (*span_end - *lo), *off,
 3759|    170|                      (int32_t) ((*span_end - *lo) * sizeof(int64_t)));
 3760|    170|  if (rc < 0) {
  ------------------
  |  Branch (3760:7): [True: 0, False: 170]
  ------------------
 3761|      0|    free(*off);
 3762|      0|    *off = NULL;
 3763|      0|    return rc;
 3764|      0|  }
 3765|    170|  return BLOSC2_ERROR_SUCCESS;
 3766|    170|}
frame.c:special_chunk_into:
 3842|    659|                              uint8_t* dest, int32_t cbytes) {
 3843|    659|  int rc = 0;
 3844|       |
 3845|       |  // Detect the kind of special value
 3846|    659|  uint64_t zeros_mask = (uint64_t) BLOSC2_SPECIAL_ZERO << (8 * 7);  // chunk of zeros
 3847|    659|  uint64_t nans_mask = (uint64_t) BLOSC2_SPECIAL_NAN << (8 * 7);  // chunk of NaNs
 3848|    659|  uint64_t uninit_mask = (uint64_t) BLOSC2_SPECIAL_UNINIT << (8 * 7);  // chunk of uninit values
 3849|       |
 3850|    659|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
 3851|    659|  cparams.typesize = typesize;
 3852|    659|  cparams.blocksize = blocksize;
 3853|    659|  if (special_value & zeros_mask) {
  ------------------
  |  Branch (3853:7): [True: 659, False: 0]
  ------------------
 3854|    659|    rc = blosc2_chunk_zeros(cparams, nbytes, dest, cbytes);
 3855|    659|    if (rc < 0) {
  ------------------
  |  Branch (3855:9): [True: 0, False: 659]
  ------------------
 3856|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3857|      0|    }
 3858|    659|  }
 3859|      0|  else if (special_value & uninit_mask) {
  ------------------
  |  Branch (3859:12): [True: 0, False: 0]
  ------------------
 3860|      0|    rc = blosc2_chunk_uninit(cparams, nbytes, dest, cbytes);
 3861|      0|    if (rc < 0) {
  ------------------
  |  Branch (3861:9): [True: 0, False: 0]
  ------------------
 3862|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3863|      0|    }
 3864|      0|  }
 3865|      0|  else if (special_value & nans_mask) {
  ------------------
  |  Branch (3865:12): [True: 0, False: 0]
  ------------------
 3866|      0|    rc = blosc2_chunk_nans(cparams, nbytes, dest, cbytes);
 3867|      0|    if (rc < 0) {
  ------------------
  |  Branch (3867:9): [True: 0, False: 0]
  ------------------
 3868|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3869|      0|    }
 3870|      0|  }
 3871|      0|  else {
 3872|       |    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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3873|      0|    rc = BLOSC2_ERROR_DATA;
 3874|      0|  }
 3875|    659|  return rc;
 3876|    659|}
frame.c:get_chunk:
 3910|  1.20k|                     size_t *capacity) {
 3911|  1.20k|  if (capacity != NULL) {
  ------------------
  |  Branch (3911:7): [True: 1.20k, False: 0]
  ------------------
 3912|  1.20k|    *capacity = 0;
 3913|  1.20k|  }
 3914|  1.20k|  int32_t header_len;
 3915|  1.20k|  int64_t frame_len;
 3916|  1.20k|  int64_t nbytes;
 3917|  1.20k|  int64_t cbytes;
 3918|  1.20k|  int32_t blocksize;
 3919|  1.20k|  int32_t chunksize;
 3920|  1.20k|  int64_t nchunks;
 3921|  1.20k|  int32_t typesize;
 3922|  1.20k|  int64_t offset;
 3923|  1.20k|  int32_t chunk_cbytes;
 3924|  1.20k|  int rc;
 3925|       |
 3926|  1.20k|  *chunk = NULL;
 3927|  1.20k|  *needs_free = false;
 3928|  1.20k|  rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3929|  1.20k|                       &blocksize, &chunksize, &nchunks,
 3930|  1.20k|                       &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3931|  1.20k|                       frame->schunk->storage->io);
 3932|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (3932:7): [True: 0, False: 1.20k]
  ------------------
 3933|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3934|      0|    return rc;
 3935|      0|  }
 3936|  1.20k|  rc = frame_refresh_if_stale(frame, frame_len);
 3937|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (3937:7): [True: 0, False: 1.20k]
  ------------------
 3938|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3939|      0|    return rc;
 3940|      0|  }
 3941|  1.20k|  if (rc > 0) {
  ------------------
  |  Branch (3941:7): [True: 0, False: 1.20k]
  ------------------
 3942|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state.
 3943|       |    // Mutating ops (update/delete) read a chunk before adjusting the counters,
 3944|       |    // so this also gives them a fresh base to apply their deltas on.
 3945|      0|    frame->schunk->nbytes = nbytes;
 3946|      0|    frame->schunk->cbytes = cbytes;
 3947|      0|    frame->schunk->nchunks = nchunks;
 3948|      0|  }
 3949|       |
 3950|  1.20k|  if ((nchunks > 0) && (nchunk >= nchunks)) {
  ------------------
  |  Branch (3950:7): [True: 1.20k, False: 0]
  |  Branch (3950:24): [True: 0, False: 1.20k]
  ------------------
 3951|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3952|      0|                    "('%" PRId64 "') in frame.", nchunk, nchunks);
 3953|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 3954|      0|  }
 3955|       |
 3956|       |  // Get the offset to nchunk
 3957|  1.20k|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 3958|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (3958:7): [True: 0, False: 1.20k]
  ------------------
 3959|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3960|      0|    return rc;
 3961|      0|  }
 3962|       |
 3963|  1.20k|  if (offset < 0) {
  ------------------
  |  Branch (3963:7): [True: 0, False: 1.20k]
  ------------------
 3964|       |    // Special value
 3965|      0|    if (chunksize <= 0) {
  ------------------
  |  Branch (3965:9): [True: 0, False: 0]
  ------------------
 3966|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3967|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3968|      0|    }
 3969|      0|    chunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 3970|      0|    int32_t chunksize_ = chunksize;
 3971|      0|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (3971:9): [True: 0, False: 0]
  |  Branch (3971:36): [True: 0, False: 0]
  ------------------
 3972|       |      // Last chunk is incomplete.  Compute its actual size.
 3973|      0|      chunksize_ = (int32_t) (nbytes % chunksize);
 3974|      0|    }
 3975|      0|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk, chunk_cbytes, needs_free);
 3976|      0|    if (rc < 0) {
  ------------------
  |  Branch (3976:9): [True: 0, False: 0]
  ------------------
 3977|      0|      return rc;
 3978|      0|    }
 3979|      0|    goto end;
 3980|      0|  }
 3981|       |
 3982|  1.20k|  if (frame->sframe) {
  ------------------
  |  Branch (3982:7): [True: 0, False: 1.20k]
  ------------------
 3983|       |    // Sparse on-disk
 3984|      0|    nchunk = offset;
 3985|      0|    return sframe_get_chunk(frame, nchunk, chunk, needs_free);
 3986|      0|  }
 3987|       |
 3988|  1.20k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3989|  1.20k|  if (io_cb == NULL) {
  ------------------
  |  Branch (3989:7): [True: 0, False: 1.20k]
  ------------------
 3990|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3991|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 3992|      0|  }
 3993|       |
 3994|  1.20k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3994:7): [True: 0, False: 1.20k]
  ------------------
 3995|      0|    uint8_t* header_ptr;
 3996|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 3997|      0|    void* fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 3998|      0|    if (fp == NULL) {
  ------------------
  |  Branch (3998:9): [True: 0, False: 0]
  ------------------
 3999|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4000|      0|      return BLOSC2_ERROR_FILE_OPEN;
 4001|      0|    }
 4002|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (4002:9): [True: 0, False: 0]
  ------------------
 4003|      0|      header_ptr = header;
 4004|      0|    int64_t io_pos = frame->file_offset + header_len + offset;
 4005|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, sizeof(header), io_pos, fp);
 4006|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4006:9): [True: 0, False: 0]
  ------------------
 4007|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4008|      0|      frame_reader_release(frame, io_cb, fp);
 4009|      0|      return BLOSC2_ERROR_FILE_READ;
 4010|      0|    }
 4011|      0|    rc = blosc2_cbuffer_sizes(header_ptr, NULL, &chunk_cbytes, NULL);
 4012|      0|    if (rc < 0) {
  ------------------
  |  Branch (4012:9): [True: 0, False: 0]
  ------------------
 4013|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4014|      0|      frame_reader_release(frame, io_cb, fp);
 4015|      0|      return rc;
 4016|      0|    }
 4017|      0|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4017:9): [True: 0, False: 0]
  ------------------
 4018|      0|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (4018:9): [True: 0, False: 0]
  ------------------
 4019|      0|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (4019:9): [True: 0, False: 0]
  ------------------
 4020|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4021|      0|      frame_reader_release(frame, io_cb, fp);
 4022|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4023|      0|    }
 4024|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (4024:9): [True: 0, False: 0]
  ------------------
 4025|      0|      *chunk = capacity != NULL ? blosc2_tmp_malloc(chunk_cbytes, capacity) : malloc(chunk_cbytes);
  ------------------
  |  Branch (4025:16): [True: 0, False: 0]
  ------------------
 4026|      0|      if (*chunk == NULL) {
  ------------------
  |  Branch (4026:11): [True: 0, False: 0]
  ------------------
 4027|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4028|      0|        frame_reader_release(frame, io_cb, fp);
 4029|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 4030|      0|      }
 4031|      0|      *needs_free = true;
 4032|      0|    }
 4033|      0|    else {
 4034|      0|      *needs_free = false;
 4035|      0|    }
 4036|       |
 4037|      0|    io_pos = frame->file_offset + header_len + offset;
 4038|      0|    rbytes = io_cb->read((void**)chunk, 1, chunk_cbytes, io_pos, fp);
 4039|      0|    frame_reader_release(frame, io_cb, fp);
 4040|      0|    if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (4040:9): [True: 0, False: 0]
  ------------------
 4041|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4042|      0|      if (*needs_free) {
  ------------------
  |  Branch (4042:11): [True: 0, False: 0]
  ------------------
 4043|      0|        free(*chunk);
 4044|      0|        *chunk = NULL;
 4045|      0|        *needs_free = false;
 4046|      0|      }
 4047|      0|      return BLOSC2_ERROR_FILE_READ;
 4048|      0|    }
 4049|       |
 4050|  1.20k|  } else {
 4051|       |    // The chunk is in memory and just one pointer away
 4052|  1.20k|    *chunk = frame->cframe + header_len + offset;
 4053|  1.20k|    int32_t chunk_blocksize = 0;
 4054|  1.20k|    rc = blosc2_cbuffer_sizes(*chunk, NULL, &chunk_cbytes, &chunk_blocksize);
 4055|  1.20k|    if (rc < 0) {
  ------------------
  |  Branch (4055:9): [True: 0, False: 1.20k]
  ------------------
 4056|      0|      return rc;
 4057|      0|    }
 4058|  1.20k|    if (chunk_blocksize <= 0) {
  ------------------
  |  Branch (4058:9): [True: 0, False: 1.20k]
  ------------------
 4059|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4060|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4061|      0|    }
 4062|  1.20k|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4062:9): [True: 0, False: 1.20k]
  ------------------
 4063|  1.20k|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (4063:9): [True: 0, False: 1.20k]
  ------------------
 4064|  1.20k|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (4064:9): [True: 0, False: 1.20k]
  ------------------
 4065|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4066|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4067|      0|    }
 4068|  1.20k|  }
 4069|       |
 4070|  1.20k|  end:
 4071|  1.20k|  return (int32_t)chunk_cbytes;
 4072|  1.20k|}
frame.c:get_frame_fields:
 4489|  1.17k|static int get_frame_fields(blosc2_frame_s* frame, frame_fields* f) {
 4490|  1.17k|  int64_t frame_len;
 4491|  1.17k|  int rc = get_header_info(frame, &f->header_len, &frame_len, &f->nbytes, &f->cbytes, &f->blocksize,
 4492|  1.17k|                           &f->chunksize, &f->nchunks, &f->typesize, NULL, NULL, NULL, NULL, NULL, NULL,
 4493|  1.17k|                           NULL, frame->schunk->storage->io);
 4494|  1.17k|  if (rc < 0) {
  ------------------
  |  Branch (4494:7): [True: 0, False: 1.17k]
  ------------------
 4495|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4496|      0|    return rc;
 4497|      0|  }
 4498|  1.17k|  rc = frame_refresh_if_stale(frame, frame_len);
 4499|  1.17k|  if (rc < 0) {
  ------------------
  |  Branch (4499:7): [True: 0, False: 1.17k]
  ------------------
 4500|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4501|      0|    return rc;
 4502|      0|  }
 4503|  1.17k|  if (rc > 0) {
  ------------------
  |  Branch (4503:7): [True: 0, False: 1.17k]
  ------------------
 4504|      0|    frame->schunk->nbytes = f->nbytes;
 4505|      0|    frame->schunk->cbytes = f->cbytes;
 4506|      0|    frame->schunk->nchunks = f->nchunks;
 4507|      0|  }
 4508|  1.17k|  return BLOSC2_ERROR_SUCCESS;
 4509|  1.17k|}
frame.c:read_frame_chunk_header:
 4518|  1.17k|                                   uint8_t* header, int64_t* offset) {
 4519|  1.17k|  if (nchunk < 0 || nchunk >= f->nchunks) {
  ------------------
  |  Branch (4519:7): [True: 0, False: 1.17k]
  |  Branch (4519:21): [True: 0, False: 1.17k]
  ------------------
 4520|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4521|      0|                      "('%" PRId64 "') in frame.", nchunk, f->nchunks);
 4522|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4523|      0|  }
 4524|  1.17k|  int rc = get_coffset(frame, f->header_len, f->cbytes, nchunk, f->nchunks, offset);
 4525|  1.17k|  if (rc < 0) {
  ------------------
  |  Branch (4525:7): [True: 0, False: 1.17k]
  ------------------
 4526|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4527|      0|    return rc;
 4528|      0|  }
 4529|  1.17k|  if (*offset < 0) {
  ------------------
  |  Branch (4529:7): [True: 659, False: 519]
  ------------------
 4530|    659|    if (f->chunksize <= 0) {
  ------------------
  |  Branch (4530:9): [True: 0, False: 659]
  ------------------
 4531|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4532|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4533|      0|    }
 4534|    659|    int32_t chunksize = f->chunksize;
 4535|    659|    if ((nchunk == f->nchunks - 1) && (f->nbytes % f->chunksize)) {
  ------------------
  |  Branch (4535:9): [True: 88, False: 571]
  |  Branch (4535:39): [True: 0, False: 88]
  ------------------
 4536|       |      // Last chunk is incomplete.  Compute its actual size.
 4537|      0|      chunksize = (int32_t) (f->nbytes % f->chunksize);
 4538|      0|    }
 4539|    659|    return special_chunk_into(*offset, chunksize, f->typesize, f->blocksize, header,
 4540|    659|                              BLOSC_EXTENDED_HEADER_LENGTH);
 4541|    659|  }
 4542|       |
 4543|    519|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (4543:7): [True: 519, False: 0]
  ------------------
 4544|       |    // get_coffset() checked that the header is inside the frame
 4545|    519|    memcpy(header, frame->cframe + f->header_len + *offset, BLOSC_EXTENDED_HEADER_LENGTH);
 4546|    519|  }
 4547|      0|  else {
 4548|      0|    blosc2_io_cb* io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 4549|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (4549:9): [True: 0, False: 0]
  ------------------
 4550|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4551|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 4552|      0|    }
 4553|      0|    void* chunk_fp = fp;
 4554|      0|    int64_t io_pos = frame->file_offset + f->header_len + *offset;
 4555|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4555:9): [True: 0, False: 0]
  ------------------
 4556|      0|      chunk_fp = sframe_open_chunk(frame->urlpath, *offset, "rb", frame->schunk->storage->io);
 4557|      0|      io_pos = 0;
 4558|      0|    }
 4559|      0|    else if (fp == NULL) {
  ------------------
  |  Branch (4559:14): [True: 0, False: 0]
  ------------------
 4560|      0|      chunk_fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 4561|      0|    }
 4562|      0|    if (chunk_fp == NULL) {
  ------------------
  |  Branch (4562:9): [True: 0, False: 0]
  ------------------
 4563|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4564|      0|      return BLOSC2_ERROR_FILE_OPEN;
 4565|      0|    }
 4566|      0|    uint8_t* header_ptr = header;
 4567|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, chunk_fp);
 4568|      0|    if (rbytes == BLOSC_EXTENDED_HEADER_LENGTH && header_ptr != header) {
  ------------------
  |  Branch (4568:9): [True: 0, False: 0]
  |  Branch (4568:51): [True: 0, False: 0]
  ------------------
 4569|      0|      memcpy(header, header_ptr, BLOSC_EXTENDED_HEADER_LENGTH);
 4570|      0|    }
 4571|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4571:9): [True: 0, False: 0]
  ------------------
 4572|      0|      io_cb->close(chunk_fp);
 4573|      0|    }
 4574|      0|    else if (fp == NULL) {
  ------------------
  |  Branch (4574:14): [True: 0, False: 0]
  ------------------
 4575|      0|      frame_reader_release(frame, io_cb, chunk_fp);
 4576|      0|    }
 4577|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4577:9): [True: 0, False: 0]
  ------------------
 4578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4579|      0|      return BLOSC2_ERROR_FILE_READ;
 4580|      0|    }
 4581|      0|  }
 4582|    519|  int32_t chunk_cbytes;
 4583|    519|  rc = blosc2_cbuffer_sizes(header, NULL, &chunk_cbytes, NULL);
 4584|    519|  if (rc < 0) {
  ------------------
  |  Branch (4584:7): [True: 0, False: 519]
  ------------------
 4585|      0|    return rc;
 4586|      0|  }
 4587|    519|  int64_t chunk_end;
 4588|    519|  if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4588:7): [True: 0, False: 519]
  ------------------
 4589|    519|      (!frame->sframe && (!blosc2_checked_add_i64_nonneg(*offset, chunk_cbytes, &chunk_end) ||
  ------------------
  |  Branch (4589:8): [True: 519, False: 0]
  |  Branch (4589:27): [True: 0, False: 519]
  ------------------
 4590|    519|                          chunk_end > f->cbytes))) {
  ------------------
  |  Branch (4590:27): [True: 0, False: 519]
  ------------------
 4591|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4592|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 4593|      0|  }
 4594|    519|  return chunk_cbytes;
 4595|    519|}
frame.c:compress_offsets:
 4803|    604|                                uint8_t** off_chunk) {
 4804|    604|  *off_chunk = NULL;
 4805|    604|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
 4806|    604|  cparams.splitmode = BLOSC_NEVER_SPLIT;
 4807|    604|  cparams.typesize = sizeof(int64_t);
 4808|    604|  cparams.blocksize = 16 * 1024;  // based on experiments with create_frame.c bench
 4809|    604|  cparams.nthreads = 4;  // 4 threads seems a decent default for nowadays CPUs
 4810|    604|  cparams.compcode = BLOSC_BLOSCLZ;
 4811|    604|  blosc2_context* cctx = blosc2_create_cctx(cparams);
 4812|    604|  if (cctx == NULL) {
  ------------------
  |  Branch (4812:7): [True: 0, False: 604]
  ------------------
 4813|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4814|      0|    return BLOSC2_ERROR_NULL_POINTER;
 4815|      0|  }
 4816|    604|  cctx->typesize = sizeof(int64_t);  // override a possible BLOSC_TYPESIZE env variable (or chaos may appear)
 4817|    604|  uint8_t* chunk = malloc((size_t)dest_nbytes);
 4818|    604|  if (chunk == NULL) {
  ------------------
  |  Branch (4818:7): [True: 0, False: 604]
  ------------------
 4819|      0|    blosc2_free_ctx(cctx);
 4820|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4821|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 4822|      0|  }
 4823|    604|  int32_t off_cbytes = blosc2_compress_ctx(cctx, offsets, off_nbytes, chunk, dest_nbytes);
 4824|    604|  blosc2_free_ctx(cctx);
 4825|    604|  if (off_cbytes < 0) {
  ------------------
  |  Branch (4825:7): [True: 0, False: 604]
  ------------------
 4826|      0|    free(chunk);
 4827|      0|    return off_cbytes;
 4828|      0|  }
 4829|    604|  *off_chunk = chunk;
 4830|    604|  return off_cbytes;
 4831|    604|}
frame.c:holes_place:
 5988|    604|                           int64_t* payload_end) {
 5989|    604|  int64_t start = *payload_end;
 5990|    604|  int64_t len = 0;
 5991|    604|  if (old_offset >= 0) {
  ------------------
  |  Branch (5991:7): [True: 0, False: 604]
  ------------------
 5992|      0|    holes_take_run(frame, old_offset, old_len, &start, &len);
 5993|      0|  }
 5994|    604|  if (start + len == *payload_end) {
  ------------------
  |  Branch (5994:7): [True: 604, False: 0]
  ------------------
 5995|    604|    *payload_end = start + new_len;
 5996|    604|    return start;
 5997|    604|  }
 5998|      0|  if (new_len <= len) {
  ------------------
  |  Branch (5998:7): [True: 0, False: 0]
  ------------------
 5999|      0|    holes_add(frame, start + new_len, len - new_len);
 6000|      0|    return start;
 6001|      0|  }
 6002|      0|  holes_add(frame, start, len);
 6003|      0|  int64_t offset = *payload_end;
 6004|      0|  *payload_end += new_len;
 6005|      0|  return offset;
 6006|      0|}

prefetch_set_populate:
   85|    243|void prefetch_set_populate(int mode) {
   86|    243|  g_populate = mode < 0 ? -1 : (mode > 0);
  ------------------
  |  Branch (86:16): [True: 243, False: 0]
  ------------------
   87|    243|}
prefetch_applies:
  133|    170|bool prefetch_applies(const blosc2_frame_s *frame) {
  134|    170|  return prefetch_enabled() && frame != NULL && frame->cframe == NULL && !frame->sframe && frame->urlpath != NULL &&
  ------------------
  |  Branch (134:10): [True: 0, False: 170]
  |  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|    170|}
prefetch_destroy:
  338|    243|void prefetch_destroy(void) {
  339|    243|  pthread_mutex_lock(&destroy_mutex);
  340|    243|  pthread_mutex_lock(&pool.mutex);
  341|    243|  if (pool.threads == NULL) {
  ------------------
  |  Branch (341:7): [True: 243, False: 0]
  ------------------
  342|    243|    pthread_mutex_unlock(&pool.mutex);
  343|    243|    pthread_mutex_unlock(&destroy_mutex);
  344|    243|    return;
  345|    243|  }
  346|      0|  pool.stop = true;
  347|      0|  pthread_cond_broadcast(&pool.work);
  348|      0|  int nthreads = pool.nthreads;
  349|      0|  pthread_t *threads = pool.threads;
  350|      0|  pool.threads = NULL;
  351|      0|  pool.nthreads = 0;
  352|      0|  pthread_mutex_unlock(&pool.mutex);
  353|       |
  354|      0|  for (int i = 0; i < nthreads; ++i) {
  ------------------
  |  Branch (354:19): [True: 0, False: 0]
  ------------------
  355|      0|    pthread_join(threads[i], NULL);
  356|      0|  }
  357|      0|  free(threads);
  358|       |
  359|      0|  pthread_mutex_lock(&pool.mutex);
  360|       |  pool.stop = false;
  361|      0|  pthread_mutex_unlock(&pool.mutex);
  362|      0|  pthread_mutex_unlock(&destroy_mutex);
  363|      0|}
prefetch_batch_wait:
  908|  1.81k|void prefetch_batch_wait(prefetch_batch *batch, int64_t nchunk) {
  909|  1.81k|  if (batch == NULL) {
  ------------------
  |  Branch (909:7): [True: 1.81k, False: 0]
  ------------------
  910|  1.81k|    return;
  911|  1.81k|  }
  912|      0|  pthread_mutex_lock(&pool.mutex);
  913|       |  // The slice reads the chunks in the order given, so this is mostly the next one
  914|      0|  for (int64_t k = 0; k < batch->nchunks; ++k) {
  ------------------
  |  Branch (914:23): [True: 0, False: 0]
  ------------------
  915|      0|    int64_t i = (batch->cursor + k) % batch->nchunks;
  916|      0|    if (batch->chunks[i] == nchunk) {
  ------------------
  |  Branch (916:9): [True: 0, False: 0]
  ------------------
  917|      0|      batch->cursor = i + 1;
  918|      0|      raise_limit(batch, batch->end_piece[i], batch->end_piece[i]);
  919|      0|      wait_pieces(batch, batch->end_piece[i]);
  920|      0|      break;
  921|      0|    }
  922|      0|  }
  923|      0|  pthread_mutex_unlock(&pool.mutex);
  924|      0|}
prefetch_batch_free:
  927|    257|void prefetch_batch_free(prefetch_batch *batch) {
  928|    257|  if (batch == NULL) {
  ------------------
  |  Branch (928:7): [True: 257, False: 0]
  ------------------
  929|    257|    return;
  930|    257|  }
  931|      0|  pthread_mutex_lock(&pool.mutex);
  932|      0|  batch->limit = batch->next;
  933|      0|  wait_pieces(batch, batch->next);
  934|      0|  prefetch_batch **link = &pool.batches;
  935|      0|  while (*link != batch) {
  ------------------
  |  Branch (935:10): [True: 0, False: 0]
  ------------------
  936|      0|    link = &(*link)->next_batch;
  937|      0|  }
  938|      0|  *link = batch->next_batch;
  939|      0|  pool.nbatches--;
  940|      0|  pthread_mutex_unlock(&pool.mutex);
  941|      0|  pthread_cond_destroy(&batch->progress);
  942|      0|  close(batch->fd);
  943|      0|  free(batch);
  944|      0|}
prefetch.c:prefetch_enabled:
  128|    170|static bool prefetch_enabled(void) {
  129|    170|  return g_nthreads > 0 && blosc2_is_initialized();
  ------------------
  |  Branch (129:10): [True: 0, False: 170]
  |  Branch (129:28): [True: 0, False: 0]
  ------------------
  130|    170|}

blosc2_schunk_get_cparams:
   73|    393|int blosc2_schunk_get_cparams(blosc2_schunk *schunk, blosc2_cparams **cparams) {
   74|    393|  *cparams = calloc(1, sizeof(blosc2_cparams));
   75|    393|  (*cparams)->schunk = schunk;
   76|  2.75k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (76:19): [True: 2.35k, False: 393]
  ------------------
   77|  2.35k|    (*cparams)->filters[i] = schunk->filters[i];
   78|  2.35k|    (*cparams)->filters_meta[i] = schunk->filters_meta[i];
   79|  2.35k|  }
   80|    393|  (*cparams)->compcode = schunk->compcode;
   81|    393|  (*cparams)->compcode_meta = schunk->compcode_meta;
   82|    393|  (*cparams)->clevel = schunk->clevel;
   83|    393|  (*cparams)->typesize = schunk->typesize;
   84|    393|  (*cparams)->blocksize = schunk->blocksize;
   85|    393|  (*cparams)->splitmode = schunk->splitmode;
   86|    393|  (*cparams)->use_dict = schunk->use_dict;
   87|    393|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (87:7): [True: 221, False: 172]
  ------------------
   88|    221|    (*cparams)->nthreads = blosc2_get_nthreads();
   89|    221|  }
   90|    172|  else {
   91|    172|    (*cparams)->nthreads = (int16_t)schunk->cctx->nthreads;
   92|    172|  }
   93|    393|  return 0;
   94|    393|}
blosc2_schunk_get_dparams:
   98|    220|int blosc2_schunk_get_dparams(blosc2_schunk *schunk, blosc2_dparams **dparams) {
   99|    220|  *dparams = calloc(1, sizeof(blosc2_dparams));
  100|    220|  (*dparams)->schunk = schunk;
  101|    220|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (101:7): [True: 220, False: 0]
  ------------------
  102|    220|    (*dparams)->nthreads = blosc2_get_nthreads();
  103|    220|  }
  104|      0|  else {
  105|      0|    (*dparams)->nthreads = schunk->dctx->nthreads;
  106|      0|  }
  107|    220|  return 0;
  108|    220|}
update_schunk_properties:
  111|     87|int update_schunk_properties(struct blosc2_schunk* schunk) {
  112|     87|  blosc2_cparams* cparams = schunk->storage->cparams;
  113|     87|  blosc2_dparams* dparams = schunk->storage->dparams;
  114|       |
  115|    609|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (115:19): [True: 522, False: 87]
  ------------------
  116|    522|    schunk->filters[i] = cparams->filters[i];
  117|    522|    schunk->filters_meta[i] = cparams->filters_meta[i];
  118|    522|  }
  119|     87|  schunk->compcode = cparams->compcode;
  120|     87|  schunk->compcode_meta = cparams->compcode_meta;
  121|     87|  schunk->clevel = cparams->clevel;
  122|     87|  schunk->splitmode = cparams->splitmode;
  123|     87|  schunk->use_dict = (uint8_t)cparams->use_dict;
  124|     87|  schunk->typesize = cparams->typesize;
  125|     87|  schunk->blocksize = cparams->blocksize;
  126|     87|  schunk->chunksize = -1;
  127|     87|  schunk->flags2 = 0;
  128|     87|  schunk->tuner_params = cparams->tuner_params;
  129|     87|  schunk->tuner_id = cparams->tuner_id;
  130|     87|  if (cparams->tuner_id == BLOSC_BTUNE) {
  ------------------
  |  Branch (130:7): [True: 0, False: 87]
  ------------------
  131|      0|    cparams->use_dict = 0;
  132|      0|  }
  133|       |  /* The compression context */
  134|     87|  if (schunk->cctx != NULL) {
  ------------------
  |  Branch (134:7): [True: 0, False: 87]
  ------------------
  135|      0|    blosc2_free_ctx(schunk->cctx);
  136|      0|  }
  137|     87|  cparams->schunk = schunk;
  138|     87|  schunk->cctx = blosc2_create_cctx(*cparams);
  139|     87|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (139:7): [True: 0, False: 87]
  ------------------
  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|     87|  if (schunk->dctx != NULL) {
  ------------------
  |  Branch (145:7): [True: 0, False: 87]
  ------------------
  146|      0|    blosc2_free_ctx(schunk->dctx);
  147|      0|  }
  148|     87|  dparams->schunk = schunk;
  149|     87|  schunk->dctx = blosc2_create_dctx(*dparams);
  150|     87|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (150:7): [True: 0, False: 87]
  ------------------
  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|     87|  return BLOSC2_ERROR_SUCCESS;
  156|     87|}
blosc2_schunk_new:
  166|     87|blosc2_schunk* blosc2_schunk_new(blosc2_storage *storage) {
  167|     87|  blosc2_schunk* schunk = calloc(1, sizeof(blosc2_schunk));
  168|     87|  schunk->version = 0;     /* pre-first version */
  169|     87|  schunk->view = false;  /* not a view by default */
  170|       |
  171|       |  // Get the storage with proper defaults
  172|     87|  schunk->storage = get_new_storage(storage, &BLOSC2_CPARAMS_DEFAULTS, &BLOSC2_DPARAMS_DEFAULTS, &BLOSC2_IO_DEFAULTS);
  173|       |  // Update the (local variable) storage
  174|     87|  storage = schunk->storage;
  175|       |
  176|     87|  char* tradeoff = getenv("BTUNE_TRADEOFF");
  177|     87|  if (tradeoff != NULL) {
  ------------------
  |  Branch (177:7): [True: 0, False: 87]
  ------------------
  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|     87|  if (update_schunk_properties(schunk) < 0) {
  ------------------
  |  Branch (183:7): [True: 0, False: 87]
  ------------------
  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|     87|  if (!storage->contiguous && storage->urlpath != NULL){
  ------------------
  |  Branch (189:7): [True: 0, False: 87]
  |  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|     87|  if (storage->contiguous){
  ------------------
  |  Branch (225:7): [True: 87, False: 0]
  ------------------
  226|       |    // We want a contiguous frame as storage
  227|     87|    if (storage->urlpath != NULL) {
  ------------------
  |  Branch (227:9): [True: 0, False: 87]
  ------------------
  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|     87|    blosc2_frame_s* frame = frame_new(storage->urlpath);
  235|     87|    if (frame == NULL) {
  ------------------
  |  Branch (235:9): [True: 0, False: 87]
  ------------------
  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|     87|    frame->sframe = false;
  241|     87|    frame_set_locking(frame, schunk->storage->io);
  242|       |    // Initialize frame (basically, encode the header)
  243|     87|    frame->schunk = schunk;
  244|     87|    int64_t frame_len = frame_from_schunk(schunk, frame);
  245|     87|    if (frame_len < 0) {
  ------------------
  |  Branch (245:9): [True: 0, False: 87]
  ------------------
  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|     87|    schunk->frame = (blosc2_frame*)frame;
  252|     87|  }
  253|       |
  254|     87|  return schunk;
  255|     87|}
blosc2_schunk_to_buffer:
  567|     85|int64_t blosc2_schunk_to_buffer(blosc2_schunk* schunk, uint8_t** dest, bool* needs_free) {
  568|     85|  blosc2_frame_s* frame;
  569|     85|  int64_t cframe_len;
  570|       |
  571|       |  // Initialize defaults in case of errors
  572|     85|  *dest = NULL;
  573|     85|  *needs_free = false;
  574|       |
  575|     85|  if ((schunk->storage->contiguous == true) && (schunk->storage->urlpath == NULL)) {
  ------------------
  |  Branch (575:7): [True: 85, False: 0]
  |  Branch (575:48): [True: 85, False: 0]
  ------------------
  576|     85|    frame =  (blosc2_frame_s*)(schunk->frame);
  577|     85|    *dest = frame->cframe;
  578|     85|    cframe_len = frame->len;
  579|     85|    *needs_free = false;
  580|     85|  }
  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|     85|  return cframe_len;
  598|       |
  599|     85|}
schunk_free_metalayers:
  790|    322|void schunk_free_metalayers(blosc2_schunk *schunk) {
  791|    494|  for (int i = 0; i < schunk->nmetalayers; i++) {
  ------------------
  |  Branch (791:19): [True: 172, False: 322]
  ------------------
  792|    172|    if (schunk->metalayers[i] != NULL) {
  ------------------
  |  Branch (792:9): [True: 172, False: 0]
  ------------------
  793|    172|      free(schunk->metalayers[i]->name);
  794|    172|      free(schunk->metalayers[i]->content);
  795|    172|      free(schunk->metalayers[i]);
  796|       |      schunk->metalayers[i] = NULL;
  797|    172|    }
  798|    172|  }
  799|    322|  schunk->nmetalayers = 0;
  800|    322|}
schunk_free_vlmetalayers:
  803|    322|void schunk_free_vlmetalayers(blosc2_schunk *schunk) {
  804|    322|  for (int i = 0; i < schunk->nvlmetalayers; i++) {
  ------------------
  |  Branch (804:19): [True: 0, False: 322]
  ------------------
  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|    322|  schunk->nvlmetalayers = 0;
  813|    322|}
blosc2_schunk_free:
  816|    322|int blosc2_schunk_free(blosc2_schunk *schunk) {
  817|    322|  int err = 0;
  818|       |
  819|       |  // If it is a view, the data belongs to original array and should not be freed
  820|    322|  if (schunk->data != NULL && !schunk->view) {
  ------------------
  |  Branch (820:7): [True: 0, False: 322]
  |  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|    322|  if (schunk->cctx != NULL)
  ------------------
  |  Branch (826:7): [True: 307, False: 15]
  ------------------
  827|    307|    blosc2_free_ctx(schunk->cctx);
  828|    322|  if (schunk->dctx != NULL)
  ------------------
  |  Branch (828:7): [True: 307, False: 15]
  ------------------
  829|    307|    blosc2_free_ctx(schunk->dctx);
  830|    322|  if (schunk->blockshape != NULL)
  ------------------
  |  Branch (830:7): [True: 0, False: 322]
  ------------------
  831|      0|    free(schunk->blockshape);
  832|       |
  833|    322|  schunk_free_metalayers(schunk);
  834|       |
  835|    322|  if (schunk->storage != NULL) {
  ------------------
  |  Branch (835:7): [True: 307, False: 15]
  ------------------
  836|    307|    blosc2_io_cb *io_cb = blosc2_get_io_cb(schunk->storage->io->id);
  837|    307|    if (io_cb != NULL) {
  ------------------
  |  Branch (837:9): [True: 307, False: 0]
  ------------------
  838|    307|      int rc = io_cb->destroy(schunk->storage->io->params);
  839|    307|      if (rc < 0) {
  ------------------
  |  Branch (839:11): [True: 0, False: 307]
  ------------------
  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|    307|    }
  844|       |
  845|    307|    if (schunk->storage->urlpath != NULL) {
  ------------------
  |  Branch (845:9): [True: 0, False: 307]
  ------------------
  846|      0|      free(schunk->storage->urlpath);
  847|      0|    }
  848|    307|    free(schunk->storage->cparams);
  849|    307|    free(schunk->storage->dparams);
  850|    307|    free(schunk->storage->io);
  851|    307|    free(schunk->storage);
  852|    307|  }
  853|       |
  854|       |  // If it is a view, the frame belongs to original array and should not be freed
  855|    322|  if (schunk->frame != NULL && !schunk->view) {
  ------------------
  |  Branch (855:7): [True: 322, False: 0]
  |  Branch (855:32): [True: 322, False: 0]
  ------------------
  856|    322|    frame_free((blosc2_frame_s *) schunk->frame);
  857|    322|  }
  858|       |
  859|    322|  schunk_free_vlmetalayers(schunk);
  860|       |
  861|    322|  free(schunk);
  862|       |
  863|    322|  return err;
  864|    322|}
blosc2_schunk_from_buffer:
  868|    241|blosc2_schunk* blosc2_schunk_from_buffer(uint8_t *cframe, int64_t len, bool copy) {
  869|       |  // Check that the buffer actually comes from a cframe
  870|    241|  if (cframe == NULL || len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|    241|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    241|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    241|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    241|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    241|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    241|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    241|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    241|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    241|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    241|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    241|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    241|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    241|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    241|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (870:7): [True: 0, False: 241]
  |  Branch (870:25): [True: 0, False: 241]
  ------------------
  871|      0|    return NULL;
  872|      0|  }
  873|    241|  char *magic_number = (char *)cframe + FRAME_HEADER_MAGIC;
  ------------------
  |  |   29|    241|#define FRAME_HEADER_MAGIC 2
  ------------------
  874|    241|  if (memcmp(magic_number, "b2frame", sizeof("b2frame")) != 0) {
  ------------------
  |  Branch (874:7): [True: 4, False: 237]
  ------------------
  875|      4|    return NULL;
  876|      4|  }
  877|    237|  blosc2_frame_s* frame = frame_from_cframe(cframe, len, false);
  878|    237|  if (frame == NULL) {
  ------------------
  |  Branch (878:7): [True: 2, False: 235]
  ------------------
  879|      2|    return NULL;
  880|      2|  }
  881|    235|  blosc2_schunk* schunk = frame_to_schunk(frame, copy, &BLOSC2_IO_DEFAULTS);
  882|    235|  if (schunk && copy) {
  ------------------
  |  Branch (882:7): [True: 85, False: 150]
  |  Branch (882:17): [True: 0, False: 85]
  ------------------
  883|       |    // Super-chunk has its own copy of frame
  884|      0|    frame_free(frame);
  885|      0|  }
  886|    235|  return schunk;
  887|    237|}
blosc2_schunk_fill_special:
  942|     87|                               int32_t chunksize) {
  943|     87|  if (nitems == 0) {
  ------------------
  |  Branch (943:7): [True: 0, False: 87]
  ------------------
  944|      0|    return 0;
  945|      0|  }
  946|       |
  947|     87|  int32_t typesize = schunk->typesize;
  948|     87|  if (nitems < 0 || chunksize <= 0 || typesize <= 0) {
  ------------------
  |  Branch (948:7): [True: 0, False: 87]
  |  Branch (948:21): [True: 0, False: 87]
  |  Branch (948:39): [True: 0, False: 87]
  ------------------
  949|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  950|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  951|      0|  }
  952|       |
  953|     87|  if ((schunk->nbytes > 0) || (schunk->cbytes > 0)) {
  ------------------
  |  Branch (953:7): [True: 0, False: 87]
  |  Branch (953:31): [True: 0, False: 87]
  ------------------
  954|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  955|      0|    return BLOSC2_ERROR_FRAME_SPECIAL;
  956|      0|  }
  957|       |
  958|       |  // Compute the number of chunks and the length of the offsets chunk
  959|     87|  int32_t chunkitems = chunksize / typesize;
  960|     87|  if (chunkitems <= 0) {
  ------------------
  |  Branch (960:7): [True: 0, False: 87]
  ------------------
  961|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  962|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  963|      0|  }
  964|     87|  int64_t nchunks = nitems / chunkitems;
  965|     87|  if (nchunks > INT_MAX) {
  ------------------
  |  Branch (965:7): [True: 0, False: 87]
  ------------------
  966|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  967|      0|    return BLOSC2_ERROR_SCHUNK_SPECIAL;
  968|      0|  }
  969|     87|  if (!blosc2_checked_mul_i64_nonneg(nitems, typesize, NULL)) {
  ------------------
  |  Branch (969:7): [True: 0, False: 87]
  ------------------
  970|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  971|      0|    return BLOSC2_ERROR_SCHUNK_SPECIAL;
  972|      0|  }
  973|     87|  int32_t leftover_items = (int32_t)(nitems % chunkitems);
  974|       |
  975|     87|  if (schunk->frame == NULL) {
  ------------------
  |  Branch (975:7): [True: 0, False: 87]
  ------------------
  976|       |    // Build the special chunks
  977|      0|    int32_t leftover_size = leftover_items * typesize;
  978|      0|    void* chunk = malloc(BLOSC_EXTENDED_HEADER_LENGTH);
  979|      0|    void* chunk2 = malloc(BLOSC_EXTENDED_HEADER_LENGTH);
  980|      0|    blosc2_cparams* cparams;
  981|      0|    blosc2_schunk_get_cparams(schunk, &cparams);
  982|      0|    int csize, csize2;
  983|      0|    switch (special_value) {
  984|      0|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (984:7): [True: 0, False: 0]
  ------------------
  985|      0|        csize = blosc2_chunk_zeros(*cparams, chunksize, chunk, BLOSC_EXTENDED_HEADER_LENGTH);
  986|      0|        csize2 = blosc2_chunk_zeros(*cparams, leftover_size, chunk2, BLOSC_EXTENDED_HEADER_LENGTH);
  987|      0|        break;
  988|      0|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (988:7): [True: 0, False: 0]
  ------------------
  989|      0|        csize = blosc2_chunk_uninit(*cparams, chunksize, chunk, BLOSC_EXTENDED_HEADER_LENGTH);
  990|      0|        csize2 = blosc2_chunk_uninit(*cparams, leftover_size, chunk2, BLOSC_EXTENDED_HEADER_LENGTH);
  991|      0|        break;
  992|      0|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (992:7): [True: 0, False: 0]
  ------------------
  993|      0|        csize = blosc2_chunk_nans(*cparams, chunksize, chunk, BLOSC_EXTENDED_HEADER_LENGTH);
  994|      0|        csize2 = blosc2_chunk_nans(*cparams, leftover_size, chunk2, BLOSC_EXTENDED_HEADER_LENGTH);
  995|      0|        break;
  996|      0|      default:
  ------------------
  |  Branch (996:7): [True: 0, False: 0]
  ------------------
  997|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  998|      0|        return BLOSC2_ERROR_SCHUNK_SPECIAL;
  999|      0|    }
 1000|      0|    free(cparams);
 1001|      0|    if (csize < 0 || csize2 < 0) {
  ------------------
  |  Branch (1001:9): [True: 0, False: 0]
  |  Branch (1001:22): [True: 0, False: 0]
  ------------------
 1002|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1003|      0|      return BLOSC2_ERROR_SCHUNK_SPECIAL;
 1004|      0|    }
 1005|       |
 1006|      0|    for (int nchunk = 0; nchunk < nchunks; nchunk++) {
  ------------------
  |  Branch (1006:26): [True: 0, False: 0]
  ------------------
 1007|      0|      int64_t nchunk_ = blosc2_schunk_append_chunk(schunk, chunk, true);
 1008|      0|      if (nchunk_ != nchunk + 1) {
  ------------------
  |  Branch (1008:11): [True: 0, False: 0]
  ------------------
 1009|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1010|      0|        return BLOSC2_ERROR_SCHUNK_SPECIAL;
 1011|      0|      }
 1012|      0|    }
 1013|       |
 1014|      0|    if (leftover_items) {
  ------------------
  |  Branch (1014:9): [True: 0, False: 0]
  ------------------
 1015|      0|      int64_t nchunk_ = blosc2_schunk_append_chunk(schunk, chunk2, true);
 1016|      0|      if (nchunk_ != nchunks + 1) {
  ------------------
  |  Branch (1016:11): [True: 0, False: 0]
  ------------------
 1017|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1018|      0|        return BLOSC2_ERROR_SCHUNK_SPECIAL;
 1019|      0|      }
 1020|      0|    }
 1021|      0|    free(chunk);
 1022|      0|    free(chunk2);
 1023|      0|  }
 1024|     87|  else {
 1025|       |    /* Fill an empty frame with special values (fast path). */
 1026|     87|    blosc2_frame_s *frame = (blosc2_frame_s *) schunk->frame;
 1027|     87|    int64_t total_chunks = nchunks + (leftover_items ? 1 : 0);
  ------------------
  |  Branch (1027:39): [True: 0, False: 87]
  ------------------
 1028|     87|    if (!blosc2_nchunks_to_offsets_nbytes(total_chunks, NULL)) {
  ------------------
  |  Branch (1028:9): [True: 0, False: 87]
  ------------------
 1029|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1030|      0|      return BLOSC2_ERROR_FRAME_SPECIAL;
 1031|      0|    }
 1032|       |
 1033|     87|    int64_t old_nchunks = schunk->nchunks;
 1034|     87|    int64_t old_nbytes = schunk->nbytes;
 1035|     87|    int32_t old_chunksize = schunk->chunksize;
 1036|       |
 1037|       |    /* Update counters (necessary for the frame_fill_special() logic) */
 1038|     87|    if (leftover_items) {
  ------------------
  |  Branch (1038:9): [True: 0, False: 87]
  ------------------
 1039|      0|      nchunks += 1;
 1040|      0|    }
 1041|     87|    schunk->chunksize = chunksize;
 1042|     87|    schunk->nchunks = nchunks;
 1043|     87|    schunk->nbytes = nitems * typesize;
 1044|     87|    int rc = frame_lock(frame, true);
 1045|     87|    if (rc < 0) {
  ------------------
  |  Branch (1045:9): [True: 0, False: 87]
  ------------------
 1046|      0|      schunk->chunksize = old_chunksize;
 1047|      0|      schunk->nchunks = old_nchunks;
 1048|      0|      schunk->nbytes = old_nbytes;
 1049|      0|      return rc;
 1050|      0|    }
 1051|     87|    int64_t frame_len = frame_fill_special(frame, nitems, special_value, chunksize, schunk);
 1052|     87|    frame_unlock(frame);
 1053|     87|    if (frame_len < 0) {
  ------------------
  |  Branch (1053:9): [True: 0, False: 87]
  ------------------
 1054|      0|      schunk->chunksize = old_chunksize;
 1055|      0|      schunk->nchunks = old_nchunks;
 1056|      0|      schunk->nbytes = old_nbytes;
 1057|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1058|      0|      return frame_len;
 1059|      0|    }
 1060|     87|  }
 1061|       |
 1062|     87|  return schunk->nchunks;
 1063|     87|}
schunk_update_chunk_lent:
 1563|    604|int64_t schunk_update_chunk_lent(blosc2_schunk *schunk, int64_t nchunk, uint8_t *chunk) {
 1564|    604|  return schunk_update_chunk_locked(schunk, nchunk, chunk, CHUNK_LENT);
 1565|    604|}
schunk_scratch_malloc:
 1638|    814|uint8_t *schunk_scratch_malloc(const blosc2_schunk *schunk, int32_t nbytes, size_t *capacity) {
 1639|    814|  if (schunk->frame != NULL) {
  ------------------
  |  Branch (1639:7): [True: 814, False: 0]
  ------------------
 1640|    814|    return blosc2_tmp_malloc((size_t) nbytes, capacity);
 1641|    814|  }
 1642|      0|  *capacity = 0;
 1643|      0|  return malloc((size_t) nbytes);
 1644|    814|}
blosc2_schunk_decompress_chunk:
 1734|  1.20k|                                   void *dest, int32_t nbytes) {
 1735|  1.20k|  int rc = validate_nchunk(schunk, nchunk, false, "blosc2_schunk_decompress_chunk");
 1736|  1.20k|  if (rc < 0) {
  ------------------
  |  Branch (1736:7): [True: 0, False: 1.20k]
  ------------------
 1737|      0|    return rc;
 1738|      0|  }
 1739|       |
 1740|  1.20k|  int32_t chunk_nbytes;
 1741|  1.20k|  int32_t chunk_cbytes;
 1742|  1.20k|  int chunksize;
 1743|  1.20k|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1744|       |
 1745|  1.20k|  schunk->current_nchunk = nchunk;
 1746|  1.20k|  if (frame == NULL) {
  ------------------
  |  Branch (1746:7): [True: 0, False: 1.20k]
  ------------------
 1747|      0|    uint8_t* src = schunk->data[nchunk];
 1748|      0|    if (src == 0) {
  ------------------
  |  Branch (1748:9): [True: 0, False: 0]
  ------------------
 1749|      0|      return 0;
 1750|      0|    }
 1751|       |
 1752|      0|    rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 1753|      0|    if (rc < 0) {
  ------------------
  |  Branch (1753:9): [True: 0, False: 0]
  ------------------
 1754|      0|      return rc;
 1755|      0|    }
 1756|       |
 1757|      0|    if (nbytes < chunk_nbytes) {
  ------------------
  |  Branch (1757:9): [True: 0, False: 0]
  ------------------
 1758|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1759|      0|                        "('%d' bytes, but '%d' are needed).", nbytes, chunk_nbytes);
 1760|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1761|      0|    }
 1762|       |
 1763|      0|    chunksize = blosc2_decompress_ctx(schunk->dctx, src, chunk_cbytes, dest, nbytes);
 1764|      0|    if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (1764:9): [True: 0, False: 0]
  |  Branch (1764:26): [True: 0, False: 0]
  ------------------
 1765|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1766|      0|      if (chunksize < 0)
  ------------------
  |  Branch (1766:11): [True: 0, False: 0]
  ------------------
 1767|      0|        return chunksize;
 1768|      0|      return BLOSC2_ERROR_FAILURE;
 1769|      0|    }
 1770|  1.20k|  } else {
 1771|  1.20k|    rc = frame_lock(frame, false);
 1772|  1.20k|    if (rc < 0) {
  ------------------
  |  Branch (1772:9): [True: 0, False: 1.20k]
  ------------------
 1773|      0|      return rc;
 1774|      0|    }
 1775|  1.20k|    chunksize = frame_decompress_chunk(schunk->dctx, frame, nchunk, dest, nbytes);
 1776|  1.20k|    frame_unlock(frame);
 1777|  1.20k|    if (chunksize < 0) {
  ------------------
  |  Branch (1777:9): [True: 0, False: 1.20k]
  ------------------
 1778|      0|      return chunksize;
 1779|      0|    }
 1780|  1.20k|  }
 1781|  1.20k|  return chunksize;
 1782|  1.20k|}
schunk_decompress_masked:
 1994|  1.17k|                             void *user_data, void *dest, int32_t destsize) {
 1995|  1.17k|  blosc2_context *dctx = schunk->dctx;
 1996|  1.17k|  int rc = blosc2_set_maskout(dctx, (bool *) maskout, nblocks);
 1997|  1.17k|  if (rc < 0) {
  ------------------
  |  Branch (1997:7): [True: 0, False: 1.17k]
  ------------------
 1998|      0|    return rc;
 1999|      0|  }
 2000|  1.17k|  blosc2_postfilter_fn saved_postfilter = dctx->postfilter;
 2001|  1.17k|  blosc2_postfilter_params *saved_postparams = dctx->postparams;
 2002|  1.17k|  blosc2_postfilter_params params;
 2003|  1.17k|  if (postfilter != NULL) {
  ------------------
  |  Branch (2003:7): [True: 1.02k, False: 148]
  ------------------
 2004|  1.02k|    memset(&params, 0, sizeof(params));
 2005|  1.02k|    params.user_data = user_data;
 2006|  1.02k|    dctx->postfilter = postfilter;
 2007|  1.02k|    dctx->postparams = &params;
 2008|  1.02k|  }
 2009|  1.17k|  if (chunk != NULL) {
  ------------------
  |  Branch (2009:7): [True: 0, False: 1.17k]
  ------------------
 2010|      0|    rc = blosc2_decompress_ctx(dctx, chunk, cbytes, dest, destsize);
 2011|      0|  }
 2012|  1.17k|  else {
 2013|  1.17k|    rc = blosc2_schunk_decompress_chunk(schunk, nchunk, dest, destsize);
 2014|  1.17k|  }
 2015|  1.17k|  dctx->postfilter = saved_postfilter;
 2016|  1.17k|  dctx->postparams = saved_postparams;
 2017|       |  // A decompression that failed early, or a missing chunk, leaves the mask set
 2018|  1.17k|  ctx_clear_maskout(dctx);
 2019|  1.17k|  return rc;
 2020|  1.17k|}
metalayer_flush:
 2802|     87|int metalayer_flush(blosc2_schunk* schunk) {
 2803|     87|  int rc = BLOSC2_ERROR_SUCCESS;
 2804|     87|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 2805|     87|  if (frame == NULL) {
  ------------------
  |  Branch (2805:7): [True: 0, False: 87]
  ------------------
 2806|      0|    return rc;
 2807|      0|  }
 2808|     87|  rc = frame_lock(frame, true);
 2809|     87|  if (rc < 0) {
  ------------------
  |  Branch (2809:7): [True: 0, False: 87]
  ------------------
 2810|      0|    return rc;
 2811|      0|  }
 2812|     87|  rc = frame_update_header(frame, schunk, true);
 2813|     87|  if (rc < 0) {
  ------------------
  |  Branch (2813:7): [True: 0, False: 87]
  ------------------
 2814|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2815|      0|    frame_unlock(frame);
 2816|      0|    return rc;
 2817|      0|  }
 2818|     87|  rc = frame_update_trailer(frame, schunk);
 2819|     87|  if (rc < 0) {
  ------------------
  |  Branch (2819:7): [True: 0, False: 87]
  ------------------
 2820|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2821|      0|    frame_unlock(frame);
 2822|      0|    return rc;
 2823|      0|  }
 2824|     87|  frame_unlock(frame);
 2825|     87|  return rc;
 2826|     87|}
blosc2_meta_add:
 2833|     87|int blosc2_meta_add(blosc2_schunk *schunk, const char *name, uint8_t *content, int32_t content_len) {
 2834|     87|  if (schunk == NULL || name == NULL) {
  ------------------
  |  Branch (2834:7): [True: 0, False: 87]
  |  Branch (2834:25): [True: 0, False: 87]
  ------------------
 2835|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2836|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2837|      0|  }
 2838|     87|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2839|     87|  if (nmetalayer >= 0) {
  ------------------
  |  Branch (2839:7): [True: 0, False: 87]
  ------------------
 2840|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2841|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2842|      0|  }
 2843|     87|  if (content_len < 0) {
  ------------------
  |  Branch (2843:7): [True: 0, False: 87]
  ------------------
 2844|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2845|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2846|      0|  }
 2847|     87|  if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (2847:7): [True: 87, False: 0]
  |  Branch (2847:26): [True: 0, False: 87]
  ------------------
 2848|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2849|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2850|      0|  }
 2851|       |
 2852|       |  // Add the metalayer
 2853|     87|  blosc2_metalayer *metalayer = malloc(sizeof(blosc2_metalayer));
 2854|     87|  BLOSC_ERROR_NULL(metalayer, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     87|    do {                                            \
  |  |  105|     87|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 87]
  |  |  ------------------
  |  |  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|     87|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 87]
  |  |  ------------------
  ------------------
 2855|       |
 2856|     87|  char* name_ = malloc(strlen(name) + 1);
 2857|     87|  if (name_ == NULL) {
  ------------------
  |  Branch (2857:7): [True: 0, False: 87]
  ------------------
 2858|      0|    free(metalayer);
 2859|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2860|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2861|      0|  }
 2862|     87|  strcpy(name_, name);
 2863|     87|  metalayer->name = name_;
 2864|       |
 2865|     87|  uint8_t* content_buf = malloc((size_t)content_len);
 2866|     87|  if (content_buf == NULL && content_len > 0) {
  ------------------
  |  Branch (2866:7): [True: 0, False: 87]
  |  Branch (2866:30): [True: 0, False: 0]
  ------------------
 2867|      0|    free(name_);
 2868|      0|    free(metalayer);
 2869|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2870|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2871|      0|  }
 2872|     87|  if (content_len > 0) {
  ------------------
  |  Branch (2872:7): [True: 87, False: 0]
  ------------------
 2873|     87|    memcpy(content_buf, content, content_len);
 2874|     87|  }
 2875|     87|  metalayer->content = content_buf;
 2876|     87|  metalayer->content_len = content_len;
 2877|     87|  schunk->metalayers[schunk->nmetalayers] = metalayer;
 2878|     87|  schunk->nmetalayers += 1;
 2879|       |
 2880|     87|  int rc = metalayer_flush(schunk);
 2881|     87|  if (rc < 0) {
  ------------------
  |  Branch (2881:7): [True: 0, False: 87]
  ------------------
 2882|      0|    return rc;
 2883|      0|  }
 2884|     87|  schunk->change_tick++;
 2885|       |
 2886|     87|  return schunk->nmetalayers - 1;
 2887|     87|}
schunk.c:schunk_get_chunk_flags2:
 1097|    574|static int schunk_get_chunk_flags2(blosc2_schunk *schunk, int64_t nchunk, uint8_t *chunk_flags2) {
 1098|    574|  uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 1099|    574|  const uint8_t *chunk;
 1100|    574|  int rc = schunk_get_chunk_header(schunk, nchunk, header, &chunk);
 1101|    574|  if (rc < 0) {
  ------------------
  |  Branch (1101:7): [True: 0, False: 574]
  ------------------
 1102|      0|    return rc;
 1103|      0|  }
 1104|    574|  if (chunk == NULL) {
  ------------------
  |  Branch (1104:7): [True: 0, False: 574]
  ------------------
 1105|      0|    return BLOSC2_ERROR_DATA;
 1106|      0|  }
 1107|    574|  *chunk_flags2 = get_chunk_flags2(chunk, rc);
 1108|    574|  return 0;
 1109|    574|}
schunk.c:schunk_get_chunk_header:
 1070|  1.17k|                                   const uint8_t **chunk) {
 1071|  1.17k|  if (schunk->frame != NULL) {
  ------------------
  |  Branch (1071:7): [True: 1.17k, False: 0]
  ------------------
 1072|  1.17k|    *chunk = header;
 1073|  1.17k|    return frame_get_chunk_header((blosc2_frame_s *)schunk->frame, nchunk, header);
 1074|  1.17k|  }
 1075|      0|  *chunk = schunk->data[nchunk];
 1076|      0|  if (*chunk == NULL) {
  ------------------
  |  Branch (1076:7): [True: 0, False: 0]
  ------------------
 1077|      0|    return 0;
 1078|      0|  }
 1079|      0|  int32_t chunk_cbytes;
 1080|      0|  int rc = blosc2_cbuffer_sizes(*chunk, NULL, &chunk_cbytes, NULL);
 1081|      0|  return rc < 0 ? rc : chunk_cbytes;
  ------------------
  |  Branch (1081:10): [True: 0, False: 0]
  ------------------
 1082|      0|}
schunk.c:chunk_needs_private_copy:
 1147|    604|static bool chunk_needs_private_copy(const blosc2_frame_s *frame, chunk_handover how) {
 1148|    604|  return how == CHUNK_COPIED || (how == CHUNK_LENT && frame == NULL);
  ------------------
  |  Branch (1148:10): [True: 0, False: 604]
  |  Branch (1148:34): [True: 604, False: 0]
  |  Branch (1148:55): [True: 0, False: 604]
  ------------------
 1149|    604|}
schunk.c:frame_write_done:
 1155|    604|static void frame_write_done(uint8_t *chunk, chunk_handover how, bool private_copy, bool written) {
 1156|    604|  if (private_copy || (written && how == CHUNK_GIVEN)) {
  ------------------
  |  Branch (1156:7): [True: 0, False: 604]
  |  Branch (1156:24): [True: 604, False: 0]
  |  Branch (1156:35): [True: 0, False: 604]
  ------------------
 1157|      0|    free(chunk);
 1158|      0|  }
 1159|    604|}
schunk.c:schunk_update_chunk_locked:
 1546|    604|                                          chunk_handover how) {
 1547|    604|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1548|    604|  int rc = frame_lock(frame, true);
 1549|    604|  if (rc < 0) {
  ------------------
  |  Branch (1549:7): [True: 0, False: 604]
  ------------------
 1550|      0|    return rc;
 1551|      0|  }
 1552|    604|  int64_t nchunks = schunk_update_chunk_unlocked(schunk, nchunk, chunk, how);
 1553|    604|  frame_unlock(frame);
 1554|    604|  return nchunks;
 1555|    604|}
schunk.c:schunk_update_chunk_unlocked:
 1425|    604|                                            chunk_handover how) {
 1426|    604|  int rc = validate_nchunk(schunk, nchunk, false, "blosc2_schunk_update_chunk");
 1427|    604|  if (rc < 0) {
  ------------------
  |  Branch (1427:7): [True: 0, False: 604]
  ------------------
 1428|      0|    return rc;
 1429|      0|  }
 1430|       |
 1431|    604|  uint8_t old_flags2 = schunk->flags2;
 1432|    604|  int32_t old_chunksize = schunk->chunksize;
 1433|    604|  int64_t old_current_nchunk = schunk->current_nchunk;
 1434|    604|  int64_t old_nbytes = schunk->nbytes;
 1435|    604|  int64_t old_cbytes = schunk->cbytes;
 1436|       |
 1437|    604|  int32_t chunk_nbytes;
 1438|    604|  int32_t chunk_cbytes;
 1439|       |
 1440|    604|  rc = blosc2_cbuffer_sizes(chunk, &chunk_nbytes, &chunk_cbytes, NULL);
 1441|    604|  if (rc < 0) {
  ------------------
  |  Branch (1441:7): [True: 0, False: 604]
  ------------------
 1442|      0|    return rc;
 1443|      0|  }
 1444|    604|  uint8_t flags2 = get_chunk_flags2(chunk, chunk_cbytes);
 1445|    604|  bool chunk_vlblocks = (flags2 & BLOSC2_VL_BLOCKS) != 0;
 1446|    604|  if (schunk->nchunks > 1 || (schunk->nchunks == 1 && nchunk != 0)) {
  ------------------
  |  Branch (1446:7): [True: 574, False: 30]
  |  Branch (1446:31): [True: 30, False: 0]
  |  Branch (1446:55): [True: 0, False: 30]
  ------------------
 1447|    574|    int64_t ref_nchunk = (nchunk == 0) ? 1 : 0;
  ------------------
  |  Branch (1447:26): [True: 55, False: 519]
  ------------------
 1448|    574|    uint8_t ref_flags2;
 1449|    574|    rc = schunk_get_chunk_flags2(schunk, ref_nchunk, &ref_flags2);
 1450|    574|    if (rc < 0) {
  ------------------
  |  Branch (1450:9): [True: 0, False: 574]
  ------------------
 1451|      0|      return rc;
 1452|      0|    }
 1453|    574|    if (((ref_flags2 & BLOSC2_VL_BLOCKS) != 0) != chunk_vlblocks) {
  ------------------
  |  Branch (1453:9): [True: 0, False: 574]
  ------------------
 1454|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1455|      0|      return BLOSC2_ERROR_CHUNK_UPDATE;
 1456|      0|    }
 1457|    574|  }
 1458|     30|  else {
 1459|     30|    schunk->flags2 = flags2;
 1460|     30|  }
 1461|       |
 1462|    604|  int32_t chunksize = schunk->chunksize;
 1463|    604|  bool variable_chunksize = (chunksize == 0);
 1464|    604|  if (chunksize == -1) {
  ------------------
  |  Branch (1464:7): [True: 0, False: 604]
  ------------------
 1465|      0|    schunk->chunksize = chunk_nbytes;  // The super-chunk is initialized now
 1466|      0|    chunksize = schunk->chunksize;
 1467|      0|  }
 1468|       |
 1469|    604|  if (!variable_chunksize && (chunk_nbytes > chunksize ||
  ------------------
  |  Branch (1469:7): [True: 604, False: 0]
  |  Branch (1469:31): [True: 0, False: 604]
  ------------------
 1470|    604|      (nchunk != schunk->nchunks - 1 && chunk_nbytes != chunksize))) {
  ------------------
  |  Branch (1470:8): [True: 519, False: 85]
  |  Branch (1470:41): [True: 0, False: 519]
  ------------------
 1471|      0|    variable_chunksize = true;
 1472|      0|    schunk->chunksize = 0;
 1473|      0|  }
 1474|    604|  if (!variable_chunksize && chunksize > 0 && chunk_nbytes > chunksize) {
  ------------------
  |  Branch (1474:7): [True: 604, False: 0]
  |  Branch (1474:30): [True: 604, False: 0]
  |  Branch (1474:47): [True: 0, False: 604]
  ------------------
 1475|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1476|      0|                      "is not supported yet: %d > %d.", chunk_nbytes, chunksize);
 1477|      0|    return BLOSC2_ERROR_CHUNK_UPDATE;
 1478|      0|  }
 1479|       |
 1480|       |  // Only the sizes of the old chunk are needed, so do not read all of it from disk
 1481|    604|  int32_t chunk_nbytes_old;
 1482|    604|  int32_t chunk_cbytes_old;
 1483|    604|  rc = schunk_get_counted_sizes(schunk, nchunk, &chunk_nbytes_old, &chunk_cbytes_old);
 1484|    604|  if (rc < 0) {
  ------------------
  |  Branch (1484:7): [True: 0, False: 604]
  ------------------
 1485|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1486|      0|    return rc;
 1487|      0|  }
 1488|    604|  schunk->current_nchunk = nchunk;
 1489|       |
 1490|    604|  blosc2_frame_s* frame = (blosc2_frame_s*)(schunk->frame);
 1491|    604|  bool private_copy = chunk_needs_private_copy(frame, how);
 1492|    604|  if (private_copy) {
  ------------------
  |  Branch (1492:7): [True: 0, False: 604]
  ------------------
 1493|       |    // Make a copy of the chunk
 1494|      0|    uint8_t *chunk_copy = malloc(chunk_cbytes);
 1495|      0|    memcpy(chunk_copy, chunk, chunk_cbytes);
 1496|      0|    chunk = chunk_copy;
 1497|      0|  }
 1498|       |
 1499|    604|  if (schunk->frame == NULL) {
  ------------------
  |  Branch (1499:7): [True: 0, False: 604]
  ------------------
 1500|       |    /* Update counters */
 1501|      0|    schunk->nbytes += chunk_nbytes;
 1502|      0|    schunk->nbytes -= chunk_nbytes_old;
 1503|      0|    schunk->cbytes += chunk_cbytes;
 1504|      0|    schunk->cbytes -= chunk_cbytes_old;
 1505|    604|  } else {
 1506|       |    // A frame codes special chunks in their offsets
 1507|    604|    schunk->nbytes += chunk_nbytes;
 1508|    604|    schunk->nbytes -= chunk_nbytes_old;
 1509|    604|    if (!chunk_special_in_offset(chunk, chunk_cbytes)) {
  ------------------
  |  Branch (1509:9): [True: 604, False: 0]
  ------------------
 1510|    604|      schunk->cbytes += chunk_cbytes;
 1511|    604|    }
 1512|    604|    schunk->cbytes -= chunk_cbytes_old;
 1513|    604|  }
 1514|       |
 1515|       |  // Update super-chunk or frame
 1516|    604|  if (schunk->frame == NULL) {
  ------------------
  |  Branch (1516:7): [True: 0, False: 604]
  ------------------
 1517|      0|    if (how == CHUNK_GIVEN && (chunk_cbytes < chunk_nbytes)) {
  ------------------
  |  Branch (1517:9): [True: 0, False: 0]
  |  Branch (1517:31): [True: 0, False: 0]
  ------------------
 1518|       |      // We still want to do a shrink of the chunk
 1519|      0|      chunk = realloc(chunk, chunk_cbytes);
 1520|      0|    }
 1521|       |
 1522|       |    // Free old chunk and add reference to new chunk
 1523|      0|    if (schunk->data[nchunk] != 0) {
  ------------------
  |  Branch (1523:9): [True: 0, False: 0]
  ------------------
 1524|      0|      free(schunk->data[nchunk]);
 1525|      0|    }
 1526|      0|    schunk->data[nchunk] = chunk;
 1527|      0|  }
 1528|    604|  else {
 1529|    604|    bool written = frame_update_chunk(frame, nchunk, chunk, schunk, chunk_cbytes_old) != NULL;
 1530|    604|    frame_write_done(chunk, how, private_copy, written);
 1531|    604|    if (!written) {
  ------------------
  |  Branch (1531:9): [True: 0, False: 604]
  ------------------
 1532|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1533|      0|      schunk->flags2 = old_flags2;
 1534|      0|      schunk->chunksize = old_chunksize;
 1535|      0|      schunk->current_nchunk = old_current_nchunk;
 1536|      0|      schunk->nbytes = old_nbytes;
 1537|      0|      schunk->cbytes = old_cbytes;
 1538|      0|      return BLOSC2_ERROR_CHUNK_UPDATE;
 1539|      0|    }
 1540|    604|  }
 1541|       |
 1542|    604|  return schunk->nchunks;
 1543|    604|}
schunk.c:schunk_get_counted_sizes:
 1114|    604|                                    int32_t *chunk_cbytes) {
 1115|    604|  *chunk_nbytes = 0;
 1116|    604|  *chunk_cbytes = 0;
 1117|    604|  uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 1118|    604|  const uint8_t *chunk;
 1119|    604|  int rc = schunk_get_chunk_header(schunk, nchunk, header, &chunk);
 1120|    604|  if (rc < 0 || chunk == NULL) {
  ------------------
  |  Branch (1120:7): [True: 0, False: 604]
  |  Branch (1120:17): [True: 0, False: 604]
  ------------------
 1121|      0|    return rc;
 1122|      0|  }
 1123|    604|  rc = blosc2_cbuffer_sizes(chunk, chunk_nbytes, chunk_cbytes, NULL);
 1124|    604|  if (rc < 0) {
  ------------------
  |  Branch (1124:7): [True: 0, False: 604]
  ------------------
 1125|      0|    return rc;
 1126|      0|  }
 1127|    604|  if (*chunk_cbytes == BLOSC2_MAX_OVERHEAD) {
  ------------------
  |  Branch (1127:7): [True: 604, False: 0]
  ------------------
 1128|    604|    *chunk_cbytes = 0;
 1129|    604|  }
 1130|    604|  return BLOSC2_ERROR_SUCCESS;
 1131|    604|}
schunk.c:validate_nchunk:
   47|  1.81k|static int validate_nchunk(blosc2_schunk *schunk, int64_t nchunk, bool allow_end, const char *func_name) {
   48|  1.81k|  if (nchunk < 0) {
  ------------------
  |  Branch (48:7): [True: 0, False: 1.81k]
  ------------------
   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.81k|  if (allow_end) {
  ------------------
  |  Branch (53:7): [True: 0, False: 1.81k]
  ------------------
   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.81k|  else {
   61|  1.81k|    if (nchunk >= schunk->nchunks) {
  ------------------
  |  Branch (61:9): [True: 0, False: 1.81k]
  ------------------
   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.81k|  }
   67|       |
   68|  1.81k|  return BLOSC2_ERROR_SUCCESS;
   69|  1.81k|}

shuffle_avx2:
  718|  1.45k|             const uint8_t *_src, uint8_t *_dest) {
  719|  1.45k|  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.45k|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (723:7): [True: 1.43k, False: 20]
  ------------------
  724|  1.43k|    shuffle_generic(bytesoftype, blocksize, _src, _dest);
  725|  1.43k|    return;
  726|  1.43k|  }
  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|     20|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  734|       |
  735|     20|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  736|     20|  const int32_t total_elements = blocksize / bytesoftype;
  737|       |
  738|       |  /* Optimized shuffle implementations */
  739|     20|  switch (bytesoftype) {
  740|      0|    case 2:
  ------------------
  |  Branch (740:5): [True: 0, False: 20]
  ------------------
  741|      0|      shuffle2_avx2(_dest, _src, vectorizable_elements, total_elements);
  742|      0|      break;
  743|     20|    case 4:
  ------------------
  |  Branch (743:5): [True: 20, False: 0]
  ------------------
  744|     20|      shuffle4_avx2(_dest, _src, vectorizable_elements, total_elements);
  745|     20|      break;
  746|      0|    case 8:
  ------------------
  |  Branch (746:5): [True: 0, False: 20]
  ------------------
  747|      0|      shuffle8_avx2(_dest, _src, vectorizable_elements, total_elements);
  748|      0|      break;
  749|      0|    case 16:
  ------------------
  |  Branch (749:5): [True: 0, False: 20]
  ------------------
  750|      0|      shuffle16_avx2(_dest, _src, vectorizable_elements, total_elements);
  751|      0|      break;
  752|      0|    default:
  ------------------
  |  Branch (752:5): [True: 0, False: 20]
  ------------------
  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|     20|  }
  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|     20|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (769:7): [True: 0, False: 20]
  ------------------
  770|      0|    shuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  771|      0|  }
  772|     20|}
unshuffle_avx2:
  777|  7.30k|               const uint8_t *_src, uint8_t *_dest) {
  778|  7.30k|  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|  7.30k|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (782:7): [True: 7.23k, False: 65]
  ------------------
  783|  7.23k|    unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  784|  7.23k|    return;
  785|  7.23k|  }
  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|     65|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  793|       |
  794|     65|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  795|     65|  const int32_t total_elements = blocksize / bytesoftype;
  796|       |
  797|       |  /* Optimized unshuffle implementations */
  798|     65|  switch (bytesoftype) {
  799|      3|    case 2:
  ------------------
  |  Branch (799:5): [True: 3, False: 62]
  ------------------
  800|      3|      unshuffle2_avx2(_dest, _src, vectorizable_elements, total_elements);
  801|      3|      break;
  802|     56|    case 4:
  ------------------
  |  Branch (802:5): [True: 56, False: 9]
  ------------------
  803|     56|      unshuffle4_avx2(_dest, _src, vectorizable_elements, total_elements);
  804|     56|      break;
  805|      2|    case 8:
  ------------------
  |  Branch (805:5): [True: 2, False: 63]
  ------------------
  806|      2|      unshuffle8_avx2(_dest, _src, vectorizable_elements, total_elements);
  807|      2|      break;
  808|      0|    case 12:
  ------------------
  |  Branch (808:5): [True: 0, False: 65]
  ------------------
  809|      0|      unshuffle12_avx2(_dest, _src, vectorizable_elements, total_elements);
  810|      0|      break;
  811|      1|    case 16:
  ------------------
  |  Branch (811:5): [True: 1, False: 64]
  ------------------
  812|      1|      unshuffle16_avx2(_dest, _src, vectorizable_elements, total_elements);
  813|      1|      break;
  814|      3|    default:
  ------------------
  |  Branch (814:5): [True: 3, False: 62]
  ------------------
  815|       |      /* For types larger than 16 bytes, use the AVX2 tiled unshuffle. */
  816|      3|      if (bytesoftype > (int32_t)sizeof(__m128i)) {
  ------------------
  |  Branch (816:11): [True: 3, False: 0]
  ------------------
  817|      3|        unshuffle16_tiled_avx2(_dest, _src, vectorizable_elements, total_elements, bytesoftype);
  818|      3|      }
  819|      0|      else {
  820|       |        /* Non-optimized unshuffle */
  821|      0|        unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  822|       |        /* The non-optimized function covers the whole buffer,
  823|       |           so we're done processing here. */
  824|      0|        return;
  825|      0|      }
  826|     65|  }
  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|     65|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (831:7): [True: 10, False: 55]
  ------------------
  832|     10|    unshuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  833|     10|  }
  834|     65|}
shuffle-avx2.c:shuffle4_avx2:
   98|     20|              const int32_t vectorizable_elements, const int32_t total_elements) {
   99|     20|  static const int32_t bytesoftype = 4;
  100|     20|  int32_t i;
  101|     20|  int j;
  102|     20|  __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|     20|  const __m256i shmask = _mm256_set_epi8(
  109|     20|      0x0f, 0x0b, 0x07, 0x03, 0x0e, 0x0a, 0x06, 0x02,
  110|     20|      0x0d, 0x09, 0x05, 0x01, 0x0c, 0x08, 0x04, 0x00,
  111|     20|      0x0f, 0x0b, 0x07, 0x03, 0x0e, 0x0a, 0x06, 0x02,
  112|     20|      0x0d, 0x09, 0x05, 0x01, 0x0c, 0x08, 0x04, 0x00);
  113|     20|  const __m256i mask = _mm256_set_epi32(
  114|     20|      0x07, 0x03, 0x06, 0x02, 0x05, 0x01, 0x04, 0x00);
  115|       |
  116|    180|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (116:15): [True: 160, False: 20]
  ------------------
  117|       |    /* Fetch 32 elements (128 bytes) then transpose bytes and words within 128-bit lanes. */
  118|    800|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (118:17): [True: 640, False: 160]
  ------------------
  119|    640|      ymm0[j] = _mm256_shuffle_epi8(
  120|    640|          _mm256_loadu_si256((__m256i*)(src + (i * bytesoftype) + (j * sizeof(__m256i)))),
  121|    640|          shmask);
  122|    640|    }
  123|       |    /* Transpose double words */
  124|    480|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (124:17): [True: 320, False: 160]
  ------------------
  125|    320|      ymm1[j * 2] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  126|    320|      ymm1[j * 2 + 1] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  127|    320|    }
  128|       |    /* Transpose quad words */
  129|    480|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (129:17): [True: 320, False: 160]
  ------------------
  130|    320|      ymm0[j * 2] = _mm256_unpacklo_epi64(ymm1[j], ymm1[j + 2]);
  131|    320|      ymm0[j * 2 + 1] = _mm256_unpackhi_epi64(ymm1[j], ymm1[j + 2]);
  132|    320|    }
  133|    800|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (133:17): [True: 640, False: 160]
  ------------------
  134|    640|      ymm0[j] = _mm256_permutevar8x32_epi32(ymm0[j], mask);
  135|    640|    }
  136|       |    /* Store the result vectors */
  137|    160|    uint8_t* const dest_for_ith_element = dest + i;
  138|    800|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (138:17): [True: 640, False: 160]
  ------------------
  139|    640|      _mm256_storeu_si256((__m256i*)(dest_for_ith_element + (j * total_elements)), ymm0[j]);
  140|    640|    }
  141|    160|  }
  142|     20|}
shuffle-avx2.c:unshuffle2_avx2:
  331|      3|                const int32_t vectorizable_elements, const int32_t total_elements) {
  332|      3|  static const int32_t bytesoftype = 2;
  333|      3|  int32_t i;
  334|      3|  int j;
  335|      3|  __m256i ymm0[2], ymm1[2];
  336|       |
  337|   558k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (337:15): [True: 558k, False: 3]
  ------------------
  338|       |    /* Load 32 elements (64 bytes) into 2 YMM registers. */
  339|   558k|    const uint8_t* const src_for_ith_element = src + i;
  340|  1.67M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (340:17): [True: 1.11M, False: 558k]
  ------------------
  341|  1.11M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  342|  1.11M|    }
  343|       |    /* Shuffle bytes */
  344|  1.67M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (344:17): [True: 1.11M, False: 558k]
  ------------------
  345|  1.11M|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  346|  1.11M|    }
  347|       |    /* Compute the low 64 bytes */
  348|   558k|    ymm1[0] = _mm256_unpacklo_epi8(ymm0[0], ymm0[1]);
  349|       |    /* Compute the hi 64 bytes */
  350|   558k|    ymm1[1] = _mm256_unpackhi_epi8(ymm0[0], ymm0[1]);
  351|       |    /* Store the result vectors in proper order */
  352|   558k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  353|   558k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[1]);
  354|   558k|  }
  355|      3|}
shuffle-avx2.c:unshuffle4_avx2:
  360|     56|                const int32_t vectorizable_elements, const int32_t total_elements) {
  361|     56|  static const int32_t bytesoftype = 4;
  362|     56|  int32_t i;
  363|     56|  int j;
  364|     56|  __m256i ymm0[4], ymm1[4];
  365|       |
  366|   131k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (366:15): [True: 131k, False: 56]
  ------------------
  367|       |    /* Load 32 elements (128 bytes) into 4 YMM registers. */
  368|   131k|    const uint8_t* const src_for_ith_element = src + i;
  369|   657k|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (369:17): [True: 525k, False: 131k]
  ------------------
  370|   525k|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  371|   525k|    }
  372|       |    /* Shuffle bytes */
  373|   394k|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (373:17): [True: 262k, False: 131k]
  ------------------
  374|       |      /* Compute the low 64 bytes */
  375|   262k|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  376|       |      /* Compute the hi 64 bytes */
  377|   262k|      ymm1[2 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  378|   262k|    }
  379|       |    /* Shuffle 2-byte words */
  380|   394k|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (380:17): [True: 262k, False: 131k]
  ------------------
  381|       |      /* Compute the low 64 bytes */
  382|   262k|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  383|       |      /* Compute the hi 64 bytes */
  384|   262k|      ymm0[2 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  385|   262k|    }
  386|   131k|    ymm1[0] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x20);
  387|   131k|    ymm1[1] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x20);
  388|   131k|    ymm1[2] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x31);
  389|   131k|    ymm1[3] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x31);
  390|       |
  391|       |    /* Store the result vectors in proper order */
  392|   657k|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (392:17): [True: 525k, False: 131k]
  ------------------
  393|   525k|      _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (j * sizeof(__m256i))), ymm1[j]);
  394|   525k|    }
  395|   131k|  }
  396|     56|}
shuffle-avx2.c:unshuffle8_avx2:
  401|      2|                const int32_t vectorizable_elements, const int32_t total_elements) {
  402|      2|  static const int32_t bytesoftype = 8;
  403|      2|  int32_t i;
  404|      2|  int j;
  405|      2|  __m256i ymm0[8], ymm1[8];
  406|       |
  407|   884k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (407:15): [True: 884k, False: 2]
  ------------------
  408|       |    /* Fetch 32 elements (256 bytes) into 8 YMM registers. */
  409|   884k|    const uint8_t* const src_for_ith_element = src + i;
  410|  7.96M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (410:17): [True: 7.07M, False: 884k]
  ------------------
  411|  7.07M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  412|  7.07M|    }
  413|       |    /* Shuffle bytes */
  414|  4.42M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (414:17): [True: 3.53M, False: 884k]
  ------------------
  415|       |      /* Compute the low 32 bytes */
  416|  3.53M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  417|       |      /* Compute the hi 32 bytes */
  418|  3.53M|      ymm1[4 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  419|  3.53M|    }
  420|       |    /* Shuffle words */
  421|  4.42M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (421:17): [True: 3.53M, False: 884k]
  ------------------
  422|       |      /* Compute the low 32 bytes */
  423|  3.53M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  424|       |      /* Compute the hi 32 bytes */
  425|  3.53M|      ymm0[4 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  426|  3.53M|    }
  427|  7.96M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (427:17): [True: 7.07M, False: 884k]
  ------------------
  428|  7.07M|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  429|  7.07M|    }
  430|       |
  431|       |    /* Shuffle 4-byte dwords */
  432|  4.42M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (432:17): [True: 3.53M, False: 884k]
  ------------------
  433|       |      /* Compute the low 32 bytes */
  434|  3.53M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  435|       |      /* Compute the hi 32 bytes */
  436|  3.53M|      ymm1[4 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  437|  3.53M|    }
  438|       |
  439|       |    /* Store the result vectors in proper order */
  440|   884k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  441|   884k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[2]);
  442|   884k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[1]);
  443|   884k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[3]);
  444|   884k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[4]);
  445|   884k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[6]);
  446|   884k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[5]);
  447|   884k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  448|   884k|  }
  449|      2|}
shuffle-avx2.c:unshuffle16_avx2:
  454|      1|                 const int32_t vectorizable_elements, const int32_t total_elements) {
  455|      1|  static const int32_t bytesoftype = 16;
  456|      1|  int32_t i;
  457|      1|  int j;
  458|      1|  __m256i ymm0[16], ymm1[16];
  459|       |
  460|      3|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (460:15): [True: 2, False: 1]
  ------------------
  461|       |    /* Fetch 32 elements (512 bytes) into 16 YMM registers. */
  462|      2|    const uint8_t* const src_for_ith_element = src + i;
  463|     34|    for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (463:17): [True: 32, False: 2]
  ------------------
  464|     32|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  465|     32|    }
  466|       |
  467|       |    /* Shuffle bytes */
  468|     18|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (468:17): [True: 16, False: 2]
  ------------------
  469|       |      /* Compute the low 32 bytes */
  470|     16|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  471|       |      /* Compute the hi 32 bytes */
  472|     16|      ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  473|     16|    }
  474|       |    /* Shuffle 2-byte words */
  475|     18|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (475:17): [True: 16, False: 2]
  ------------------
  476|       |      /* Compute the low 32 bytes */
  477|     16|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  478|       |      /* Compute the hi 32 bytes */
  479|     16|      ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  480|     16|    }
  481|       |    /* Shuffle 4-byte dwords */
  482|     18|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (482:17): [True: 16, False: 2]
  ------------------
  483|       |      /* Compute the low 32 bytes */
  484|     16|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  485|       |      /* Compute the hi 32 bytes */
  486|     16|      ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  487|     16|    }
  488|       |
  489|       |    /* Shuffle 8-byte qwords */
  490|     18|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (490:17): [True: 16, False: 2]
  ------------------
  491|       |      /* Compute the low 32 bytes */
  492|     16|      ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  493|       |      /* Compute the hi 32 bytes */
  494|     16|      ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  495|     16|    }
  496|       |
  497|     18|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (497:17): [True: 16, False: 2]
  ------------------
  498|     16|      ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  499|     16|      ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  500|     16|    }
  501|       |
  502|       |    /* Store the result vectors in proper order */
  503|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  504|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[4]);
  505|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[2]);
  506|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[6]);
  507|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[1]);
  508|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[5]);
  509|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[3]);
  510|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  511|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (8 * sizeof(__m256i))), ymm1[8]);
  512|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (9 * sizeof(__m256i))), ymm1[12]);
  513|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (10 * sizeof(__m256i))), ymm1[10]);
  514|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (11 * sizeof(__m256i))), ymm1[14]);
  515|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (12 * sizeof(__m256i))), ymm1[9]);
  516|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (13 * sizeof(__m256i))), ymm1[13]);
  517|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (14 * sizeof(__m256i))), ymm1[11]);
  518|      2|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (15 * sizeof(__m256i))), ymm1[15]);
  519|      2|  }
  520|      1|}
shuffle-avx2.c:unshuffle16_tiled_avx2:
  606|      3|                       const int32_t vectorizable_elements, const int32_t total_elements, const int32_t bytesoftype) {
  607|      3|  int32_t i;
  608|      3|  int j;
  609|      3|  __m256i ymm0[16], ymm1[16];
  610|       |
  611|      3|  const lldiv_t vecs_per_el = lldiv(bytesoftype, sizeof(__m128i));
  612|      3|  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|      3|  int32_t offset_into_type;
  617|     25|  for (offset_into_type = 0; offset_into_type < bytesoftype;
  ------------------
  |  Branch (617:30): [True: 22, False: 3]
  ------------------
  618|     22|       offset_into_type += (offset_into_type == 0 && vecs_rem > 0 ? vecs_rem : (int32_t)sizeof(__m128i))) {
  ------------------
  |  Branch (618:29): [True: 3, False: 19]
  |  Branch (618:54): [True: 2, False: 1]
  ------------------
  619|   133k|    for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (619:17): [True: 133k, False: 22]
  ------------------
  620|       |      /* Load the first 16 bytes of 32 adjacent elements (512 bytes) into 16 YMM registers */
  621|   133k|      const uint8_t* const src_for_ith_element = src + i;
  622|  2.26M|      for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (622:19): [True: 2.13M, False: 133k]
  ------------------
  623|  2.13M|        ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (total_elements * (offset_into_type + j))));
  624|  2.13M|      }
  625|       |
  626|       |      /* Shuffle bytes */
  627|  1.20M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (627:19): [True: 1.06M, False: 133k]
  ------------------
  628|       |        /* Compute the low 32 bytes */
  629|  1.06M|        ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  630|       |        /* Compute the hi 32 bytes */
  631|  1.06M|        ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  632|  1.06M|      }
  633|       |      /* Shuffle 2-byte words */
  634|  1.20M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (634:19): [True: 1.06M, False: 133k]
  ------------------
  635|       |        /* Compute the low 32 bytes */
  636|  1.06M|        ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  637|       |        /* Compute the hi 32 bytes */
  638|  1.06M|        ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  639|  1.06M|      }
  640|       |      /* Shuffle 4-byte dwords */
  641|  1.20M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (641:19): [True: 1.06M, False: 133k]
  ------------------
  642|       |        /* Compute the low 32 bytes */
  643|  1.06M|        ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  644|       |        /* Compute the hi 32 bytes */
  645|  1.06M|        ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  646|  1.06M|      }
  647|       |
  648|       |      /* Shuffle 8-byte qwords */
  649|  1.20M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (649:19): [True: 1.06M, False: 133k]
  ------------------
  650|       |        /* Compute the low 32 bytes */
  651|  1.06M|        ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  652|       |        /* Compute the hi 32 bytes */
  653|  1.06M|        ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  654|  1.06M|      }
  655|       |
  656|  1.20M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (656:19): [True: 1.06M, False: 133k]
  ------------------
  657|  1.06M|        ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  658|  1.06M|        ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  659|  1.06M|      }
  660|       |
  661|       |      /* Store the result vectors in proper order */
  662|   133k|      const uint8_t* const dest_with_offset = dest + offset_into_type;
  663|   133k|      _mm256_storeu2_m128i(
  664|   133k|          (__m128i*)(dest_with_offset + (i + 0x01) * bytesoftype),
  665|   133k|          (__m128i*)(dest_with_offset + (i + 0x00) * bytesoftype), ymm1[0]);
  666|   133k|      _mm256_storeu2_m128i(
  667|   133k|          (__m128i*)(dest_with_offset + (i + 0x03) * bytesoftype),
  668|   133k|          (__m128i*)(dest_with_offset + (i + 0x02) * bytesoftype), ymm1[4]);
  669|   133k|      _mm256_storeu2_m128i(
  670|   133k|          (__m128i*)(dest_with_offset + (i + 0x05) * bytesoftype),
  671|   133k|          (__m128i*)(dest_with_offset + (i + 0x04) * bytesoftype), ymm1[2]);
  672|   133k|      _mm256_storeu2_m128i(
  673|   133k|          (__m128i*)(dest_with_offset + (i + 0x07) * bytesoftype),
  674|   133k|          (__m128i*)(dest_with_offset + (i + 0x06) * bytesoftype), ymm1[6]);
  675|   133k|      _mm256_storeu2_m128i(
  676|   133k|          (__m128i*)(dest_with_offset + (i + 0x09) * bytesoftype),
  677|   133k|          (__m128i*)(dest_with_offset + (i + 0x08) * bytesoftype), ymm1[1]);
  678|   133k|      _mm256_storeu2_m128i(
  679|   133k|          (__m128i*)(dest_with_offset + (i + 0x0b) * bytesoftype),
  680|   133k|          (__m128i*)(dest_with_offset + (i + 0x0a) * bytesoftype), ymm1[5]);
  681|   133k|      _mm256_storeu2_m128i(
  682|   133k|          (__m128i*)(dest_with_offset + (i + 0x0d) * bytesoftype),
  683|   133k|          (__m128i*)(dest_with_offset + (i + 0x0c) * bytesoftype), ymm1[3]);
  684|   133k|      _mm256_storeu2_m128i(
  685|   133k|          (__m128i*)(dest_with_offset + (i + 0x0f) * bytesoftype),
  686|   133k|          (__m128i*)(dest_with_offset + (i + 0x0e) * bytesoftype), ymm1[7]);
  687|   133k|      _mm256_storeu2_m128i(
  688|   133k|          (__m128i*)(dest_with_offset + (i + 0x11) * bytesoftype),
  689|   133k|          (__m128i*)(dest_with_offset + (i + 0x10) * bytesoftype), ymm1[8]);
  690|   133k|      _mm256_storeu2_m128i(
  691|   133k|          (__m128i*)(dest_with_offset + (i + 0x13) * bytesoftype),
  692|   133k|          (__m128i*)(dest_with_offset + (i + 0x12) * bytesoftype), ymm1[12]);
  693|   133k|      _mm256_storeu2_m128i(
  694|   133k|          (__m128i*)(dest_with_offset + (i + 0x15) * bytesoftype),
  695|   133k|          (__m128i*)(dest_with_offset + (i + 0x14) * bytesoftype), ymm1[10]);
  696|   133k|      _mm256_storeu2_m128i(
  697|   133k|          (__m128i*)(dest_with_offset + (i + 0x17) * bytesoftype),
  698|   133k|          (__m128i*)(dest_with_offset + (i + 0x16) * bytesoftype), ymm1[14]);
  699|   133k|      _mm256_storeu2_m128i(
  700|   133k|          (__m128i*)(dest_with_offset + (i + 0x19) * bytesoftype),
  701|   133k|          (__m128i*)(dest_with_offset + (i + 0x18) * bytesoftype), ymm1[9]);
  702|   133k|      _mm256_storeu2_m128i(
  703|   133k|          (__m128i*)(dest_with_offset + (i + 0x1b) * bytesoftype),
  704|   133k|          (__m128i*)(dest_with_offset + (i + 0x1a) * bytesoftype), ymm1[13]);
  705|   133k|      _mm256_storeu2_m128i(
  706|   133k|          (__m128i*)(dest_with_offset + (i + 0x1d) * bytesoftype),
  707|   133k|          (__m128i*)(dest_with_offset + (i + 0x1c) * bytesoftype), ymm1[11]);
  708|   133k|      _mm256_storeu2_m128i(
  709|   133k|          (__m128i*)(dest_with_offset + (i + 0x1f) * bytesoftype),
  710|   133k|          (__m128i*)(dest_with_offset + (i + 0x1e) * bytesoftype), ymm1[15]);
  711|   133k|    }
  712|     22|  }
  713|      3|}

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

shuffle-generic.c:shuffle_generic_inline:
   36|  1.43k|                                   const uint8_t *_src, uint8_t *_dest) {
   37|  1.43k|  int32_t i, j;
   38|       |  /* Calculate the number of elements in the block. */
   39|  1.43k|  const int32_t neblock_quot = blocksize / type_size;
   40|  1.43k|  const int32_t neblock_rem = blocksize % type_size;
   41|  1.43k|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   42|       |
   43|       |
   44|       |  /* Non-optimized shuffle */
   45|  26.3k|  for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (45:15): [True: 24.9k, False: 1.43k]
  ------------------
   46|   202k|    for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (46:37): [True: 177k, False: 24.9k]
  ------------------
   47|   177k|      _dest[j * neblock_quot + i] = _src[i * type_size + j];
   48|   177k|    }
   49|  24.9k|  }
   50|       |
   51|       |  /* Copy any leftover bytes in the block without shuffling them. */
   52|  1.43k|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   53|  1.43k|}
shuffle-generic.c:unshuffle_generic_inline:
   64|  7.23k|                                     const uint8_t *_src, uint8_t *_dest) {
   65|  7.23k|  int32_t i, j;
   66|       |
   67|       |  /* Calculate the number of elements in the block. */
   68|  7.23k|  const int32_t neblock_quot = blocksize / type_size;
   69|  7.23k|  const int32_t neblock_rem = blocksize % type_size;
   70|  7.23k|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   71|       |
   72|       |  /* Non-optimized unshuffle */
   73|   122k|  for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (73:35): [True: 115k, False: 7.23k]
  ------------------
   74|  1.08M|    for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (74:17): [True: 967k, False: 115k]
  ------------------
   75|   967k|      _dest[i * type_size + j] = _src[j * neblock_quot + i];
   76|   967k|    }
   77|   115k|  }
   78|       |
   79|       |  /* Copy any leftover bytes in the block without unshuffling them. */
   80|  7.23k|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   81|  7.23k|}
shuffle-avx2.c:unshuffle_generic_inline:
   64|     10|                                     const uint8_t *_src, uint8_t *_dest) {
   65|     10|  int32_t i, j;
   66|       |
   67|       |  /* Calculate the number of elements in the block. */
   68|     10|  const int32_t neblock_quot = blocksize / type_size;
   69|     10|  const int32_t neblock_rem = blocksize % type_size;
   70|     10|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   71|       |
   72|       |  /* Non-optimized unshuffle */
   73|    179|  for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (73:35): [True: 169, False: 10]
  ------------------
   74|  8.86k|    for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (74:17): [True: 8.69k, False: 169]
  ------------------
   75|  8.69k|      _dest[i * type_size + j] = _src[j * neblock_quot + i];
   76|  8.69k|    }
   77|    169|  }
   78|       |
   79|       |  /* Copy any leftover bytes in the block without unshuffling them. */
   80|     10|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   81|     10|}

shuffle_sse2:
  561|  3.16k|             const uint8_t *_src, uint8_t *_dest) {
  562|  3.16k|  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.16k|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  569|  3.16k|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  570|  3.16k|  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.16k|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (574:7): [True: 0, False: 3.16k]
  ------------------
  575|      0|    shuffle_generic(bytesoftype, blocksize, _src, _dest);
  576|      0|    return;
  577|      0|  }
  578|       |
  579|       |  /* Optimized shuffle implementations */
  580|  3.16k|  switch (bytesoftype) {
  581|      0|    case 2:
  ------------------
  |  Branch (581:5): [True: 0, False: 3.16k]
  ------------------
  582|      0|      shuffle2_sse2(_dest, _src, vectorizable_elements, total_elements);
  583|      0|      break;
  584|      8|    case 4:
  ------------------
  |  Branch (584:5): [True: 8, False: 3.15k]
  ------------------
  585|      8|      shuffle4_sse2(_dest, _src, vectorizable_elements, total_elements);
  586|      8|      break;
  587|  3.15k|    case 8:
  ------------------
  |  Branch (587:5): [True: 3.15k, False: 8]
  ------------------
  588|  3.15k|      shuffle8_sse2(_dest, _src, vectorizable_elements, total_elements);
  589|  3.15k|      break;
  590|      0|    case 16:
  ------------------
  |  Branch (590:5): [True: 0, False: 3.16k]
  ------------------
  591|      0|      shuffle16_sse2(_dest, _src, vectorizable_elements, total_elements);
  592|      0|      break;
  593|      0|    default:
  ------------------
  |  Branch (593:5): [True: 0, False: 3.16k]
  ------------------
  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.16k|  }
  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.16k|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (609:7): [True: 0, False: 3.16k]
  ------------------
  610|      0|    shuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  611|      0|  }
  612|  3.16k|}
shuffle-sse2.c:shuffle4_sse2:
   64|      8|              const int32_t vectorizable_elements, const int32_t total_elements) {
   65|      8|  static const int32_t bytesoftype = 4;
   66|      8|  int32_t i;
   67|      8|  int j;
   68|      8|  const __m128i mask16 = _mm_set1_epi16(0x00ff);
   69|      8|  __m128i lo[4], hi[4];
   70|       |
   71|     40|  for (i = 0; i < vectorizable_elements; i += sizeof(__m128i)) {
  ------------------
  |  Branch (71:15): [True: 32, False: 8]
  ------------------
   72|       |    /* Fetch 16 elements (64 bytes) and split 16-bit halves with sign extension for packs. */
   73|    160|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (73:17): [True: 128, False: 32]
  ------------------
   74|    128|      __m128i x = _mm_loadu_si128((__m128i*)(src + (i * bytesoftype) + (j * sizeof(__m128i))));
   75|    128|      lo[j] = _mm_srai_epi32(_mm_slli_epi32(x, 16), 16);
   76|    128|      hi[j] = _mm_srai_epi32(x, 16);
   77|    128|    }
   78|     32|    __m128i p01_lo = _mm_packs_epi32(lo[0], lo[1]);
   79|     32|    __m128i p23_lo = _mm_packs_epi32(lo[2], lo[3]);
   80|     32|    __m128i p01_hi = _mm_packs_epi32(hi[0], hi[1]);
   81|     32|    __m128i p23_hi = _mm_packs_epi32(hi[2], hi[3]);
   82|       |    /* Store the result vectors */
   83|     32|    uint8_t* const dest_for_ith_element = dest + i;
   84|     32|    _mm_storeu_si128((__m128i*)(dest_for_ith_element + 0 * total_elements),
   85|     32|                     _mm_packus_epi16(_mm_and_si128(p01_lo, mask16), _mm_and_si128(p23_lo, mask16)));
   86|     32|    _mm_storeu_si128((__m128i*)(dest_for_ith_element + 1 * total_elements),
   87|     32|                     _mm_packus_epi16(_mm_srli_epi16(p01_lo, 8), _mm_srli_epi16(p23_lo, 8)));
   88|     32|    _mm_storeu_si128((__m128i*)(dest_for_ith_element + 2 * total_elements),
   89|     32|                     _mm_packus_epi16(_mm_and_si128(p01_hi, mask16), _mm_and_si128(p23_hi, mask16)));
   90|     32|    _mm_storeu_si128((__m128i*)(dest_for_ith_element + 3 * total_elements),
   91|     32|                     _mm_packus_epi16(_mm_srli_epi16(p01_hi, 8), _mm_srli_epi16(p23_hi, 8)));
   92|     32|  }
   93|      8|}
shuffle-sse2.c:shuffle8_sse2:
   98|  3.15k|              const int32_t vectorizable_elements, const int32_t total_elements) {
   99|  3.15k|  static const int32_t bytesoftype = 8;
  100|  3.15k|  int32_t j;
  101|  3.15k|  int k, l;
  102|  3.15k|  uint8_t* dest_for_jth_element;
  103|  3.15k|  __m128i xmm0[8], xmm1[8];
  104|       |
  105|  6.30k|  for (j = 0; j < vectorizable_elements; j += sizeof(__m128i)) {
  ------------------
  |  Branch (105:15): [True: 3.15k, False: 3.15k]
  ------------------
  106|       |    /* Fetch 16 elements (128 bytes) then transpose bytes. */
  107|  28.3k|    for (k = 0; k < 8; k++) {
  ------------------
  |  Branch (107:17): [True: 25.2k, False: 3.15k]
  ------------------
  108|  25.2k|      xmm0[k] = _mm_loadu_si128((__m128i*)(src + (j * bytesoftype) + (k * sizeof(__m128i))));
  109|  25.2k|      xmm1[k] = _mm_shuffle_epi32(xmm0[k], 0x4e);
  110|  25.2k|      xmm1[k] = _mm_unpacklo_epi8(xmm0[k], xmm1[k]);
  111|  25.2k|    }
  112|       |    /* Transpose words */
  113|  15.7k|    for (k = 0, l = 0; k < 4; k++, l += 2) {
  ------------------
  |  Branch (113:24): [True: 12.6k, False: 3.15k]
  ------------------
  114|  12.6k|      xmm0[k * 2] = _mm_unpacklo_epi16(xmm1[l], xmm1[l + 1]);
  115|  12.6k|      xmm0[k * 2 + 1] = _mm_unpackhi_epi16(xmm1[l], xmm1[l + 1]);
  116|  12.6k|    }
  117|       |    /* Transpose double words */
  118|  15.7k|    for (k = 0, l = 0; k < 4; k++, l++) {
  ------------------
  |  Branch (118:24): [True: 12.6k, False: 3.15k]
  ------------------
  119|  12.6k|      if (k == 2) l += 2;
  ------------------
  |  Branch (119:11): [True: 3.15k, False: 9.45k]
  ------------------
  120|  12.6k|      xmm1[k * 2] = _mm_unpacklo_epi32(xmm0[l], xmm0[l + 2]);
  121|  12.6k|      xmm1[k * 2 + 1] = _mm_unpackhi_epi32(xmm0[l], xmm0[l + 2]);
  122|  12.6k|    }
  123|       |    /* Transpose quad words */
  124|  15.7k|    for (k = 0; k < 4; k++) {
  ------------------
  |  Branch (124:17): [True: 12.6k, False: 3.15k]
  ------------------
  125|  12.6k|      xmm0[k * 2] = _mm_unpacklo_epi64(xmm1[k], xmm1[k + 4]);
  126|  12.6k|      xmm0[k * 2 + 1] = _mm_unpackhi_epi64(xmm1[k], xmm1[k + 4]);
  127|  12.6k|    }
  128|       |    /* Store the result vectors */
  129|  3.15k|    dest_for_jth_element = dest + j;
  130|  28.3k|    for (k = 0; k < 8; k++) {
  ------------------
  |  Branch (130:17): [True: 25.2k, False: 3.15k]
  ------------------
  131|  25.2k|      _mm_storeu_si128((__m128i*)(dest_for_jth_element + (k * total_elements)), xmm0[k]);
  132|  25.2k|    }
  133|  3.15k|  }
  134|  3.15k|}

blosc2_shuffle:
  459|  1.45k|               const void* src, void* dest) {
  460|       |  /* Initialize the shuffle implementation if necessary. */
  461|  1.45k|  init_shuffle_implementation();
  462|       |
  463|  1.45k|  if (typesize < 1 || typesize > 256 || blocksize < 0) {
  ------------------
  |  Branch (463:7): [True: 0, False: 1.45k]
  |  Branch (463:23): [True: 0, False: 1.45k]
  |  Branch (463:41): [True: 0, False: 1.45k]
  ------------------
  464|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  465|      0|  }
  466|       |
  467|       |  /* Shuffling single bytes is the identity; the generic routine would copy them one by one. */
  468|  1.45k|  if (typesize == 1) {
  ------------------
  |  Branch (468:7): [True: 0, False: 1.45k]
  ------------------
  469|      0|    if (dest != src) {
  ------------------
  |  Branch (469:9): [True: 0, False: 0]
  ------------------
  470|      0|      memcpy(dest, src, (size_t)blocksize);
  471|      0|    }
  472|      0|    return blocksize;
  473|      0|  }
  474|       |
  475|       |  /* The implementation is initialized.
  476|       |     Dispatch to its shuffle routine. */
  477|  1.45k|  (host_implementation.shuffle)(typesize, blocksize, src, dest);
  478|       |
  479|  1.45k|  return blocksize;
  480|  1.45k|}
blosc2_unshuffle:
  486|  3.50k|                 const void* src, void* dest) {
  487|       |  /* Initialize the shuffle implementation if necessary. */
  488|  3.50k|  init_shuffle_implementation();
  489|       |
  490|  3.50k|  if (typesize < 1 || typesize > 256 || blocksize < 0) {
  ------------------
  |  Branch (490:7): [True: 0, False: 3.50k]
  |  Branch (490:23): [True: 0, False: 3.50k]
  |  Branch (490:41): [True: 0, False: 3.50k]
  ------------------
  491|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  492|      0|  }
  493|       |
  494|       |  /* Unshuffling single bytes is the identity (see blosc2_shuffle). */
  495|  3.50k|  if (typesize == 1) {
  ------------------
  |  Branch (495:7): [True: 0, False: 3.50k]
  ------------------
  496|      0|    if (dest != src) {
  ------------------
  |  Branch (496:9): [True: 0, False: 0]
  ------------------
  497|      0|      memcpy(dest, src, (size_t)blocksize);
  498|      0|    }
  499|      0|    return blocksize;
  500|      0|  }
  501|       |
  502|       |  /* The implementation is initialized.
  503|       |     Dispatch to it's unshuffle routine. */
  504|  3.50k|  (host_implementation.unshuffle)(typesize, blocksize, src, dest);
  505|       |
  506|  3.50k|  return blocksize;
  507|  3.50k|}
bitshuffle:
  530|  3.16k|                   const void* src, void* dest, void* tmp) {
  531|       |  /* Initialize the shuffle implementation if necessary. */
  532|  3.16k|  init_shuffle_implementation();
  533|  3.16k|  size_t size = blocksize / typesize;
  534|       |
  535|  3.16k|  if (typesize < 1 || typesize > 256 || blocksize < 0) {
  ------------------
  |  Branch (535:7): [True: 0, False: 3.16k]
  |  Branch (535:23): [True: 0, False: 3.16k]
  |  Branch (535:41): [True: 0, False: 3.16k]
  ------------------
  536|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  537|      0|  }
  538|       |
  539|       |  /* bitshuffle only supports a number of elements that is a multiple of 8. */
  540|  3.16k|  size -= size % 8;
  541|  3.16k|  int ret = (int) run_bitshuffle(host_implementation.bitshuffle, src, dest, size, typesize, tmp);
  542|  3.16k|  if (ret < 0) {
  ------------------
  |  Branch (542:7): [True: 0, False: 3.16k]
  ------------------
  543|       |    // Some error in bitshuffle (should not happen)
  544|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  545|      0|    return ret;
  546|      0|  }
  547|       |
  548|       |  // Copy the leftovers
  549|  3.16k|  size_t offset = size * typesize;
  550|  3.16k|  memcpy((uint8_t *) dest + offset, (const uint8_t *) src + offset, blocksize - offset);
  551|       |
  552|  3.16k|  return blocksize;
  553|  3.16k|}
bitunshuffle:
  566|  3.80k|                     const uint8_t format_version) {
  567|       |  /* Initialize the shuffle implementation if necessary. */
  568|  3.80k|  init_shuffle_implementation();
  569|  3.80k|  size_t size = blocksize / typesize;
  570|       |
  571|  3.80k|  if (format_version == 2) {
  ------------------
  |  Branch (571:7): [True: 1, False: 3.79k]
  ------------------
  572|       |    /* Starting from version 3, bitshuffle() works differently */
  573|      1|    if ((size % 8) == 0) {
  ------------------
  |  Branch (573:9): [True: 1, False: 0]
  ------------------
  574|       |      /* The number of elems is a multiple of 8 which is supported by
  575|       |         bitshuffle. */
  576|      1|      int ret = (int) run_bitshuffle(host_implementation.bitunshuffle,
  577|      1|                                     src, dest, size, typesize, tmp);
  578|      1|      if (ret < 0) {
  ------------------
  |  Branch (578:11): [True: 0, False: 1]
  ------------------
  579|       |        // Some error in bitshuffle (should not happen)
  580|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  581|      0|        return ret;
  582|      0|      }
  583|       |      /* Copy the leftovers (the bytes that do not make up a whole element), as
  584|       |         Blosc1 does when it writes them after the shuffled part. */
  585|      1|      size_t offset = size * typesize;
  586|      1|      memcpy((uint8_t *) dest + offset, (const uint8_t *) src + offset, blocksize - offset);
  587|      1|    }
  588|      0|    else {
  589|      0|      memcpy(dest, src, blocksize);
  590|      0|    }
  591|      1|  }
  592|  3.79k|  else {
  593|       |    /* bitshuffle only supports a number of bytes that is a multiple of 8. */
  594|  3.79k|    size -= size % 8;
  595|  3.79k|    int ret = (int) run_bitshuffle(host_implementation.bitunshuffle, src, dest, size, typesize, tmp);
  596|  3.79k|    if (ret < 0) {
  ------------------
  |  Branch (596:9): [True: 0, False: 3.79k]
  ------------------
  597|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  598|      0|      return ret;
  599|      0|    }
  600|       |
  601|       |    /* Copy the leftovers */
  602|  3.79k|    size_t offset = size * typesize;
  603|  3.79k|    memcpy((uint8_t *) dest + offset, (const uint8_t *) src + offset, blocksize - offset);
  604|  3.79k|  }
  605|       |
  606|  3.80k|  return blocksize;
  607|  3.80k|}
shuffle.c:init_shuffle_implementation:
  425|  11.9k|static void init_shuffle_implementation(void) {
  426|  11.9k|  pthread_once(&implementation_once, set_host_implementation);
  427|  11.9k|}
shuffle.c:set_host_implementation:
  391|      1|static void set_host_implementation(void) {
  392|      1|  host_implementation = get_shuffle_implementation();
  393|      1|#if defined(SHUFFLE_BYTEDELTA_SSSE3_ENABLED)
  394|       |  /* SSSE3 needs only the legacy XMM state, not AVX/XSAVE or YMM support. */
  395|      1|  if (blosc_get_cpu_features() & BLOSC_HAVE_SSSE3) {
  ------------------
  |  Branch (395:7): [True: 1, False: 0]
  ------------------
  396|      1|    host_shuffle_bytedelta_forward = shuffle_bytedelta_ssse3_forward;
  397|      1|    host_shuffle_bytedelta_backward = shuffle_bytedelta_ssse3_backward;
  398|      1|  }
  399|       |#elif defined(__aarch64__) || defined(_M_ARM64)
  400|       |  host_shuffle_bytedelta_forward = shuffle_bytedelta_neon_forward;
  401|       |  host_shuffle_bytedelta_backward = shuffle_bytedelta_neon_backward;
  402|       |#endif
  403|      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:
  512|  6.96k|                              const size_t size, const size_t typesize, void* tmp) {
  513|  6.96k|  if (size == 0) {
  ------------------
  |  Branch (513:7): [True: 0, False: 6.96k]
  ------------------
  514|      0|    return 0;  /* fewer than 8 elements: only leftovers */
  515|      0|  }
  516|  6.96k|  void* scratch = (tmp != NULL) ? tmp : malloc(size * typesize);
  ------------------
  |  Branch (516:19): [True: 6.96k, False: 0]
  ------------------
  517|  6.96k|  if (scratch == NULL) {
  ------------------
  |  Branch (517:7): [True: 0, False: 6.96k]
  ------------------
  518|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
  519|      0|  }
  520|  6.96k|  int64_t ret = routine(src, dest, size, typesize, scratch);
  521|  6.96k|  if (scratch != tmp) {
  ------------------
  |  Branch (521:7): [True: 0, False: 6.96k]
  ------------------
  522|      0|    free(scratch);
  523|      0|  }
  524|  6.96k|  return ret;
  525|  6.96k|}

blosc_stune_next_blocksize:
   47|  2.04k|int blosc_stune_next_blocksize(blosc2_context *context) {
   48|  2.04k|  int32_t clevel = context->clevel;
   49|  2.04k|  int32_t typesize = context->typesize;
   50|  2.04k|  int32_t nbytes = context->sourcesize;
   51|  2.04k|  int32_t user_blocksize = context->blocksize;
   52|  2.04k|  int32_t blocksize = nbytes;
   53|       |
   54|       |  // Protection against very small buffers
   55|  2.04k|  if (nbytes < typesize) {
  ------------------
  |  Branch (55:7): [True: 0, False: 2.04k]
  ------------------
   56|      0|    context->blocksize = 1;
   57|      0|    return BLOSC2_ERROR_SUCCESS;
   58|      0|  }
   59|       |
   60|  2.04k|  int splitmode = split_block(context, typesize, blocksize);
   61|  2.04k|  if (user_blocksize) {
  ------------------
  |  Branch (61:7): [True: 2.04k, False: 0]
  ------------------
   62|  2.04k|    blocksize = user_blocksize;
   63|  2.04k|    goto last;
   64|  2.04k|  }
   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.04k|  last:
  150|       |  /* Check that blocksize is not too large */
  151|  2.04k|  if (blocksize > nbytes) {
  ------------------
  |  Branch (151:7): [True: 691, False: 1.35k]
  ------------------
  152|    691|    blocksize = nbytes;
  153|    691|  }
  154|       |
  155|       |  // blocksize *must absolutely* be a multiple of the typesize
  156|  2.04k|  if (blocksize > typesize) {
  ------------------
  |  Branch (156:7): [True: 1.97k, False: 70]
  ------------------
  157|  1.97k|    blocksize = blocksize / typesize * typesize;
  158|  1.97k|  }
  159|       |
  160|  2.04k|  context->blocksize = blocksize;
  161|  2.04k|  BLOSC_INFO("compcode: %d, clevel: %d, blocksize: %d, splitmode: %d, typesize: %d",
  ------------------
  |  |  121|  2.04k|    do {                                            \
  |  |  122|  2.04k|        const char *__e = getenv("BLOSC_INFO");     \
  |  |  123|  2.04k|        if (!__e) { break; }                        \
  |  |  ------------------
  |  |  |  Branch (123:13): [True: 2.04k, False: 0]
  |  |  ------------------
  |  |  124|  2.04k|        fprintf(stderr, "[INFO] - " msg "\n", ##__VA_ARGS__); \
  |  |  125|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  162|  2.04k|             context->compcode, context->clevel, blocksize, splitmode, typesize);
  163|       |
  164|  2.04k|  return BLOSC2_ERROR_SUCCESS;
  165|      0|}
split_block:
  190|  3.19k|int split_block(blosc2_context *context, int32_t typesize, int32_t blocksize) {
  191|  3.19k|  if (context->blosc1_format &&
  ------------------
  |  Branch (191:7): [True: 0, False: 3.19k]
  ------------------
  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.19k|  switch (context->splitmode) {
  197|      0|    case BLOSC_ALWAYS_SPLIT:
  ------------------
  |  Branch (197:5): [True: 0, False: 3.19k]
  ------------------
  198|      0|      return 1;
  199|  1.17k|    case BLOSC_NEVER_SPLIT:
  ------------------
  |  Branch (199:5): [True: 1.17k, False: 2.02k]
  ------------------
  200|  1.17k|      return 0;
  201|  2.02k|    case BLOSC_FORWARD_COMPAT_SPLIT:
  ------------------
  |  Branch (201:5): [True: 2.02k, False: 1.17k]
  ------------------
  202|  2.02k|    case BLOSC_AUTO_SPLIT:
  ------------------
  |  Branch (202:5): [True: 0, False: 3.19k]
  ------------------
  203|       |      // These cases will be handled later
  204|  2.02k|      break;
  205|      0|    default:
  ------------------
  |  Branch (205:5): [True: 0, False: 3.19k]
  ------------------
  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.19k|  }
  208|       |
  209|  2.02k|  int compcode = context->compcode;
  210|  2.02k|  if (compcode == BLOSC_CODEC_OPENZL) {
  ------------------
  |  Branch (210:7): [True: 0, False: 2.02k]
  ------------------
  211|       |    // Never split blocks for OpenZL, as it has its own block mechanisms
  212|      0|    return 0;
  213|      0|  }
  214|  2.02k|  return (
  215|       |          // Fast codecs like blosclz, lz4 seems to prefer to split
  216|  2.02k|          ((compcode == BLOSC_BLOSCLZ) || (compcode == BLOSC_LZ4)
  ------------------
  |  Branch (216:12): [True: 885, False: 1.14k]
  |  Branch (216:43): [True: 111, False: 1.03k]
  ------------------
  217|       |            // and low levels of zstd too
  218|  1.03k|            || ((compcode == BLOSC_ZSTD) && (context->clevel <= 5))
  ------------------
  |  Branch (218:17): [True: 706, False: 325]
  |  Branch (218:45): [True: 356, False: 350]
  ------------------
  219|  2.02k|            ) &&
  220|       |          // ...but split seems to harm cratio too much when not using shuffle
  221|  1.35k|          (context->filter_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (221:11): [True: 725, False: 627]
  ------------------
  222|    725|          (typesize <= MAX_STREAMS) &&
  ------------------
  |  |   24|    725|#define MAX_STREAMS 16 /* Cannot be larger than 128 */
  ------------------
  |  Branch (222:11): [True: 725, False: 0]
  ------------------
  223|    725|          (blocksize / typesize) >= BLOSC_MIN_BUFFERSIZE);
  ------------------
  |  Branch (223:11): [True: 654, False: 71]
  ------------------
  224|  2.02k|}

blosc_set_timestamp:
   56|  1.21k|void blosc_set_timestamp(blosc_timestamp_t* timestamp) {
   57|       |  clock_gettime(CLOCK_MONOTONIC, timestamp);
   58|  1.21k|}

truncate_precision32:
   24|      4|                         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|      4|  if ((abs(prec_bits) > BITS_MANTISSA_FLOAT)) {
  ------------------
  |  |   19|      4|#define BITS_MANTISSA_FLOAT 23
  ------------------
  |  Branch (28:7): [True: 0, False: 4]
  ------------------
   29|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |   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|      0|                      BITS_MANTISSA_FLOAT, prec_bits);
   31|      0|    return -1;
   32|      0|  }
   33|      4|  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: 4]
  ------------------
   34|      4|  if (zeroed_bits >= BITS_MANTISSA_FLOAT) {
  ------------------
  |  |   19|      4|#define BITS_MANTISSA_FLOAT 23
  ------------------
  |  Branch (34:7): [True: 0, False: 4]
  ------------------
   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|      4|  int32_t mask = ~((1 << zeroed_bits) - 1);
   40|  1.02k|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (40:19): [True: 1.02k, False: 4]
  ------------------
   41|  1.02k|    dest[i] = src[i] & mask;
   42|  1.02k|  }
   43|      4|  return 0;
   44|      4|}
truncate_precision64:
   47|     64|                          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|     64|  if ((abs(prec_bits) > BITS_MANTISSA_DOUBLE)) {
  ------------------
  |  |   20|     64|#define BITS_MANTISSA_DOUBLE 52
  ------------------
  |  Branch (51:7): [True: 0, False: 64]
  ------------------
   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|     64|  int zeroed_bits = (prec_bits >= 0) ? BITS_MANTISSA_DOUBLE - prec_bits : -prec_bits;
  ------------------
  |  |   20|      0|#define BITS_MANTISSA_DOUBLE 52
  ------------------
  |  Branch (56:21): [True: 0, False: 64]
  ------------------
   57|     64|  if (zeroed_bits >= BITS_MANTISSA_DOUBLE) {
  ------------------
  |  |   20|     64|#define BITS_MANTISSA_DOUBLE 52
  ------------------
  |  Branch (57:7): [True: 0, False: 64]
  ------------------
   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|     64|  uint64_t mask = ~((1ULL << zeroed_bits) - 1ULL);
   63|    576|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (63:19): [True: 512, False: 64]
  ------------------
   64|    512|    dest[i] = (int64_t)(src[i] & mask);
   65|    512|  }
   66|     64|  return 0;
   67|     64|}
truncate_precision:
   71|     70|                       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|     70|  switch (typesize) {
   75|      4|    case 4:
  ------------------
  |  Branch (75:5): [True: 4, False: 66]
  ------------------
   76|      4|      return truncate_precision32(prec_bits, nbytes / typesize,
   77|      4|                              (int32_t *)src, (int32_t *)dest);
   78|     64|    case 8:
  ------------------
  |  Branch (78:5): [True: 64, False: 6]
  ------------------
   79|     64|      return truncate_precision64(prec_bits, nbytes / typesize,
   80|     64|                              (int64_t *)src, (int64_t *)dest);
   81|      2|    default:
  ------------------
  |  Branch (81:5): [True: 2, False: 68]
  ------------------
   82|       |      BLOSC_TRACE_ERROR("Error in trunc-prec filter: Precision for typesize %d not handled",
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   83|      2|                        (int)typesize);
   84|      2|      return -1;
   85|     70|  }
   86|     70|}

b2nd.c:b2nd_deserialize_meta_inline:
  707|  2.48k|                                                int32_t *chunkshape, int32_t *blockshape, char **dtype, int8_t *dtype_format) {
  708|  2.48k|  BLOSC_ERROR_NULL(smeta, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  2.48k|    do {                                            \
  |  |  105|  2.48k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  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|  2.48k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  709|  2.48k|  BLOSC_ERROR_NULL(ndim, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  2.48k|    do {                                            \
  |  |  105|  2.48k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  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|  2.48k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  710|  2.48k|  BLOSC_ERROR_NULL(shape, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  2.48k|    do {                                            \
  |  |  105|  2.48k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  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|  2.48k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  711|  2.48k|  BLOSC_ERROR_NULL(chunkshape, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  2.48k|    do {                                            \
  |  |  105|  2.48k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  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|  2.48k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  712|  2.48k|  BLOSC_ERROR_NULL(blockshape, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|  2.48k|    do {                                            \
  |  |  105|  2.48k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  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|  2.48k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  713|  2.48k|  if (dtype != NULL) {
  ------------------
  |  Branch (713:7): [True: 172, False: 2.31k]
  ------------------
  714|    172|    *dtype = NULL;
  715|    172|  }
  716|  2.48k|  if (dtype_format != NULL) {
  ------------------
  |  Branch (716:7): [True: 172, False: 2.31k]
  ------------------
  717|    172|    *dtype_format = 0;
  718|    172|  }
  719|  2.48k|  if (smeta_len <= 0) {
  ------------------
  |  Branch (719:7): [True: 0, False: 2.48k]
  ------------------
  720|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  721|      0|    return BLOSC2_ERROR_FAILURE;
  722|      0|  }
  723|       |
  724|  2.48k|  const uint8_t *pmeta = smeta;
  725|       |
  726|  2.48k|#define B2ND_REQUIRE_META_NBYTES(nbytes)                                             \
  727|  2.48k|  do {                                                                                \
  728|  2.48k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  729|  2.48k|    size_t total = (size_t)smeta_len;                                                 \
  730|  2.48k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  731|  2.48k|      BLOSC_TRACE_ERROR("Malformed b2nd metalayer: truncated metadata");            \
  732|  2.48k|      return BLOSC2_ERROR_FAILURE;                                                    \
  733|  2.48k|    }                                                                                 \
  734|  2.48k|  } while (0)
  735|       |
  736|       |  // Check that we have an array with 7 entries (version, ndim, shape, chunkshape, blockshape, dtype_format, dtype)
  737|  2.48k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  727|  2.48k|  do {                                                                                \
  |  |  728|  2.48k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|  2.48k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|  2.48k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 2.48k]
  |  |  |  Branch (730:29): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|  2.48k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  738|  2.48k|  pmeta += 1;
  739|       |
  740|       |  // version entry
  741|       |  // int8_t version = (int8_t)pmeta[0];  // positive fixnum (7-bit positive integer) commented to avoid warning
  742|  2.48k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  727|  2.48k|  do {                                                                                \
  |  |  728|  2.48k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|  2.48k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|  2.48k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 2.48k]
  |  |  |  Branch (730:29): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|  2.48k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  743|  2.48k|  pmeta += 1;
  744|       |
  745|       |  // ndim entry
  746|  2.48k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  727|  2.48k|  do {                                                                                \
  |  |  728|  2.48k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|  2.48k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|  2.48k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 2.48k]
  |  |  |  Branch (730:29): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|  2.48k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  747|  2.48k|  *ndim = (int8_t) pmeta[0];
  748|  2.48k|  int8_t ndim_aux = *ndim;  // positive fixnum (7-bit positive integer)
  749|  2.48k|  if (ndim_aux < 0 || ndim_aux > B2ND_MAX_DIM) {
  ------------------
  |  |   50|  2.48k|#define B2ND_MAX_DIM 16
  ------------------
  |  Branch (749:7): [True: 0, False: 2.48k]
  |  Branch (749:23): [True: 0, False: 2.48k]
  ------------------
  750|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  751|      0|    return BLOSC2_ERROR_FAILURE;
  752|      0|  }
  753|  2.48k|  pmeta += 1;
  754|       |
  755|       |  // shape entry
  756|       |  // Initialize to ones, as required by b2nd
  757|  12.0k|  for (int i = 0; i < ndim_aux; i++) shape[i] = 1;
  ------------------
  |  Branch (757:19): [True: 9.60k, False: 2.48k]
  ------------------
  758|  2.48k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  727|  2.48k|  do {                                                                                \
  |  |  728|  2.48k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|  2.48k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|  2.48k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 2.48k]
  |  |  |  Branch (730:29): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|  2.48k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  759|  2.48k|  pmeta += 1;
  760|  12.0k|  for (int8_t i = 0; i < ndim_aux; i++) {
  ------------------
  |  Branch (760:22): [True: 9.60k, False: 2.48k]
  ------------------
  761|  9.60k|    B2ND_REQUIRE_META_NBYTES(1 + sizeof(int64_t));
  ------------------
  |  |  727|  9.60k|  do {                                                                                \
  |  |  728|  9.60k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|  9.60k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|  9.60k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 9.60k]
  |  |  |  Branch (730:29): [True: 0, False: 9.60k]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|  9.60k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 9.60k]
  |  |  ------------------
  ------------------
  762|  9.60k|    pmeta += 1;
  763|  9.60k|    swap_store(shape + i, pmeta, sizeof(int64_t));
  764|  9.60k|    pmeta += sizeof(int64_t);
  765|  9.60k|  }
  766|       |
  767|       |  // chunkshape entry
  768|       |  // Initialize to ones, as required by b2nd
  769|  12.0k|  for (int i = 0; i < ndim_aux; i++) chunkshape[i] = 1;
  ------------------
  |  Branch (769:19): [True: 9.60k, False: 2.48k]
  ------------------
  770|  2.48k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  727|  2.48k|  do {                                                                                \
  |  |  728|  2.48k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|  2.48k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|  2.48k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 2.48k]
  |  |  |  Branch (730:29): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|  2.48k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  771|  2.48k|  pmeta += 1;
  772|  12.0k|  for (int8_t i = 0; i < ndim_aux; i++) {
  ------------------
  |  Branch (772:22): [True: 9.60k, False: 2.48k]
  ------------------
  773|  9.60k|    B2ND_REQUIRE_META_NBYTES(1 + sizeof(int32_t));
  ------------------
  |  |  727|  9.60k|  do {                                                                                \
  |  |  728|  9.60k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|  9.60k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|  9.60k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 9.60k]
  |  |  |  Branch (730:29): [True: 0, False: 9.60k]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|  9.60k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 9.60k]
  |  |  ------------------
  ------------------
  774|  9.60k|    pmeta += 1;
  775|  9.60k|    swap_store(chunkshape + i, pmeta, sizeof(int32_t));
  776|  9.60k|    pmeta += sizeof(int32_t);
  777|  9.60k|  }
  778|       |
  779|       |  // blockshape entry
  780|       |  // Initialize to ones, as required by b2nd
  781|  12.0k|  for (int i = 0; i < ndim_aux; i++) blockshape[i] = 1;
  ------------------
  |  Branch (781:19): [True: 9.60k, False: 2.48k]
  ------------------
  782|  2.48k|  B2ND_REQUIRE_META_NBYTES(1);
  ------------------
  |  |  727|  2.48k|  do {                                                                                \
  |  |  728|  2.48k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|  2.48k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|  2.48k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 2.48k]
  |  |  |  Branch (730:29): [True: 0, False: 2.48k]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|  2.48k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 2.48k]
  |  |  ------------------
  ------------------
  783|  2.48k|  pmeta += 1;
  784|  12.0k|  for (int8_t i = 0; i < ndim_aux; i++) {
  ------------------
  |  Branch (784:22): [True: 9.60k, False: 2.48k]
  ------------------
  785|  9.60k|    B2ND_REQUIRE_META_NBYTES(1 + sizeof(int32_t));
  ------------------
  |  |  727|  9.60k|  do {                                                                                \
  |  |  728|  9.60k|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|  9.60k|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|  9.60k|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 9.60k]
  |  |  |  Branch (730:29): [True: 0, False: 9.60k]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|  9.60k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 9.60k]
  |  |  ------------------
  ------------------
  786|  9.60k|    pmeta += 1;
  787|  9.60k|    swap_store(blockshape + i, pmeta, sizeof(int32_t));
  788|  9.60k|    pmeta += sizeof(int32_t);
  789|  9.60k|  }
  790|       |
  791|       |  // dtype entry
  792|  2.48k|  if (dtype_format == NULL || dtype == NULL) {
  ------------------
  |  Branch (792:7): [True: 2.31k, False: 172]
  |  Branch (792:31): [True: 0, False: 172]
  ------------------
  793|  2.31k|    return (int32_t)(pmeta - smeta);
  794|  2.31k|  }
  795|    172|  if (pmeta - smeta < smeta_len) {
  ------------------
  |  Branch (795:7): [True: 172, False: 0]
  ------------------
  796|       |    // dtype info is here
  797|    172|    B2ND_REQUIRE_META_NBYTES(1 + 1 + sizeof(int32_t));
  ------------------
  |  |  727|    172|  do {                                                                                \
  |  |  728|    172|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|    172|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|    172|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 172]
  |  |  |  Branch (730:29): [True: 0, False: 172]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|    172|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 172]
  |  |  ------------------
  ------------------
  798|    172|    *dtype_format = (int8_t) *(pmeta++);
  799|    172|    if (*pmeta != 0xdb) {
  ------------------
  |  Branch (799:9): [True: 0, False: 172]
  ------------------
  800|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  801|      0|      return BLOSC2_ERROR_FAILURE;
  802|      0|    }
  803|    172|    pmeta += 1;
  804|    172|    int32_t dtype_len;
  805|    172|    swap_store(&dtype_len, pmeta, sizeof(int32_t));
  806|    172|    pmeta += sizeof(int32_t);
  807|    172|    if (dtype_len < 0) {
  ------------------
  |  Branch (807:9): [True: 0, False: 172]
  ------------------
  808|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  809|      0|      return BLOSC2_ERROR_FAILURE;
  810|      0|    }
  811|    172|    B2ND_REQUIRE_META_NBYTES(dtype_len);
  ------------------
  |  |  727|    172|  do {                                                                                \
  |  |  728|    172|    size_t consumed = (size_t)(pmeta - smeta);                                        \
  |  |  729|    172|    size_t total = (size_t)smeta_len;                                                 \
  |  |  730|    172|    if (consumed > total || (total - consumed) < (size_t)(nbytes)) {                 \
  |  |  ------------------
  |  |  |  Branch (730:9): [True: 0, False: 172]
  |  |  |  Branch (730:29): [True: 0, False: 172]
  |  |  ------------------
  |  |  731|      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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  732|      0|      return BLOSC2_ERROR_FAILURE;                                                    \
  |  |  733|      0|    }                                                                                 \
  |  |  734|    172|  } while (0)
  |  |  ------------------
  |  |  |  Branch (734:12): [Folded, False: 172]
  |  |  ------------------
  ------------------
  812|    172|    size_t dtype_len_ = (size_t)dtype_len;
  813|    172|    *dtype = (char*)malloc(dtype_len_ + 1);
  814|    172|    BLOSC_ERROR_NULL(*dtype, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|    172|    do {                                            \
  |  |  105|    172|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 172]
  |  |  ------------------
  |  |  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|    172|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 172]
  |  |  ------------------
  ------------------
  815|    172|    char* dtype_ = *dtype;
  816|    172|    memcpy(dtype_, (char*)pmeta, dtype_len_);
  817|    172|    dtype_[dtype_len_] = '\0';
  818|    172|    pmeta += dtype_len_;
  819|    172|  }
  820|      0|  else {
  821|       |    // dtype is mandatory in b2nd metalayer, but this is mainly meant as
  822|       |    // a fall-back for deprecated caterva headers
  823|      0|    *dtype = NULL;
  824|      0|    *dtype_format = 0;
  825|      0|  }
  826|       |
  827|    172|#undef B2ND_REQUIRE_META_NBYTES
  828|       |
  829|    172|  int32_t slen = (int32_t) (pmeta - smeta);
  830|    172|  return (int)slen;
  831|    172|}

blosc2.c:print_error:
  525|      5|static char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|      5|  return (char *) blosc2_error_string(rc);
  528|      5|}
schunk.c:blosc2_meta_exists:
 2685|     87|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2686|     87|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|     87|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2686:7): [True: 0, False: 87]
  ------------------
 2687|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2687|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2688|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2689|      0|  }
 2690|       |
 2691|     87|  if (schunk == NULL) {
  ------------------
  |  Branch (2691:7): [True: 0, False: 87]
  ------------------
 2692|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2693|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2694|      0|  }
 2695|       |
 2696|     87|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2696:28): [True: 0, False: 87]
  ------------------
 2697|      0|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2697:9): [True: 0, False: 0]
  ------------------
 2698|      0|      return nmetalayer;
 2699|      0|    }
 2700|      0|  }
 2701|     87|  return BLOSC2_ERROR_NOT_FOUND;
 2702|     87|}
b2nd.c:print_error:
  525|      4|static char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|      4|  return (char *) blosc2_error_string(rc);
  528|      4|}
b2nd.c:swap_store:
 3254|  29.9k|static inline void swap_store(void *dest, const void *pa, int size) {
 3255|  29.9k|  uint8_t *pa_ = (uint8_t *) pa;
 3256|  29.9k|  uint8_t *pa2_ = (uint8_t*)malloc((size_t) size);
 3257|  29.9k|  int i = 1; /* for big/little endian detection */
 3258|  29.9k|  char *p = (char *) &i;
 3259|       |
 3260|  29.9k|  if (p[0] == 1) {
  ------------------
  |  Branch (3260:7): [True: 29.9k, False: 0]
  ------------------
 3261|       |    /* little endian */
 3262|  29.9k|    switch (size) {
 3263|  9.90k|      case 8:
  ------------------
  |  Branch (3263:7): [True: 9.90k, False: 20.0k]
  ------------------
 3264|  9.90k|        pa2_[0] = pa_[7];
 3265|  9.90k|        pa2_[1] = pa_[6];
 3266|  9.90k|        pa2_[2] = pa_[5];
 3267|  9.90k|        pa2_[3] = pa_[4];
 3268|  9.90k|        pa2_[4] = pa_[3];
 3269|  9.90k|        pa2_[5] = pa_[2];
 3270|  9.90k|        pa2_[6] = pa_[1];
 3271|  9.90k|        pa2_[7] = pa_[0];
 3272|  9.90k|        break;
 3273|  20.0k|      case 4:
  ------------------
  |  Branch (3273:7): [True: 20.0k, False: 9.90k]
  ------------------
 3274|  20.0k|        pa2_[0] = pa_[3];
 3275|  20.0k|        pa2_[1] = pa_[2];
 3276|  20.0k|        pa2_[2] = pa_[1];
 3277|  20.0k|        pa2_[3] = pa_[0];
 3278|  20.0k|        break;
 3279|      0|      case 2:
  ------------------
  |  Branch (3279:7): [True: 0, False: 29.9k]
  ------------------
 3280|      0|        pa2_[0] = pa_[1];
 3281|      0|        pa2_[1] = pa_[0];
 3282|      0|        break;
 3283|      0|      case 1:
  ------------------
  |  Branch (3283:7): [True: 0, False: 29.9k]
  ------------------
 3284|      0|        pa2_[0] = pa_[0];
 3285|      0|        break;
 3286|      0|      default:
  ------------------
  |  Branch (3286:7): [True: 0, False: 29.9k]
  ------------------
 3287|      0|        fprintf(stderr, "Unhandled nitems: %d\n", size);
 3288|  29.9k|    }
 3289|  29.9k|  } else {
 3290|       |    /* big endian: native byte order is already big-endian, just copy */
 3291|      0|    memcpy(pa2_, pa_, size);
 3292|      0|  }
 3293|  29.9k|  memcpy(dest, pa2_, size);
 3294|  29.9k|  free(pa2_);
 3295|  29.9k|}
b2nd.c:blosc2_meta_exists:
 2685|    172|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2686|    172|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|    172|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2686:7): [True: 0, False: 172]
  ------------------
 2687|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2687|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2688|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2689|      0|  }
 2690|       |
 2691|    172|  if (schunk == NULL) {
  ------------------
  |  Branch (2691:7): [True: 0, False: 172]
  ------------------
 2692|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2693|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2694|      0|  }
 2695|       |
 2696|    172|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2696:28): [True: 172, False: 0]
  ------------------
 2697|    172|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2697:9): [True: 172, False: 0]
  ------------------
 2698|    172|      return nmetalayer;
 2699|    172|    }
 2700|    172|  }
 2701|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2702|    172|}
b2nd.c:blosc2_meta_get:
 2754|    172|                                  int32_t *content_len) {
 2755|    172|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2755:7): [True: 0, False: 172]
  |  Branch (2755:25): [True: 0, False: 172]
  |  Branch (2755:41): [True: 0, False: 172]
  |  Branch (2755:60): [True: 0, False: 172]
  ------------------
 2756|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2757|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2758|      0|  }
 2759|       |
 2760|    172|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2761|    172|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2761:7): [True: 0, False: 172]
  ------------------
 2762|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2763|      0|    return nmetalayer;
 2764|      0|  }
 2765|    172|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2766|    172|  if (len < 0) {
  ------------------
  |  Branch (2766:7): [True: 0, False: 172]
  ------------------
 2767|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2768|      0|    return BLOSC2_ERROR_DATA;
 2769|      0|  }
 2770|    172|  *content_len = len;
 2771|    172|  if (len == 0) {
  ------------------
  |  Branch (2771:7): [True: 0, False: 172]
  ------------------
 2772|      0|    *content = NULL;
 2773|      0|    return nmetalayer;
 2774|      0|  }
 2775|    172|  *content = (uint8_t*)malloc((size_t)len);
 2776|    172|  if (*content == NULL) {
  ------------------
  |  Branch (2776:7): [True: 0, False: 172]
  ------------------
 2777|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2778|      0|    *content_len = 0;
 2779|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2780|      0|  }
 2781|    172|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2781:7): [True: 172, False: 0]
  |  Branch (2781:18): [True: 0, False: 172]
  ------------------
 2782|      0|    free(*content);
 2783|      0|    *content = NULL;
 2784|      0|    *content_len = 0;
 2785|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2786|      0|    return BLOSC2_ERROR_DATA;
 2787|      0|  }
 2788|    172|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2789|    172|  return nmetalayer;
 2790|    172|}
blosc2-zfp.c:blosc2_meta_get:
 2754|    403|                                  int32_t *content_len) {
 2755|    403|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2755:7): [True: 0, False: 403]
  |  Branch (2755:25): [True: 0, False: 403]
  |  Branch (2755:41): [True: 0, False: 403]
  |  Branch (2755:60): [True: 0, False: 403]
  ------------------
 2756|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2757|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2758|      0|  }
 2759|       |
 2760|    403|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2761|    403|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2761:7): [True: 0, False: 403]
  ------------------
 2762|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2763|      0|    return nmetalayer;
 2764|      0|  }
 2765|    403|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2766|    403|  if (len < 0) {
  ------------------
  |  Branch (2766:7): [True: 0, False: 403]
  ------------------
 2767|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2768|      0|    return BLOSC2_ERROR_DATA;
 2769|      0|  }
 2770|    403|  *content_len = len;
 2771|    403|  if (len == 0) {
  ------------------
  |  Branch (2771:7): [True: 0, False: 403]
  ------------------
 2772|      0|    *content = NULL;
 2773|      0|    return nmetalayer;
 2774|      0|  }
 2775|    403|  *content = (uint8_t*)malloc((size_t)len);
 2776|    403|  if (*content == NULL) {
  ------------------
  |  Branch (2776:7): [True: 0, False: 403]
  ------------------
 2777|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2778|      0|    *content_len = 0;
 2779|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2780|      0|  }
 2781|    403|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2781:7): [True: 403, False: 0]
  |  Branch (2781:18): [True: 0, False: 403]
  ------------------
 2782|      0|    free(*content);
 2783|      0|    *content = NULL;
 2784|      0|    *content_len = 0;
 2785|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2786|      0|    return BLOSC2_ERROR_DATA;
 2787|      0|  }
 2788|    403|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2789|    403|  return nmetalayer;
 2790|    403|}
blosc2-zfp.c:blosc2_meta_exists:
 2685|    403|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2686|    403|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|    403|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2686:7): [True: 0, False: 403]
  ------------------
 2687|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2687|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2688|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2689|      0|  }
 2690|       |
 2691|    403|  if (schunk == NULL) {
  ------------------
  |  Branch (2691:7): [True: 0, False: 403]
  ------------------
 2692|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2693|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2694|      0|  }
 2695|       |
 2696|    403|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2696:28): [True: 403, False: 0]
  ------------------
 2697|    403|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2697:9): [True: 403, False: 0]
  ------------------
 2698|    403|      return nmetalayer;
 2699|    403|    }
 2700|    403|  }
 2701|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2702|    403|}
ndlz8x8.c:blosc2_meta_get:
 2754|      1|                                  int32_t *content_len) {
 2755|      1|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2755:7): [True: 0, False: 1]
  |  Branch (2755:25): [True: 0, False: 1]
  |  Branch (2755:41): [True: 0, False: 1]
  |  Branch (2755:60): [True: 0, False: 1]
  ------------------
 2756|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2757|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2758|      0|  }
 2759|       |
 2760|      1|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2761|      1|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2761:7): [True: 0, False: 1]
  ------------------
 2762|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2763|      0|    return nmetalayer;
 2764|      0|  }
 2765|      1|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2766|      1|  if (len < 0) {
  ------------------
  |  Branch (2766:7): [True: 0, False: 1]
  ------------------
 2767|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2768|      0|    return BLOSC2_ERROR_DATA;
 2769|      0|  }
 2770|      1|  *content_len = len;
 2771|      1|  if (len == 0) {
  ------------------
  |  Branch (2771:7): [True: 0, False: 1]
  ------------------
 2772|      0|    *content = NULL;
 2773|      0|    return nmetalayer;
 2774|      0|  }
 2775|      1|  *content = (uint8_t*)malloc((size_t)len);
 2776|      1|  if (*content == NULL) {
  ------------------
  |  Branch (2776:7): [True: 0, False: 1]
  ------------------
 2777|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2778|      0|    *content_len = 0;
 2779|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2780|      0|  }
 2781|      1|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2781:7): [True: 1, False: 0]
  |  Branch (2781:18): [True: 0, False: 1]
  ------------------
 2782|      0|    free(*content);
 2783|      0|    *content = NULL;
 2784|      0|    *content_len = 0;
 2785|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2786|      0|    return BLOSC2_ERROR_DATA;
 2787|      0|  }
 2788|      1|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2789|      1|  return nmetalayer;
 2790|      1|}
ndlz8x8.c:blosc2_meta_exists:
 2685|      1|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2686|      1|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|      1|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2686:7): [True: 0, False: 1]
  ------------------
 2687|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2687|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2688|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2689|      0|  }
 2690|       |
 2691|      1|  if (schunk == NULL) {
  ------------------
  |  Branch (2691:7): [True: 0, False: 1]
  ------------------
 2692|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2693|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2694|      0|  }
 2695|       |
 2696|      1|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2696:28): [True: 1, False: 0]
  ------------------
 2697|      1|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2697:9): [True: 1, False: 0]
  ------------------
 2698|      1|      return nmetalayer;
 2699|      1|    }
 2700|      1|  }
 2701|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2702|      1|}
ndcell.c:blosc2_meta_get:
 2754|    501|                                  int32_t *content_len) {
 2755|    501|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2755:7): [True: 0, False: 501]
  |  Branch (2755:25): [True: 0, False: 501]
  |  Branch (2755:41): [True: 0, False: 501]
  |  Branch (2755:60): [True: 0, False: 501]
  ------------------
 2756|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2757|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2758|      0|  }
 2759|       |
 2760|    501|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2761|    501|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2761:7): [True: 0, False: 501]
  ------------------
 2762|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2763|      0|    return nmetalayer;
 2764|      0|  }
 2765|    501|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2766|    501|  if (len < 0) {
  ------------------
  |  Branch (2766:7): [True: 0, False: 501]
  ------------------
 2767|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2768|      0|    return BLOSC2_ERROR_DATA;
 2769|      0|  }
 2770|    501|  *content_len = len;
 2771|    501|  if (len == 0) {
  ------------------
  |  Branch (2771:7): [True: 0, False: 501]
  ------------------
 2772|      0|    *content = NULL;
 2773|      0|    return nmetalayer;
 2774|      0|  }
 2775|    501|  *content = (uint8_t*)malloc((size_t)len);
 2776|    501|  if (*content == NULL) {
  ------------------
  |  Branch (2776:7): [True: 0, False: 501]
  ------------------
 2777|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2778|      0|    *content_len = 0;
 2779|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2780|      0|  }
 2781|    501|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2781:7): [True: 501, False: 0]
  |  Branch (2781:18): [True: 0, False: 501]
  ------------------
 2782|      0|    free(*content);
 2783|      0|    *content = NULL;
 2784|      0|    *content_len = 0;
 2785|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2786|      0|    return BLOSC2_ERROR_DATA;
 2787|      0|  }
 2788|    501|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2789|    501|  return nmetalayer;
 2790|    501|}
ndcell.c:blosc2_meta_exists:
 2685|    501|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2686|    501|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|    501|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2686:7): [True: 0, False: 501]
  ------------------
 2687|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2687|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2688|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2689|      0|  }
 2690|       |
 2691|    501|  if (schunk == NULL) {
  ------------------
  |  Branch (2691:7): [True: 0, False: 501]
  ------------------
 2692|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2693|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2694|      0|  }
 2695|       |
 2696|    501|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2696:28): [True: 501, False: 0]
  ------------------
 2697|    501|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2697:9): [True: 501, False: 0]
  ------------------
 2698|    501|      return nmetalayer;
 2699|    501|    }
 2700|    501|  }
 2701|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2702|    501|}
ndmean.c:blosc2_meta_get:
 2754|  1.40k|                                  int32_t *content_len) {
 2755|  1.40k|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2755:7): [True: 0, False: 1.40k]
  |  Branch (2755:25): [True: 0, False: 1.40k]
  |  Branch (2755:41): [True: 0, False: 1.40k]
  |  Branch (2755:60): [True: 0, False: 1.40k]
  ------------------
 2756|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2757|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2758|      0|  }
 2759|       |
 2760|  1.40k|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2761|  1.40k|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2761:7): [True: 0, False: 1.40k]
  ------------------
 2762|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2763|      0|    return nmetalayer;
 2764|      0|  }
 2765|  1.40k|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2766|  1.40k|  if (len < 0) {
  ------------------
  |  Branch (2766:7): [True: 0, False: 1.40k]
  ------------------
 2767|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2768|      0|    return BLOSC2_ERROR_DATA;
 2769|      0|  }
 2770|  1.40k|  *content_len = len;
 2771|  1.40k|  if (len == 0) {
  ------------------
  |  Branch (2771:7): [True: 0, False: 1.40k]
  ------------------
 2772|      0|    *content = NULL;
 2773|      0|    return nmetalayer;
 2774|      0|  }
 2775|  1.40k|  *content = (uint8_t*)malloc((size_t)len);
 2776|  1.40k|  if (*content == NULL) {
  ------------------
  |  Branch (2776:7): [True: 0, False: 1.40k]
  ------------------
 2777|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2778|      0|    *content_len = 0;
 2779|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2780|      0|  }
 2781|  1.40k|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2781:7): [True: 1.40k, False: 0]
  |  Branch (2781:18): [True: 0, False: 1.40k]
  ------------------
 2782|      0|    free(*content);
 2783|      0|    *content = NULL;
 2784|      0|    *content_len = 0;
 2785|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2786|      0|    return BLOSC2_ERROR_DATA;
 2787|      0|  }
 2788|  1.40k|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2789|  1.40k|  return nmetalayer;
 2790|  1.40k|}
ndmean.c:blosc2_meta_exists:
 2685|  1.40k|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2686|  1.40k|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|  1.40k|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2686:7): [True: 0, False: 1.40k]
  ------------------
 2687|      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__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2687|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2688|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2689|      0|  }
 2690|       |
 2691|  1.40k|  if (schunk == NULL) {
  ------------------
  |  Branch (2691:7): [True: 0, False: 1.40k]
  ------------------
 2692|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2693|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2694|      0|  }
 2695|       |
 2696|  1.40k|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2696:28): [True: 1.40k, False: 0]
  ------------------
 2697|  1.40k|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2697:9): [True: 1.40k, False: 0]
  ------------------
 2698|  1.40k|      return nmetalayer;
 2699|  1.40k|    }
 2700|  1.40k|  }
 2701|      0|  return BLOSC2_ERROR_NOT_FOUND;
 2702|  1.40k|}

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

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|}

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|}

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

simd_load:
   34|  7.96k|bytes16 simd_load(const void* ptr) { return _mm_loadu_si128((const __m128i*)ptr); }
simd_store:
   35|  7.96k|void simd_store(void* ptr, bytes16 x) { _mm_storeu_si128((__m128i*)ptr, x); }
simd_concat:
   37|  4.64k|bytes16 simd_concat(bytes16 hi, bytes16 lo) { return _mm_alignr_epi8(hi, lo, 15); }
simd_add:
   38|  3.32k|bytes16 simd_add(bytes16 a, bytes16 b) { return _mm_add_epi8(a, b); }
simd_sub:
   39|  4.64k|bytes16 simd_sub(bytes16 a, bytes16 b) { return _mm_sub_epi8(a, b); }
simd_duplane15:
   40|  3.32k|bytes16 simd_duplane15(bytes16 x) { return _mm_shuffle_epi8(x, _mm_set1_epi8(15)); }
simd_prefix_sum:
   43|  3.32k|{
   44|       |  // Sklansky-style sum from https://gist.github.com/rygorous/4212be0cd009584e4184e641ca210528
   45|  3.32k|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 8));
   46|  3.32k|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 16));
   47|  3.32k|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 32));
   48|  3.32k|  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|  3.32k|  return x;
   50|  3.32k|}
simd_get_last:
   52|  7.26k|uint8_t simd_get_last(bytes16 x) { return (_mm_extract_epi16(x, 7) >> 8) & 0xFF; }
bytedelta_forward:
  280|    776|                      blosc2_cparams *cparams, uint8_t id) {
  281|    776|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    776|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  282|       |
  283|    776|  int typesize = meta;
  284|    776|  if (typesize == 0) {
  ------------------
  |  Branch (284:7): [True: 0, False: 776]
  ------------------
  285|      0|    if (cparams->schunk == NULL) {
  ------------------
  |  Branch (285:9): [True: 0, False: 0]
  ------------------
  286|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  287|      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]
  |  |  ------------------
  ------------------
  288|      0|    }
  289|      0|    blosc2_schunk* schunk = (blosc2_schunk*)(cparams->schunk);
  290|      0|    typesize = schunk->typesize;
  291|      0|  }
  292|       |
  293|    776|  const int stream_len = length / typesize;
  294|  4.90k|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (294:21): [True: 4.12k, False: 776]
  ------------------
  295|  4.12k|    int ip = 0;
  296|  4.12k|    uint8_t _v2 = 0;
  297|       |    // SIMD delta within each channel, store
  298|  4.12k|#if defined(CPU_HAS_SIMD)
  299|  4.12k|    bytes16 v2 = {0};
  300|  8.35k|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (300:12): [True: 4.22k, False: 4.12k]
  ------------------
  301|  4.22k|      bytes16 v = simd_load(input);
  302|  4.22k|      input += 16;
  303|  4.22k|      bytes16 delta = simd_sub(v, simd_concat(v, v2));
  304|  4.22k|      simd_store(output, delta);
  305|  4.22k|      output += 16;
  306|  4.22k|      v2 = v;
  307|  4.22k|    }
  308|  4.12k|    if (stream_len > 15) {
  ------------------
  |  Branch (308:9): [True: 4.12k, False: 0]
  ------------------
  309|  4.12k|      _v2 = simd_get_last(v2);
  310|  4.12k|    }
  311|  4.12k|#endif // #if defined(CPU_HAS_SIMD)
  312|       |    // scalar leftover
  313|  4.12k|    for (; ip < stream_len ; ip++) {
  ------------------
  |  Branch (313:12): [True: 0, False: 4.12k]
  ------------------
  314|      0|      uint8_t v = *input;
  315|      0|      input++;
  316|      0|      *output = v - _v2;
  317|      0|      output++;
  318|      0|      _v2 = v;
  319|      0|    }
  320|  4.12k|  }
  321|       |
  322|       |  // When length is not a multiple of typesize, the trailing length % typesize
  323|       |  // bytes do not belong to any channel (shuffle leaves them in place too).
  324|       |  // Pass them through verbatim, or they would be left uninitialized in output.
  325|    776|  memcpy(output, input, (size_t)(length - stream_len * typesize));
  326|       |
  327|    776|  return BLOSC2_ERROR_SUCCESS;
  328|    776|}
bytedelta_backward:
  332|    784|                       blosc2_dparams *dparams, uint8_t id) {
  333|    784|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    784|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  334|       |
  335|    784|  int typesize = meta;
  336|    784|  if (typesize == 0) {
  ------------------
  |  Branch (336:7): [True: 0, False: 784]
  ------------------
  337|      0|    if (dparams->schunk == NULL) {
  ------------------
  |  Branch (337:9): [True: 0, False: 0]
  ------------------
  338|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  339|      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]
  |  |  ------------------
  ------------------
  340|      0|    }
  341|      0|    blosc2_schunk* schunk = (blosc2_schunk*)(dparams->schunk);
  342|      0|    typesize = schunk->typesize;
  343|      0|  }
  344|       |
  345|    784|  const int stream_len = length / typesize;
  346|  3.92k|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (346:21): [True: 3.13k, False: 784]
  ------------------
  347|  3.13k|    int ip = 0;
  348|  3.13k|    uint8_t _v2 = 0;
  349|       |    // SIMD fetch 16 bytes from each channel, prefix-sum un-delta
  350|  3.13k|#if defined(CPU_HAS_SIMD)
  351|  3.13k|    bytes16 v2 = {0};
  352|  6.46k|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (352:12): [True: 3.32k, False: 3.13k]
  ------------------
  353|  3.32k|      bytes16 v = simd_load(input);
  354|  3.32k|      input += 16;
  355|       |      // un-delta via prefix sum
  356|  3.32k|      v2 = simd_add(simd_prefix_sum(v), simd_duplane15(v2));
  357|  3.32k|      simd_store(output, v2);
  358|  3.32k|      output += 16;
  359|  3.32k|    }
  360|  3.13k|    if (stream_len > 15) {
  ------------------
  |  Branch (360:9): [True: 3.13k, False: 0]
  ------------------
  361|  3.13k|      _v2 = simd_get_last(v2);
  362|  3.13k|    }
  363|  3.13k|#endif // #if defined(CPU_HAS_SIMD)
  364|       |    // scalar leftover
  365|  3.13k|    for (; ip < stream_len; ip++) {
  ------------------
  |  Branch (365:12): [True: 0, False: 3.13k]
  ------------------
  366|      0|      uint8_t v = *input + _v2;
  367|      0|      input++;
  368|      0|      *output = v;
  369|      0|      output++;
  370|      0|      _v2 = v;
  371|      0|    }
  372|  3.13k|  }
  373|       |
  374|       |  // Mirror of the forward pass: restore the trailing bytes verbatim.
  375|    784|  memcpy(output, input, (size_t)(length - stream_len * typesize));
  376|       |
  377|    784|  return BLOSC2_ERROR_SUCCESS;
  378|    784|}
bytedelta_forward_buggy:
  384|    208|                            uint8_t meta, blosc2_cparams *cparams, uint8_t id) {
  385|    208|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    208|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  386|       |
  387|    208|  int typesize = meta;
  388|    208|  if (typesize == 0) {
  ------------------
  |  Branch (388:7): [True: 0, False: 208]
  ------------------
  389|      0|    if (cparams->schunk == NULL) {
  ------------------
  |  Branch (389:9): [True: 0, False: 0]
  ------------------
  390|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  391|      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]
  |  |  ------------------
  ------------------
  392|      0|    }
  393|      0|    blosc2_schunk* schunk = (blosc2_schunk*)(cparams->schunk);
  394|      0|    typesize = schunk->typesize;
  395|      0|  }
  396|       |
  397|    208|  const int stream_len = length / typesize;
  398|    624|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (398:21): [True: 416, False: 208]
  ------------------
  399|    416|    int ip = 0;
  400|       |    // SIMD delta within each channel, store
  401|    416|#if defined(CPU_HAS_SIMD)
  402|    416|    bytes16 v2 = {0};
  403|    832|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (403:12): [True: 416, False: 416]
  ------------------
  404|    416|      bytes16 v = simd_load(input);
  405|    416|      input += 16;
  406|    416|      bytes16 delta = simd_sub(v, simd_concat(v, v2));
  407|    416|      simd_store(output, delta);
  408|    416|      output += 16;
  409|    416|      v2 = v;
  410|    416|    }
  411|    416|#endif // #if defined(CPU_HAS_SIMD)
  412|       |    // scalar leftover
  413|    416|    uint8_t _v2 = 0;
  414|    416|    for (; ip < stream_len ; ip++) {
  ------------------
  |  Branch (414:12): [True: 0, False: 416]
  ------------------
  415|      0|      uint8_t v = *input;
  416|      0|      input++;
  417|      0|      *output = v - _v2;
  418|      0|      output++;
  419|      0|      _v2 = v;
  420|      0|    }
  421|    416|  }
  422|       |
  423|    208|  return BLOSC2_ERROR_SUCCESS;
  424|    208|}

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

truncate_uint8:
   19|      1|                   const uint8_t *src, uint8_t *dest) {
   20|      1|  uint8_t max_prec_bits = (uint8_t) sizeof(uint8_t) * 8;
   21|      1|  uint8_t zeroed_bits = (prec_bits >= 0) ? max_prec_bits - prec_bits : -prec_bits;
  ------------------
  |  Branch (21:25): [True: 1, False: 0]
  ------------------
   22|      1|  if (zeroed_bits >= max_prec_bits) {
  ------------------
  |  Branch (22:7): [True: 0, False: 1]
  ------------------
   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|      1|  uint8_t mask = ~((1 << zeroed_bits) - 1);
   28|     65|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (28:19): [True: 64, False: 1]
  ------------------
   29|     64|    dest[i] = src[i] & mask;
   30|     64|  }
   31|      1|  return BLOSC2_ERROR_SUCCESS;
   32|      1|}
truncate_uint32:
   53|      8|                    const uint32_t *src, uint32_t *dest) {
   54|      8|  uint8_t max_prec_bits = (uint8_t) sizeof(uint32_t) * 8;
   55|      8|  uint8_t zeroed_bits = (prec_bits >= 0) ? max_prec_bits - prec_bits : -prec_bits;
  ------------------
  |  Branch (55:25): [True: 8, False: 0]
  ------------------
   56|      8|  if (zeroed_bits >= max_prec_bits) {
  ------------------
  |  Branch (56:7): [True: 0, False: 8]
  ------------------
   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|      8|  uint32_t mask = ~((1 << zeroed_bits) - 1);
   62|    520|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (62:19): [True: 512, False: 8]
  ------------------
   63|    512|    dest[i] = src[i] & mask;
   64|    512|  }
   65|      8|  return BLOSC2_ERROR_SUCCESS;
   66|      8|}
truncate_uint64:
   70|     80|                    const uint64_t *src, uint64_t *dest) {
   71|     80|  uint8_t max_prec_bits = (uint8_t) sizeof(uint64_t) * 8;
   72|     80|  uint8_t zeroed_bits = (prec_bits >= 0) ? max_prec_bits - prec_bits : -prec_bits;
  ------------------
  |  Branch (72:25): [True: 80, False: 0]
  ------------------
   73|     80|  if (zeroed_bits >= max_prec_bits) {
  ------------------
  |  Branch (73:7): [True: 0, False: 80]
  ------------------
   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|     80|  uint64_t mask = ~((1ULL << zeroed_bits) - 1ULL);
   79|  1.61k|  for (int i = 0; i < nelems; i++) {
  ------------------
  |  Branch (79:19): [True: 1.53k, False: 80]
  ------------------
   80|  1.53k|    dest[i] = src[i] & mask;
   81|  1.53k|  }
   82|     80|  return BLOSC2_ERROR_SUCCESS;
   83|     80|}
int_trunc_forward:
   87|     89|                      blosc2_cparams* cparams, uint8_t id) {
   88|     89|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|     89|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   89|     89|  int32_t typesize = cparams->typesize;
   90|     89|  int32_t nelems = length / typesize;
   91|     89|  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|     89|  switch (typesize) {
   96|      1|    case 1:
  ------------------
  |  Branch (96:5): [True: 1, False: 88]
  ------------------
   97|      1|      return truncate_uint8(prec_bits, nelems,
   98|      1|                            (uint8_t *)input, (uint8_t *)output);
   99|      0|    case 2:
  ------------------
  |  Branch (99:5): [True: 0, False: 89]
  ------------------
  100|      0|      return truncate_uint16(prec_bits, nelems,
  101|      0|                             (uint16_t *)input, (uint16_t *)output);
  102|      8|    case 4:
  ------------------
  |  Branch (102:5): [True: 8, False: 81]
  ------------------
  103|      8|      return truncate_uint32(prec_bits, nelems,
  104|      8|                             (uint32_t *)input, (uint32_t *)output);
  105|     80|    case 8:
  ------------------
  |  Branch (105:5): [True: 80, False: 9]
  ------------------
  106|     80|      return truncate_uint64(prec_bits, nelems,
  107|     80|                             (uint64_t *)input, (uint64_t *)output);
  108|      0|    default:
  ------------------
  |  Branch (108:5): [True: 0, False: 89]
  ------------------
  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|     89|  }
  114|     89|}
int_trunc_backward:
  117|     48|                       blosc2_dparams *dparams, uint8_t id) {
  118|     48|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|     48|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  119|     48|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|     48|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  120|     48|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|     48|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  121|       |
  122|       |  // Do a copy of the input buffer (truncation is lossy and cannot be reversed)
  123|     48|  memcpy(output, input, length);
  124|     48|  return BLOSC2_ERROR_SUCCESS;
  125|     48|}

ndcell_forward:
   22|    293|                   uint8_t id) {
   23|    293|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    293|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   24|    293|  uint8_t *smeta;
   25|    293|  int32_t smeta_len;
   26|    293|  if (blosc2_meta_get(cparams->schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (26:7): [True: 0, False: 293]
  ------------------
   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|    293|  int8_t ndim;
   31|    293|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|    293|#define B2ND_MAX_DIM 16
  ------------------
   32|    293|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    293|#define B2ND_MAX_DIM 16
  ------------------
   33|    293|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    293|#define B2ND_MAX_DIM 16
  ------------------
   34|    293|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (34:7): [True: 0, False: 293]
  ------------------
   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|    293|  free(smeta);
   42|    293|  if (ndim <= 0 || ndim > NDCELL_MAX_DIM) {
  ------------------
  |  |   16|    293|#define NDCELL_MAX_DIM 8
  ------------------
  |  Branch (42:7): [True: 0, False: 293]
  |  Branch (42:20): [True: 0, False: 293]
  ------------------
   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|    293|  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|    293|  int cell_shape = (int) meta;
   56|    293|  if (cell_shape <= 0) {
  ------------------
  |  Branch (56:7): [True: 0, False: 293]
  ------------------
   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|    293|  int64_t cell_size = 1;
   68|  1.46k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (68:19): [True: 1.17k, False: 293]
  ------------------
   69|  1.17k|    if (cell_size > INT64_MAX / cell_shape) {
  ------------------
  |  Branch (69:9): [True: 0, False: 1.17k]
  ------------------
   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.17k|    cell_size *= cell_shape;
   77|  1.17k|  }
   78|       |
   79|    293|  if (typesize <= 0) {
  ------------------
  |  Branch (79:7): [True: 0, False: 293]
  ------------------
   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|    293|  int64_t blocksize = (int64_t) typesize;
   90|  1.46k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (90:19): [True: 1.17k, False: 293]
  ------------------
   91|  1.17k|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (91:9): [True: 0, False: 1.17k]
  ------------------
   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.17k|    blocksize *= blockshape[i];
   99|  1.17k|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (99:9): [True: 0, False: 1.17k]
  ------------------
  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.17k|  }
  107|       |
  108|    293|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (108:7): [True: 0, False: 293]
  ------------------
  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|    293|  uint8_t *ip = (uint8_t *) input;
  117|    293|  uint8_t *op = (uint8_t *) output;
  118|    293|  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|    293|  if (cell_size > (int64_t) length / typesize) {
  ------------------
  |  Branch (123:7): [True: 0, False: 293]
  ------------------
  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|    293|  uint8_t *obase = op;
  132|       |
  133|    293|  int64_t i_shape[NDCELL_MAX_DIM];
  134|  1.46k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (134:19): [True: 1.17k, False: 293]
  ------------------
  135|  1.17k|    i_shape[i] = (blockshape[i] + cell_shape - 1) / cell_shape;
  136|  1.17k|  }
  137|       |
  138|    293|  int64_t ncells = 1;
  139|  1.46k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (139:19): [True: 1.17k, False: 293]
  ------------------
  140|  1.17k|    ncells *= i_shape[i];
  141|  1.17k|  }
  142|       |
  143|       |  /* main loop */
  144|    293|  int64_t pad_shape[NDCELL_MAX_DIM];
  145|    293|  int64_t ii[NDCELL_MAX_DIM];
  146|  2.50k|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (146:26): [True: 2.21k, False: 293]
  ------------------
  147|  2.21k|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  148|  2.21k|    uint32_t orig = 0;
  149|  2.21k|    int64_t nd_aux = (int64_t) cell_shape;
  150|  11.0k|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (150:28): [True: 8.85k, False: 2.21k]
  ------------------
  151|  8.85k|      orig += ii[i] * nd_aux;
  152|  8.85k|      nd_aux *= blockshape[i];
  153|  8.85k|    }
  154|       |
  155|  11.0k|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (155:27): [True: 8.85k, False: 2.21k]
  ------------------
  156|  8.85k|      if ((blockshape[dim_ind] % cell_shape != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (156:11): [True: 0, False: 8.85k]
  |  Branch (156:54): [True: 0, False: 0]
  ------------------
  157|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cell_shape;
  158|  8.85k|      } else {
  159|  8.85k|        pad_shape[dim_ind] = (int64_t) cell_shape;
  160|  8.85k|      }
  161|  8.85k|    }
  162|  2.21k|    int64_t ncopies = 1;
  163|  8.85k|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (163:21): [True: 6.63k, False: 2.21k]
  ------------------
  164|  6.63k|      ncopies *= pad_shape[i];
  165|  6.63k|    }
  166|  2.21k|    int64_t kk[NDCELL_MAX_DIM];
  167|  5.58k|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (167:28): [True: 3.36k, False: 2.21k]
  ------------------
  168|  3.36k|      blosc2_unidim_to_multidim(ndim - 1, pad_shape, copy_ind, kk);
  169|  3.36k|      nd_aux = blockshape[ndim - 1];
  170|  3.36k|      int64_t ind = orig;
  171|  13.4k|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (171:30): [True: 10.1k, False: 3.36k]
  ------------------
  172|  10.1k|        ind += kk[i] * nd_aux;
  173|  10.1k|        nd_aux *= blockshape[i];
  174|  10.1k|      }
  175|  3.36k|      memcpy(op, &ip[ind * typesize], pad_shape[ndim - 1] * typesize);
  176|  3.36k|      op += pad_shape[ndim - 1] * typesize;
  177|  3.36k|    }
  178|       |
  179|  2.21k|    if (op > op_limit) {
  ------------------
  |  Branch (179:9): [True: 0, False: 2.21k]
  ------------------
  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|  2.21k|  }
  187|       |
  188|    293|  if ((op - obase) != length) {
  ------------------
  |  Branch (188:7): [True: 0, False: 293]
  ------------------
  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|    293|  free(shape);
  197|    293|  free(chunkshape);
  198|    293|  free(blockshape);
  199|       |
  200|    293|  return BLOSC2_ERROR_SUCCESS;
  201|    293|}
ndcell_backward:
  205|    208|                   uint8_t id) {
  206|    208|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    208|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  207|    208|  blosc2_schunk *schunk = dparams->schunk;
  208|    208|  int8_t ndim;
  209|    208|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|    208|#define B2ND_MAX_DIM 16
  ------------------
  210|    208|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    208|#define B2ND_MAX_DIM 16
  ------------------
  211|    208|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    208|#define B2ND_MAX_DIM 16
  ------------------
  212|    208|  uint8_t *smeta;
  213|    208|  int32_t smeta_len;
  214|    208|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (214:7): [True: 0, False: 208]
  ------------------
  215|      0|    free(shape);
  216|      0|    free(chunkshape);
  217|      0|    free(blockshape);
  218|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|      0|    return BLOSC2_ERROR_FAILURE;
  220|      0|  }
  221|    208|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (221:7): [True: 0, False: 208]
  ------------------
  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|    208|  free(smeta);
  229|    208|  if (ndim <= 0 || ndim > NDCELL_MAX_DIM) {
  ------------------
  |  |   16|    208|#define NDCELL_MAX_DIM 8
  ------------------
  |  Branch (229:7): [True: 0, False: 208]
  |  Branch (229:20): [True: 0, False: 208]
  ------------------
  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|    208|  int cell_shape = (int) meta;
  241|    208|  if (cell_shape <= 0) {
  ------------------
  |  Branch (241:7): [True: 0, False: 208]
  ------------------
  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|    208|  int64_t cell_size = 1;
  252|  1.04k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (252:19): [True: 832, False: 208]
  ------------------
  253|    832|    if (cell_size > INT64_MAX / cell_shape) {
  ------------------
  |  Branch (253:9): [True: 0, False: 832]
  ------------------
  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|    832|    cell_size *= cell_shape;
  261|    832|  }
  262|    208|  int32_t typesize = schunk->typesize;
  263|    208|  uint8_t *ip = (uint8_t *) input;
  264|    208|  uint8_t *ip_limit = ip + length;
  265|    208|  uint8_t *op = (uint8_t *) output;
  266|    208|  if (typesize <= 0) {
  ------------------
  |  Branch (266:7): [True: 0, False: 208]
  ------------------
  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|    208|  int64_t blocksize = (int64_t) typesize;
  283|  1.04k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (283:19): [True: 832, False: 208]
  ------------------
  284|    832|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (284:9): [True: 0, False: 832]
  ------------------
  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|    832|    blocksize *= blockshape[i];
  292|    832|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (292:9): [True: 0, False: 832]
  ------------------
  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|    832|  }
  300|       |
  301|    208|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (301:7): [True: 0, False: 208]
  ------------------
  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|    208|  if (cell_size > (int64_t) length / typesize) {
  ------------------
  |  Branch (312:7): [True: 0, False: 208]
  ------------------
  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|    208|  int64_t i_shape[NDCELL_MAX_DIM];
  321|  1.04k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (321:19): [True: 832, False: 208]
  ------------------
  322|    832|    i_shape[i] = (blockshape[i] + cell_shape - 1) / cell_shape;
  323|    832|  }
  324|       |
  325|    208|  int64_t ncells = 1;
  326|  1.04k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (326:19): [True: 832, False: 208]
  ------------------
  327|    832|    ncells *= i_shape[i];
  328|    832|  }
  329|       |
  330|       |  /* main loop */
  331|    208|  int64_t pad_shape[NDCELL_MAX_DIM] = {0};
  332|    208|  int64_t ii[NDCELL_MAX_DIM];
  333|    208|  int32_t ind = 0;
  334|  2.57k|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (334:26): [True: 2.36k, False: 208]
  ------------------
  335|       |
  336|  2.36k|    if (ip > ip_limit) {
  ------------------
  |  Branch (336:9): [True: 0, False: 2.36k]
  ------------------
  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|  2.36k|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  344|  2.36k|    uint32_t orig = 0;
  345|  2.36k|    int64_t nd_aux = (int64_t) cell_shape;
  346|  11.8k|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (346:28): [True: 9.47k, False: 2.36k]
  ------------------
  347|  9.47k|      orig += ii[i] * nd_aux;
  348|  9.47k|      nd_aux *= blockshape[i];
  349|  9.47k|    }
  350|       |
  351|  11.8k|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (351:27): [True: 9.47k, False: 2.36k]
  ------------------
  352|  9.47k|      if ((blockshape[dim_ind] % cell_shape != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (352:11): [True: 0, False: 9.47k]
  |  Branch (352:54): [True: 0, False: 0]
  ------------------
  353|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cell_shape;
  354|  9.47k|      } else {
  355|  9.47k|        pad_shape[dim_ind] = (int64_t) cell_shape;
  356|  9.47k|      }
  357|  9.47k|    }
  358|       |
  359|  2.36k|    int64_t ncopies = 1;
  360|  9.47k|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (360:21): [True: 7.10k, False: 2.36k]
  ------------------
  361|  7.10k|      ncopies *= pad_shape[i];
  362|  7.10k|    }
  363|  2.36k|    int64_t kk[NDCELL_MAX_DIM];
  364|  5.18k|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (364:28): [True: 2.81k, False: 2.36k]
  ------------------
  365|  2.81k|      blosc2_unidim_to_multidim(ndim - 1, pad_shape, copy_ind, kk);
  366|  2.81k|      nd_aux = blockshape[ndim - 1];
  367|  2.81k|      ind = (int32_t) orig;
  368|  11.2k|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (368:30): [True: 8.44k, False: 2.81k]
  ------------------
  369|  8.44k|        ind += (int32_t) (kk[i] * nd_aux);
  370|  8.44k|        nd_aux *= blockshape[i];
  371|  8.44k|      }
  372|  2.81k|      memcpy(&op[ind * typesize], ip, pad_shape[ndim - 1] * typesize);
  373|  2.81k|      ip += pad_shape[ndim - 1] * typesize;
  374|  2.81k|    }
  375|  2.36k|  }
  376|    208|  ind += (int32_t) pad_shape[ndim - 1];
  377|       |
  378|       |
  379|    208|  if (ind != (int32_t) (blocksize / typesize)) {
  ------------------
  |  Branch (379:7): [True: 0, False: 208]
  ------------------
  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|    208|  free(shape);
  389|    208|  free(chunkshape);
  390|    208|  free(blockshape);
  391|       |
  392|    208|  return BLOSC2_ERROR_SUCCESS;
  393|    208|}

ndmean_forward:
   17|    512|                   uint8_t id) {
   18|    512|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    512|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   19|    512|  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|    512|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|    512|#define B2ND_MAX_DIM 16
  ------------------
   25|    512|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    512|#define B2ND_MAX_DIM 16
  ------------------
   26|    512|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    512|#define B2ND_MAX_DIM 16
  ------------------
   27|    512|  uint8_t *smeta;
   28|    512|  int32_t smeta_len;
   29|    512|  if (blosc2_meta_get(cparams->schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (29:7): [True: 0, False: 512]
  ------------------
   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|    512|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (36:7): [True: 0, False: 512]
  ------------------
   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|    512|  free(smeta);
   45|       |  // Guard the fixed-size (NDMEAN_MAX_DIM) stack arrays used below.
   46|    512|  if (ndim <= 0 || ndim > NDMEAN_MAX_DIM) {
  ------------------
  |  |   16|    512|#define NDMEAN_MAX_DIM 8
  ------------------
  |  Branch (46:7): [True: 0, False: 512]
  |  Branch (46:20): [True: 0, False: 512]
  ------------------
   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|    512|  int typesize = cparams->typesize;
   54|       |
   55|    512|  if ((typesize != 4) && (typesize != 8)) {
  ------------------
  |  Branch (55:7): [True: 512, False: 0]
  |  Branch (55:26): [True: 0, False: 512]
  ------------------
   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|    512|  if ((int8_t) meta <= 0) {
  ------------------
  |  Branch (68:7): [True: 0, False: 512]
  ------------------
   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|    512|  int8_t cellshape[8];
   77|    512|  int64_t cell_size = 1;  // 64-bit: prod(cellshape) can reach 127^ndim, which overflows int
   78|  4.60k|  for (int i = 0; i < 8; ++i) {
  ------------------
  |  Branch (78:19): [True: 4.09k, False: 512]
  ------------------
   79|  4.09k|    if (i < ndim) {
  ------------------
  |  Branch (79:9): [True: 2.04k, False: 2.04k]
  ------------------
   80|  2.04k|      cellshape[i] = (int8_t) meta;
   81|  2.04k|      if (cellshape[i] > blockshape[i]) {
  ------------------
  |  Branch (81:11): [True: 0, False: 2.04k]
  ------------------
   82|      0|        cellshape[i] = (int8_t) blockshape[i];
   83|      0|      }
   84|  2.04k|      cell_size *= cellshape[i];
   85|  2.04k|    } else {
   86|  2.04k|      cellshape[i] = 1;
   87|  2.04k|    }
   88|  4.09k|  }
   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|    512|  int64_t blocksize = (int64_t) typesize;
   93|  2.56k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (93:19): [True: 2.04k, False: 512]
  ------------------
   94|  2.04k|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (94:9): [True: 0, False: 2.04k]
  ------------------
   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|  2.04k|    blocksize *= blockshape[i];
  102|  2.04k|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (102:9): [True: 0, False: 2.04k]
  ------------------
  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|  2.04k|  }
  110|       |
  111|    512|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (111:7): [True: 0, False: 512]
  ------------------
  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|    512|  uint8_t *ip = (uint8_t *) input;
  120|    512|  float *ip_float = (float *) ip;
  121|    512|  double *ip_double = (double *) ip;
  122|    512|  uint8_t *op = (uint8_t *) output;
  123|    512|  uint8_t *op_limit = op + length;
  124|    512|  int64_t cell_length;
  125|    512|  float mean_float = 0;
  126|    512|  double mean_double = 0;
  127|       |
  128|       |
  129|    512|  if (length < cell_size * typesize) {
  ------------------
  |  Branch (129:7): [True: 0, False: 512]
  ------------------
  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|    512|  uint8_t *obase = op;
  138|       |
  139|    512|  int64_t i_shape[NDMEAN_MAX_DIM];
  140|  2.56k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (140:19): [True: 2.04k, False: 512]
  ------------------
  141|  2.04k|    i_shape[i] = (blockshape[i] + cellshape[i] - 1) / cellshape[i];
  142|  2.04k|  }
  143|       |
  144|    512|  int64_t ncells = 1;
  145|  2.56k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (145:19): [True: 2.04k, False: 512]
  ------------------
  146|  2.04k|    ncells *= i_shape[i];
  147|  2.04k|  }
  148|       |
  149|       |  /* main loop */
  150|    512|  int64_t pad_shape[NDMEAN_MAX_DIM];
  151|    512|  int64_t ii[NDMEAN_MAX_DIM];
  152|  4.86k|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (152:26): [True: 4.35k, False: 512]
  ------------------
  153|  4.35k|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  154|  4.35k|    uint32_t orig = 0;
  155|  4.35k|    int64_t nd_aux = (int64_t) (cellshape[0]);
  156|  21.7k|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (156:28): [True: 17.4k, False: 4.35k]
  ------------------
  157|  17.4k|      orig += ii[i] * nd_aux;
  158|  17.4k|      nd_aux *= blockshape[i];
  159|  17.4k|    }
  160|       |
  161|  21.7k|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (161:27): [True: 17.4k, False: 4.35k]
  ------------------
  162|  17.4k|      if ((blockshape[dim_ind] % cellshape[dim_ind] != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (162:11): [True: 0, False: 17.4k]
  |  Branch (162:62): [True: 0, False: 0]
  ------------------
  163|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cellshape[dim_ind];
  164|  17.4k|      } else {
  165|  17.4k|        pad_shape[dim_ind] = (int32_t) cellshape[dim_ind];
  166|  17.4k|      }
  167|  17.4k|    }
  168|  4.35k|    int64_t ncopies = 1;
  169|  17.4k|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (169:21): [True: 13.0k, False: 4.35k]
  ------------------
  170|  13.0k|      ncopies *= pad_shape[i];
  171|  13.0k|    }
  172|  4.35k|    int64_t kk[8];
  173|  4.35k|    mean_float = 0;
  174|  4.35k|    mean_double = 0;
  175|  10.4k|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (175:28): [True: 6.14k, False: 4.35k]
  ------------------
  176|  6.14k|      blosc2_unidim_to_multidim((int8_t) (ndim - 1), pad_shape, copy_ind, kk);
  177|  6.14k|      nd_aux = blockshape[ndim - 1];
  178|  6.14k|      int64_t ind = orig;
  179|  24.5k|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (179:30): [True: 18.4k, False: 6.14k]
  ------------------
  180|  18.4k|        ind += kk[i] * nd_aux;
  181|  18.4k|        nd_aux *= blockshape[i];
  182|  18.4k|      }
  183|       |
  184|  6.14k|      switch (typesize) {
  185|      0|        case 4:
  ------------------
  |  Branch (185:9): [True: 0, False: 6.14k]
  ------------------
  186|      0|          for (int i = 0; i < pad_shape[ndim - 1]; i++) {
  ------------------
  |  Branch (186:27): [True: 0, False: 0]
  ------------------
  187|      0|            mean_float += ip_float[ind + i];
  188|      0|          }
  189|      0|          break;
  190|  6.14k|        case 8:
  ------------------
  |  Branch (190:9): [True: 6.14k, False: 0]
  ------------------
  191|  14.3k|          for (int i = 0; i < pad_shape[ndim - 1]; i++) {
  ------------------
  |  Branch (191:27): [True: 8.19k, False: 6.14k]
  ------------------
  192|  8.19k|            mean_double += ip_double[ind + i];
  193|  8.19k|          }
  194|  6.14k|          break;
  195|      0|        default :
  ------------------
  |  Branch (195:9): [True: 0, False: 6.14k]
  ------------------
  196|      0|          break;
  197|  6.14k|      }
  198|       |
  199|  6.14k|    }
  200|  4.35k|    cell_length = ncopies * pad_shape[ndim - 1];
  201|       |
  202|  4.35k|    switch (typesize) {
  203|      0|      case 4:
  ------------------
  |  Branch (203:7): [True: 0, False: 4.35k]
  ------------------
  204|      0|        mean_float /= (float) cell_length;
  205|      0|        for (int i = 0; i < cell_length; i++) {
  ------------------
  |  Branch (205:25): [True: 0, False: 0]
  ------------------
  206|      0|          memcpy(op, &mean_float, typesize);
  207|      0|          op += typesize;
  208|      0|        }
  209|      0|        break;
  210|  4.35k|      case 8:
  ------------------
  |  Branch (210:7): [True: 4.35k, False: 0]
  ------------------
  211|  4.35k|        mean_double /= (double) cell_length;
  212|  12.5k|        for (int i = 0; i < cell_length; i++) {
  ------------------
  |  Branch (212:25): [True: 8.19k, False: 4.35k]
  ------------------
  213|  8.19k|          memcpy(op, &mean_double, typesize);
  214|  8.19k|          op += typesize;
  215|  8.19k|        }
  216|  4.35k|        break;
  217|      0|      default :
  ------------------
  |  Branch (217:7): [True: 0, False: 4.35k]
  ------------------
  218|      0|        break;
  219|  4.35k|    }
  220|       |
  221|  4.35k|    if (op > op_limit) {
  ------------------
  |  Branch (221:9): [True: 0, False: 4.35k]
  ------------------
  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|  4.35k|  }
  229|       |
  230|    512|  free(shape);
  231|    512|  free(chunkshape);
  232|    512|  free(blockshape);
  233|    512|  if ((op - obase) != length) {
  ------------------
  |  Branch (233:7): [True: 0, False: 512]
  ------------------
  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|    512|  return BLOSC2_ERROR_SUCCESS;
  239|    512|}
ndmean_backward:
  243|    896|                   uint8_t id) {
  244|    896|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|    896|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  245|    896|  blosc2_schunk *schunk = dparams->schunk;
  246|    896|  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|    896|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|    896|#define B2ND_MAX_DIM 16
  ------------------
  252|    896|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    896|#define B2ND_MAX_DIM 16
  ------------------
  253|    896|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|    896|#define B2ND_MAX_DIM 16
  ------------------
  254|    896|  uint8_t *smeta;
  255|    896|  int32_t smeta_len;
  256|    896|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (256:7): [True: 0, False: 896]
  ------------------
  257|      0|    free(shape);
  258|      0|    free(chunkshape);
  259|      0|    free(blockshape);
  260|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  261|      0|    return BLOSC2_ERROR_FAILURE;
  262|      0|  }
  263|    896|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (263:7): [True: 0, False: 896]
  ------------------
  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|    896|  free(smeta);
  272|       |  // Guard the fixed-size (NDMEAN_MAX_DIM) stack arrays used below.
  273|    896|  if (ndim <= 0 || ndim > NDMEAN_MAX_DIM) {
  ------------------
  |  |   16|    896|#define NDMEAN_MAX_DIM 8
  ------------------
  |  Branch (273:7): [True: 0, False: 896]
  |  Branch (273:20): [True: 0, False: 896]
  ------------------
  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|    896|  if ((int8_t) meta <= 0) {
  ------------------
  |  Branch (287:7): [True: 0, False: 896]
  ------------------
  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|    896|  int8_t cellshape[8];
  296|    896|  int64_t cell_size = 1;  // 64-bit: prod(cellshape) can reach 127^ndim, which overflows int
  297|  8.06k|  for (int i = 0; i < 8; ++i) {
  ------------------
  |  Branch (297:19): [True: 7.16k, False: 896]
  ------------------
  298|  7.16k|    if (i < ndim) {
  ------------------
  |  Branch (298:9): [True: 3.58k, False: 3.58k]
  ------------------
  299|  3.58k|      cellshape[i] = (int8_t) meta;
  300|  3.58k|      if (cellshape[i] > blockshape[i]) {
  ------------------
  |  Branch (300:11): [True: 0, False: 3.58k]
  ------------------
  301|      0|        cellshape[i] = (int8_t) blockshape[i];
  302|      0|      }
  303|  3.58k|      cell_size *= cellshape[i];
  304|  3.58k|    } else {
  305|  3.58k|      cellshape[i] = 1;
  306|  3.58k|    }
  307|  7.16k|  }
  308|       |
  309|    896|  int8_t typesize = (int8_t) schunk->typesize;
  310|    896|  uint8_t *ip = (uint8_t *) input;
  311|    896|  uint8_t *ip_limit = ip + length;
  312|    896|  uint8_t *op = (uint8_t *) output;
  313|    896|  if (typesize <= 0) {
  ------------------
  |  Branch (313:7): [True: 0, False: 896]
  ------------------
  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|    896|  int64_t blocksize = (int64_t) typesize;
  329|  4.48k|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (329:19): [True: 3.58k, False: 896]
  ------------------
  330|  3.58k|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (330:9): [True: 0, False: 3.58k]
  ------------------
  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|  3.58k|    blocksize *= blockshape[i];
  338|  3.58k|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (338:9): [True: 0, False: 3.58k]
  ------------------
  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|  3.58k|  }
  346|       |
  347|    896|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (347:7): [True: 0, False: 896]
  ------------------
  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|    896|  if (length < cell_size * typesize) {
  ------------------
  |  Branch (355:7): [True: 0, False: 896]
  ------------------
  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|    896|  int64_t i_shape[NDMEAN_MAX_DIM];
  364|  4.48k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (364:19): [True: 3.58k, False: 896]
  ------------------
  365|  3.58k|    i_shape[i] = (blockshape[i] + cellshape[i] - 1) / cellshape[i];
  366|  3.58k|  }
  367|       |
  368|    896|  int64_t ncells = 1;
  369|  4.48k|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (369:19): [True: 3.58k, False: 896]
  ------------------
  370|  3.58k|    ncells *= i_shape[i];
  371|  3.58k|  }
  372|       |
  373|       |  /* main loop */
  374|    896|  int64_t pad_shape[NDMEAN_MAX_DIM] = {0};
  375|    896|  int64_t ii[NDMEAN_MAX_DIM];
  376|    896|  int32_t ind = 0;
  377|  7.55k|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (377:26): [True: 6.65k, False: 896]
  ------------------
  378|       |
  379|  6.65k|    if (ip > ip_limit) {
  ------------------
  |  Branch (379:9): [True: 0, False: 6.65k]
  ------------------
  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|  6.65k|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  387|  6.65k|    uint32_t orig = 0;
  388|  6.65k|    int64_t nd_aux = (int64_t) (cellshape[0]);
  389|  33.2k|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (389:28): [True: 26.6k, False: 6.65k]
  ------------------
  390|  26.6k|      orig += ii[i] * nd_aux;
  391|  26.6k|      nd_aux *= blockshape[i];
  392|  26.6k|    }
  393|       |
  394|  33.2k|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (394:27): [True: 26.6k, False: 6.65k]
  ------------------
  395|  26.6k|      if ((blockshape[dim_ind] % cellshape[dim_ind] != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (395:11): [True: 0, False: 26.6k]
  |  Branch (395:62): [True: 0, False: 0]
  ------------------
  396|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cellshape[dim_ind];
  397|  26.6k|      } else {
  398|  26.6k|        pad_shape[dim_ind] = (int64_t) cellshape[dim_ind];
  399|  26.6k|      }
  400|  26.6k|    }
  401|       |
  402|  6.65k|    int64_t ncopies = 1;
  403|  26.6k|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (403:21): [True: 19.9k, False: 6.65k]
  ------------------
  404|  19.9k|      ncopies *= pad_shape[i];
  405|  19.9k|    }
  406|  6.65k|    int64_t kk[NDMEAN_MAX_DIM];
  407|  16.8k|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (407:28): [True: 10.2k, False: 6.65k]
  ------------------
  408|  10.2k|      blosc2_unidim_to_multidim((int8_t) (ndim - 1), pad_shape, copy_ind, kk);
  409|  10.2k|      nd_aux = blockshape[ndim - 1];
  410|  10.2k|      ind = (int32_t) orig;
  411|  40.9k|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (411:30): [True: 30.7k, False: 10.2k]
  ------------------
  412|  30.7k|        ind += (int32_t) (kk[i] * nd_aux);
  413|  30.7k|        nd_aux *= blockshape[i];
  414|  30.7k|      }
  415|  10.2k|      memcpy(&op[ind * typesize], ip, pad_shape[ndim - 1] * typesize);
  416|  10.2k|      ip += pad_shape[ndim - 1] * typesize;
  417|  10.2k|    }
  418|  6.65k|  }
  419|    896|  ind += (int32_t) pad_shape[ndim - 1];
  420|       |
  421|    896|  free(shape);
  422|    896|  free(chunkshape);
  423|    896|  free(blockshape);
  424|       |
  425|    896|  if (ind != (int32_t) (blocksize / typesize)) {
  ------------------
  |  Branch (425:7): [True: 0, False: 896]
  ------------------
  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|    896|  return BLOSC2_ERROR_SUCCESS;
  432|    896|}

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

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

