LZ4_decompress_safe:
 2570|    290|{
 2571|    290|    return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
 2572|    290|                                  decode_full_block, noDict,
 2573|       |                                  (BYTE*)dest, NULL, 0);
 2574|    290|}
LZ4_decompress_safe_forceExtDict:
 2644|    374|{
 2645|    374|    DEBUGLOG(5, "LZ4_decompress_safe_forceExtDict");
  ------------------
  |  |  289|    374|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2646|    374|    return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
 2647|    374|                                  decode_full_block, usingExtDict,
 2648|    374|                                  (BYTE*)dest, (const BYTE*)dictStart, dictSize);
 2649|    374|}
LZ4_decompress_safe_usingDict:
 2843|    374|{
 2844|    374|    if (dictSize < 0) return -1;
  ------------------
  |  Branch (2844:9): [True: 0, False: 374]
  ------------------
 2845|    374|    if (dictSize==0)
  ------------------
  |  Branch (2845:9): [True: 0, False: 374]
  ------------------
 2846|      0|        return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
 2847|    374|    if (dictStart+dictSize == dest) {
  ------------------
  |  Branch (2847:9): [True: 0, False: 374]
  ------------------
 2848|      0|        if (dictSize >= 64 KB - 1) {
  ------------------
  |  |  251|      0|#define KB *(1 <<10)
  ------------------
  |  Branch (2848:13): [True: 0, False: 0]
  ------------------
 2849|      0|            return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize);
 2850|      0|        }
 2851|      0|        assert(dictSize >= 0);
  ------------------
  |  |  273|      0|#    define assert(condition) ((void)0)
  ------------------
 2852|      0|        return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, (size_t)dictSize);
 2853|      0|    }
 2854|    374|    assert(dictSize >= 0);
  ------------------
  |  |  273|    374|#    define assert(condition) ((void)0)
  ------------------
 2855|    374|    return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize);
 2856|    374|}
lz4.c:LZ4_isLittleEndian:
  364|  69.9k|{
  365|  69.9k|    const union { U32 u; BYTE c[4]; } one = { 1 };   /* don't use static : performance detrimental */
  366|  69.9k|    return one.c[0];
  367|  69.9k|}
lz4.c:LZ4_wildCopy8:
  466|  4.53k|{
  467|  4.53k|    BYTE* d = (BYTE*)dstPtr;
  468|  4.53k|    const BYTE* s = (const BYTE*)srcPtr;
  469|  4.53k|    BYTE* const e = (BYTE*)dstEnd;
  470|       |
  471|   436k|    do { LZ4_memcpy(d,s,8); d+=8; s+=8; } while (d<e);
  ------------------
  |  |  349|   436k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (471:50): [True: 431k, False: 4.53k]
  ------------------
  472|  4.53k|}
lz4.c:LZ4_read16:
  393|  69.9k|static U16 LZ4_read16(const void* ptr) { return ((const LZ4_unalign16*)ptr)->u16; }
lz4.c:LZ4_write32:
  398|  10.3k|static void LZ4_write32(void* memPtr, U32 value) { ((LZ4_unalign32*)memPtr)->u32 = value; }
lz4.c:LZ4_decompress_generic:
 2225|    664|{
 2226|    664|    if ((src == NULL) || (outputSize < 0)) { return -1; }
  ------------------
  |  Branch (2226:9): [True: 0, False: 664]
  |  Branch (2226:26): [True: 0, False: 664]
  ------------------
 2227|       |
 2228|    664|    {   const BYTE* ip = (const BYTE*) src;
 2229|    664|        const BYTE* const iend = ip + srcSize;
 2230|       |
 2231|    664|        BYTE* op = (BYTE*) dst;
 2232|    664|        BYTE* const oend = op + outputSize;
 2233|       |
 2234|    664|        const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize;
  ------------------
  |  Branch (2234:37): [True: 290, False: 374]
  ------------------
 2235|       |
 2236|       |        /* withPrefix64k : offset <= 65535 can't reach beyond the 64 KB prefix */
 2237|    664|        const int checkOffset = (dict != withPrefix64k) && (dictSize < (int)(64 KB));
  ------------------
  |  |  251|    664|#define KB *(1 <<10)
  ------------------
  |  Branch (2237:33): [True: 664, False: 0]
  |  Branch (2237:60): [True: 664, False: 0]
  ------------------
 2238|       |
 2239|       |
 2240|       |        /* Set up the "end" pointers for the shortcut. */
 2241|    664|        const BYTE* const shortiend = iend - 14 /*maxLL*/ - 2 /*offset*/;
 2242|    664|        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|    664|        const BYTE* match;
 2246|    664|        size_t offset;
 2247|    664|        size_t ml;   /* match length */
 2248|       |
 2249|       |
 2250|    664|        DEBUGLOG(5, "LZ4_decompress_generic (srcSize:%i, dstSize:%i)", srcSize, outputSize);
  ------------------
  |  |  289|    664|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2251|       |
 2252|       |        /* Special cases */
 2253|    664|        assert(lowPrefix <= op);
  ------------------
  |  |  273|    664|#    define assert(condition) ((void)0)
  ------------------
 2254|    664|        if (unlikely(outputSize==0)) {
  ------------------
  |  |  180|    664|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    664|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 664]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|    664|        if (unlikely(srcSize<=0)) { return -1; }
  ------------------
  |  |  180|    664|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    664|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 664]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|    664|#if LZ4_FAST_DEC_LOOP
 2267|    664|        if ((oend - op) < FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|    664|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2267:13): [True: 2, False: 662]
  ------------------
 2268|      2|            DEBUGLOG(6, "move to safe decode loop");
  ------------------
  |  |  289|      2|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2269|      2|            goto safe_decode;
 2270|      2|        }
 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|    662|        if ( (dict==usingExtDict)
  ------------------
  |  Branch (2276:14): [True: 372, False: 290]
  ------------------
 2277|    372|          && ((uptrval)dictEnd - (uptrval)lowPrefix - LZ4_DISTANCE_ABSOLUTE_MAX < FASTLOOP_SAFE_DISTANCE) ) {
  ------------------
  |  |  255|    372|#define LZ4_DISTANCE_ABSOLUTE_MAX 65535
  ------------------
                        && ((uptrval)dictEnd - (uptrval)lowPrefix - LZ4_DISTANCE_ABSOLUTE_MAX < FASTLOOP_SAFE_DISTANCE) ) {
  ------------------
  |  |  248|    372|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2277:14): [True: 0, False: 372]
  ------------------
 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|    662|        DEBUGLOG(6, "using fast decode loop");
  ------------------
  |  |  289|    662|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2287|  69.1k|        while (1) {
  ------------------
  |  Branch (2287:16): [True: 69.1k, Folded]
  ------------------
 2288|  69.1k|            unsigned token;
 2289|  69.1k|            size_t ll;   /* literal length */
 2290|  69.1k|            BYTE* cpy;
 2291|       |            /* Main fastloop assertion: We can always wildcopy FASTLOOP_SAFE_DISTANCE */
 2292|  69.1k|            assert(oend - op >= FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  273|  69.1k|#    define assert(condition) ((void)0)
  ------------------
 2293|  69.1k|            assert(ip < iend);
  ------------------
  |  |  273|  69.1k|#    define assert(condition) ((void)0)
  ------------------
 2294|  69.1k|            token = *ip++;
 2295|  69.1k|            ll = token >> ML_BITS;
  ------------------
  |  |  260|  69.1k|#define ML_BITS  4
  ------------------
 2296|  69.1k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  289|  69.1k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2297|       |
 2298|       |            /* too close to input end : the safe loop restarts this sequence */
 2299|  69.1k|            if (ip > iend-(16 + 1/*max lit + offset + nextToken*/)) { ip--; break; }
  ------------------
  |  Branch (2299:17): [True: 59, False: 69.1k]
  ------------------
 2300|       |
 2301|       |            /* decode literal length */
 2302|  69.1k|            if (ll == RUN_MASK) {
  ------------------
  |  |  263|  69.1k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  69.1k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  69.1k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2302:17): [True: 2.31k, False: 66.8k]
  ------------------
 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|  2.31k|                const BYTE* const tokenPos = ip-1;
 2306|  2.31k|                size_t const addl = read_variable_length(&ip, iend - RUN_MASK);
  ------------------
  |  |  263|  2.31k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  2.31k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  2.31k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2307|  2.31k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2307:21): [True: 1, False: 2.31k]
  ------------------
 2308|      1|                    DEBUGLOG(6, "error reading long literal length");
  ------------------
  |  |  289|      1|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2309|      1|                    goto _output_error;
 2310|      1|                }
 2311|  2.31k|                ll += addl;
 2312|  2.31k|                if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  2.31k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.31k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 2.31k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2313|  2.31k|                if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  2.31k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  2.31k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 2.31k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 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|  2.31k|                cpy = op+ll;
 2318|  2.31k|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|  2.31k|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2319|  2.31k|              #if LZ4_WILDCOPY64
 2320|  2.31k|                if ((cpy>oend-64) || (ip+ll>iend-64)) { ip = tokenPos; break; }
  ------------------
  |  Branch (2320:21): [True: 12, False: 2.29k]
  |  Branch (2320:38): [True: 391, False: 1.90k]
  ------------------
 2321|  1.90k|                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|  1.90k|                ip += ll; op = cpy;
 2327|  66.8k|            } else {
 2328|  66.8k|                DEBUGLOG(7, "copy %u bytes in a 16-bytes stripe", (unsigned)ll);
  ------------------
  |  |  289|  66.8k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2329|       |                /* Literals can only be <= 14, but hope compilers optimize better when copy by a register size */
 2330|  66.8k|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|  66.8k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2331|  66.8k|                ip += ll; op += ll;
 2332|  66.8k|            }
 2333|       |
 2334|       |            /* get offset */
 2335|  68.7k|            offset = LZ4_readLE16(ip); ip+=2;
 2336|  68.7k|            DEBUGLOG(6, "blockPos%6u: offset = %u", (unsigned)(op-(BYTE*)dst), (unsigned)offset);
  ------------------
  |  |  289|  68.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2337|  68.7k|            match = op - offset;
 2338|  68.7k|            assert(match <= op);  /* overflow check */
  ------------------
  |  |  273|  68.7k|#    define assert(condition) ((void)0)
  ------------------
 2339|       |
 2340|       |            /* get matchlength */
 2341|  68.7k|            ml = token & ML_MASK;
  ------------------
  |  |  261|  68.7k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  68.7k|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2342|  68.7k|            DEBUGLOG(7, "  match length token = %u (len==%u)", (unsigned)ml, (unsigned)ml+MINMATCH);
  ------------------
  |  |  289|  68.7k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2343|       |
 2344|  68.7k|            if (ml == ML_MASK) {
  ------------------
  |  |  261|  68.7k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  68.7k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2344:17): [True: 39.0k, False: 29.6k]
  ------------------
 2345|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2346|  39.0k|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  245|  39.0k|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2347|  39.0k|                if (addl == rvl_error) {
  ------------------
  |  Branch (2347:21): [True: 5, False: 39.0k]
  ------------------
 2348|      5|                    DEBUGLOG(5, "error reading long match length");
  ------------------
  |  |  289|      5|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2349|      5|                    goto _output_error;
 2350|      5|                }
 2351|  39.0k|                ml += addl;
 2352|  39.0k|                DEBUGLOG(7, "  long match length == %u", (unsigned)ml + MINMATCH);
  ------------------
  |  |  289|  39.0k|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2353|  39.0k|                if (unlikely((uptrval)(op)+ml<(uptrval)op)) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|  39.0k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  39.0k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 39.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2354|  39.0k|            }
 2355|  68.7k|            ml += MINMATCH;
  ------------------
  |  |  242|  68.7k|#define MINMATCH 4
  ------------------
 2356|       |
 2357|  68.7k|            if (op + ml >= oend - FASTLOOP_SAFE_DISTANCE) {
  ------------------
  |  |  248|  68.7k|#define FASTLOOP_SAFE_DISTANCE 64
  ------------------
  |  Branch (2357:17): [True: 87, False: 68.6k]
  ------------------
 2358|     87|                DEBUGLOG(7, "moving to safe_match_copy (ml==%u)", (unsigned)ml);
  ------------------
  |  |  289|     87|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2359|     87|                goto safe_match_copy;
 2360|     87|            }
 2361|       |
 2362|       |            /* match length from token only (<= 18), no overlap, within prefix : copy 18 bytes */
 2363|  68.6k|            if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  261|  68.6k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  68.6k|#define ML_BITS  4
  |  |  ------------------
  ------------------
                          if ( ((token & ML_MASK) != ML_MASK) && (offset >= 8)
  ------------------
  |  |  261|  68.6k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  68.6k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2363:18): [True: 29.6k, False: 38.9k]
  |  Branch (2363:52): [True: 15.5k, False: 14.1k]
  ------------------
 2364|  15.5k|              && ((dict == withPrefix64k) || (match >= lowPrefix)) ) {
  ------------------
  |  Branch (2364:19): [True: 0, False: 15.5k]
  |  Branch (2364:46): [True: 15.0k, False: 466]
  ------------------
 2365|  15.0k|                assert(match >= lowPrefix);
  ------------------
  |  |  273|  15.0k|#    define assert(condition) ((void)0)
  ------------------
 2366|  15.0k|                assert(match <= op);
  ------------------
  |  |  273|  15.0k|#    define assert(condition) ((void)0)
  ------------------
 2367|  15.0k|                assert(op + 18 <= oend);
  ------------------
  |  |  273|  15.0k|#    define assert(condition) ((void)0)
  ------------------
 2368|  15.0k|                LZ4_memcpy(op, match, 8);
  ------------------
  |  |  349|  15.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2369|  15.0k|                LZ4_memcpy(op+8, match+8, 8);
  ------------------
  |  |  349|  15.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2370|  15.0k|                LZ4_memcpy(op+16, match+16, 2);
  ------------------
  |  |  349|  15.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2371|  15.0k|                op += ml;
 2372|  15.0k|                continue;
 2373|  15.0k|            }
 2374|       |
 2375|       |            /* match ends far from oend : no end-of-block condition to check */
 2376|  53.5k|            assert(op + ml < oend - FASTLOOP_SAFE_DISTANCE);
  ------------------
  |  |  273|  53.5k|#    define assert(condition) ((void)0)
  ------------------
 2377|       |
 2378|  53.5k|            if ( checkOffset && (unlikely(match + dictSize < lowPrefix)) ) {
  ------------------
  |  |  180|  53.5k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  53.5k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2378:18): [True: 53.5k, False: 0]
  |  Branch (2378:33): [True: 107, False: 53.4k]
  ------------------
 2379|    107|                DEBUGLOG(5, "Error : pos=%zi, offset=%zi => outside buffers", op-lowPrefix, op-match);
  ------------------
  |  |  289|    107|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2380|    107|                goto _offset_error;
 2381|    107|            }
 2382|       |            /* match starting within external dictionary */
 2383|  53.4k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2383:17): [True: 25.3k, False: 28.0k]
  |  Branch (2383:41): [True: 665, False: 24.7k]
  ------------------
 2384|    665|                assert(dictEnd != NULL);
  ------------------
  |  |  273|    665|#    define assert(condition) ((void)0)
  ------------------
 2385|    665|                op = LZ4_copyExtDictMatch(op, match, ml, lowPrefix, dictEnd);
 2386|    665|                continue;
 2387|    665|            }
 2388|       |
 2389|       |            /* copy match within block */
 2390|  52.7k|            cpy = op + ml;
 2391|       |
 2392|  52.7k|            assert((op <= oend) && (oend-op >= 64));
  ------------------
  |  |  273|  52.7k|#    define assert(condition) ((void)0)
  ------------------
 2393|  52.7k|            if (unlikely(offset<16)) {
  ------------------
  |  |  180|  52.7k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  52.7k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 39.1k, False: 13.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2394|  39.1k|                LZ4_memcpy_using_offset(op, match, cpy, offset);
 2395|  39.1k|    #if LZ4_WILDCOPY64
 2396|  39.1k|            } else if (offset >= 64) {
  ------------------
  |  Branch (2396:24): [True: 12.8k, False: 820]
  ------------------
 2397|  12.8k|                LZ4_wildCopy64(op, match, cpy);
 2398|  12.8k|    #endif
 2399|  12.8k|            } else {
 2400|    820|                LZ4_wildCopy32(op, match, cpy);
 2401|    820|            }
 2402|       |
 2403|  52.7k|            op = cpy;   /* wildcopy correction */
 2404|  52.7k|        }
 2405|    464|    safe_decode:
 2406|    464|#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|    464|        DEBUGLOG(6, "using safe decode loop");
  ------------------
  |  |  289|    464|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2413|  1.65k|        while (1) {
  ------------------
  |  Branch (2413:16): [True: 1.65k, Folded]
  ------------------
 2414|  1.65k|            unsigned token;
 2415|  1.65k|            size_t ll;   /* literal length */
 2416|  1.65k|            BYTE* cpy;
 2417|  1.65k|            assert(ip < iend);
  ------------------
  |  |  273|  1.65k|#    define assert(condition) ((void)0)
  ------------------
 2418|  1.65k|            token = *ip++;
 2419|  1.65k|            ll = token >> ML_BITS;
  ------------------
  |  |  260|  1.65k|#define ML_BITS  4
  ------------------
 2420|  1.65k|            DEBUGLOG(7, "blockPos%6u: litLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ll);
  ------------------
  |  |  289|  1.65k|#  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|  1.65k|            if ( (ll != RUN_MASK)
  ------------------
  |  |  263|  1.65k|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|  1.65k|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|  1.65k|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2430:18): [True: 1.12k, False: 527]
  ------------------
 2431|       |                /* strictly "less than" on input, to re-enter the loop with at least one byte */
 2432|  1.12k|              && likely((ip < shortiend) & (op <= shortoend)) ) {
  ------------------
  |  |  177|  1.12k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  1.12k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 681, False: 443]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2433|       |                /* Copy the literals */
 2434|    681|                LZ4_memcpy(op, ip, 16);
  ------------------
  |  |  349|    681|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2435|    681|                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|    681|                offset = LZ4_readLE16(ip); ip += 2;
 2440|    681|                match = op - offset;
 2441|    681|                assert(match <= op); /* check overflow */
  ------------------
  |  |  273|    681|#    define assert(condition) ((void)0)
  ------------------
 2442|    681|                ml = token & ML_MASK;
  ------------------
  |  |  261|    681|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    681|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2443|    681|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u (len=%u)", (unsigned)(op-(BYTE*)dst), (unsigned)ml, (unsigned)ml + 4);
  ------------------
  |  |  289|    681|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2444|       |
 2445|       |                /* Do not deal with overlapping matches. */
 2446|    681|                if ( (ml != ML_MASK)
  ------------------
  |  |  261|    681|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    681|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2446:22): [True: 462, False: 219]
  ------------------
 2447|    462|                  && (offset >= 8)
  ------------------
  |  Branch (2447:22): [True: 238, False: 224]
  ------------------
 2448|    238|                  && (dict==withPrefix64k || match >= lowPrefix) ) {
  ------------------
  |  Branch (2448:23): [True: 0, False: 238]
  |  Branch (2448:46): [True: 172, False: 66]
  ------------------
 2449|       |                    /* Copy the match. */
 2450|    172|                    LZ4_memcpy(op + 0, match + 0, 8);
  ------------------
  |  |  349|    172|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2451|    172|                    LZ4_memcpy(op + 8, match + 8, 8);
  ------------------
  |  |  349|    172|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2452|    172|                    LZ4_memcpy(op +16, match +16, 2);
  ------------------
  |  |  349|    172|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2453|    172|                    op += ml + MINMATCH;
  ------------------
  |  |  242|    172|#define MINMATCH 4
  ------------------
 2454|       |                    /* Both stages worked, load the next token. */
 2455|    172|                    continue;
 2456|    172|                }
 2457|       |                /* The second stage didn't work out, but the info is ready for the match copy below. */
 2458|    970|            } else {
 2459|       |                /* decode literal length */
 2460|    970|                if (ll == RUN_MASK) {
  ------------------
  |  |  263|    970|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    970|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    970|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2460:21): [True: 527, False: 443]
  ------------------
 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|    527|                    size_t const addl = read_variable_length(&ip, iend-RUN_MASK);
  ------------------
  |  |  263|    527|#define RUN_MASK ((1U<<RUN_BITS)-1)
  |  |  ------------------
  |  |  |  |  262|    527|#define RUN_BITS (8-ML_BITS)
  |  |  |  |  ------------------
  |  |  |  |  |  |  260|    527|#define ML_BITS  4
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2464|    527|                    if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2464:25): [True: 37, False: 490]
  ------------------
 2465|    490|                    ll += addl;
 2466|    490|                    if (unlikely((uptrval)(op)+ll<(uptrval)(op))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    490|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    490|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 490]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2467|    490|                    if (unlikely((uptrval)(ip)+ll<(uptrval)(ip))) { goto _output_error; } /* overflow detection */
  ------------------
  |  |  180|    490|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    490|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 490]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2468|    490|                }
 2469|       |
 2470|       |                /* copy literals */
 2471|    933|                cpy = op+ll;
 2472|    933|                LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH);
  ------------------
  |  |  277|    933|#define LZ4_STATIC_ASSERT(c)   { enum { LZ4_static_assert = 1/(int)(!!(c)) }; }   /* use after variable declarations */
  ------------------
 2473|    933|                if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  246|    933|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
                              if ((cpy>oend-MFLIMIT) || (ip+ll>iend-(2+1+LASTLITERALS))) {
  ------------------
  |  |  245|    851|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2473:21): [True: 82, False: 851]
  |  Branch (2473:43): [True: 264, False: 587]
  ------------------
 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|    346|                    if (partialDecoding) {
  ------------------
  |  Branch (2476:25): [True: 0, False: 346]
  ------------------
 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|    346|                    } else if ((ip+ll != iend) || (cpy > oend)) {
  ------------------
  |  Branch (2480:32): [True: 266, False: 80]
  |  Branch (2480:51): [True: 1, False: 79]
  ------------------
 2481|       |                        /* last literals must end exactly at input end, within output */
 2482|    267|                        DEBUGLOG(5, "invalid last literals : they end at iend%+zi and oend%+zi", (ip+ll)-iend, cpy-oend);
  ------------------
  |  |  289|    267|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2483|    267|                        if ((ip+ll <= iend) && (cpy > oend-MFLIMIT)) goto _dst_too_small;   /* output full, input left */
  ------------------
  |  |  246|     99|#define MFLIMIT       12   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
  |  Branch (2483:29): [True: 99, False: 168]
  |  Branch (2483:48): [True: 7, False: 92]
  ------------------
 2484|    260|                        goto _output_error;
 2485|    267|                    }
 2486|     79|                    LZ4_memmove(op, ip, ll);  /* supports overlapping memory regions, for in-place decompression scenarios */
  ------------------
  |  |  357|     79|#    define LZ4_memmove __builtin_memmove
  ------------------
 2487|     79|                    ip += ll;
 2488|     79|                    op += ll;
 2489|       |                    /* end of block, unless partialDecoding can go on : output not full, input left for a match */
 2490|     79|                    if (!partialDecoding || (op == oend) || (ip >= (iend-2))) {
  ------------------
  |  Branch (2490:25): [True: 79, False: 0]
  |  Branch (2490:45): [True: 0, False: 0]
  |  Branch (2490:61): [True: 0, False: 0]
  ------------------
 2491|     79|                        break;
 2492|     79|                    }
 2493|    587|                } else {
 2494|    587|                    LZ4_wildCopy8(op, ip, cpy);   /* can overwrite up to 8 bytes beyond cpy */
 2495|    587|                    ip += ll; op = cpy;
 2496|    587|                }
 2497|       |
 2498|       |                /* get offset */
 2499|    587|                offset = LZ4_readLE16(ip); ip+=2;
 2500|    587|                match = op - offset;
 2501|       |
 2502|       |                /* get matchlength */
 2503|    587|                ml = token & ML_MASK;
  ------------------
  |  |  261|    587|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|    587|#define ML_BITS  4
  |  |  ------------------
  ------------------
 2504|    587|                DEBUGLOG(7, "blockPos%6u: matchLength token = %u", (unsigned)(op-(BYTE*)dst), (unsigned)ml);
  ------------------
  |  |  289|    587|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2505|    587|            }
 2506|       |
 2507|       |            /* literals copied, offset decoded, ml == match length token */
 2508|  1.09k|            if (ml == ML_MASK) {
  ------------------
  |  |  261|  1.09k|#define ML_MASK  ((1U<<ML_BITS)-1)
  |  |  ------------------
  |  |  |  |  260|  1.09k|#define ML_BITS  4
  |  |  ------------------
  ------------------
  |  Branch (2508:17): [True: 591, False: 505]
  ------------------
 2509|       |                /* after match length extension bytes, at least 1 token + LASTLITERALS literals must remain */
 2510|    591|                size_t const addl = read_variable_length(&ip, iend - (1 + LASTLITERALS));
  ------------------
  |  |  245|    591|#define LASTLITERALS   5   /* see ../doc/lz4_Block_format.md#parsing-restrictions */
  ------------------
 2511|    591|                if (addl == rvl_error) { goto _output_error; }
  ------------------
  |  Branch (2511:21): [True: 14, False: 577]
  ------------------
 2512|    577|                ml += addl;
 2513|    577|                if (unlikely((uptrval)(op)+ml<(uptrval)op)) goto _output_error;   /* overflow detection */
  ------------------
  |  |  180|    577|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    577|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 0, False: 577]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2514|    577|            }
 2515|  1.08k|            ml += MINMATCH;
  ------------------
  |  |  242|  1.08k|#define MINMATCH 4
  ------------------
 2516|       |
 2517|  1.08k|#if LZ4_FAST_DEC_LOOP
 2518|  1.16k|        safe_match_copy:
 2519|  1.16k|#endif
 2520|       |            /* literals copied, match fully decoded (ml includes MINMATCH), offset not validated yet */
 2521|  1.16k|            if ((checkOffset) && (unlikely(match + dictSize < lowPrefix))) goto _offset_error;   /* Error : offset outside buffers */
  ------------------
  |  |  180|  1.16k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.16k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  ------------------
  ------------------
  |  Branch (2521:17): [True: 1.16k, False: 0]
  |  Branch (2521:34): [True: 140, False: 1.02k]
  ------------------
 2522|       |
 2523|       |            /* end of block : the last LASTLITERALS bytes must be literals */
 2524|  1.02k|            assert(op <= oend);
  ------------------
  |  |  273|  1.02k|#    define assert(condition) ((void)0)
  ------------------
 2525|  1.02k|            if (unlikely(op+ml > oend-LASTLITERALS)) {
  ------------------
  |  |  180|  1.02k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  1.02k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 14, False: 1.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2526|     14|                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: 14]
  ------------------
 2527|     14|                else goto _dst_too_small;
 2528|     14|            }
 2529|       |
 2530|       |            /* match starting within external dictionary */
 2531|  1.01k|            if ((dict==usingExtDict) && (match < lowPrefix)) {
  ------------------
  |  Branch (2531:17): [True: 574, False: 441]
  |  Branch (2531:41): [True: 63, False: 511]
  ------------------
 2532|     63|                assert(dictEnd != NULL);
  ------------------
  |  |  273|     63|#    define assert(condition) ((void)0)
  ------------------
 2533|     63|                op = LZ4_copyExtDictMatch(op, match, ml, lowPrefix, dictEnd);
 2534|     63|                continue;
 2535|     63|            }
 2536|    952|            assert(match >= lowPrefix);
  ------------------
  |  |  273|    952|#    define assert(condition) ((void)0)
  ------------------
 2537|       |
 2538|       |            /* close to block end : no wild copy */
 2539|    952|            if (unlikely(op+ml > oend-MATCH_SAFEGUARD_DISTANCE)) {
  ------------------
  |  |  180|    952|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    952|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 74, False: 878]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2540|     74|                op = LZ4_copyMatchExact(op, match, ml);
 2541|     74|                if (op == oend) { break; }   /* partialDecoding : output buffer full */
  ------------------
  |  Branch (2541:21): [True: 0, False: 74]
  ------------------
 2542|     74|                continue;
 2543|     74|            }
 2544|       |
 2545|       |            /* copy match within block */
 2546|    878|            cpy = op + ml;
 2547|    878|            LZ4_memcpy_using_offset_base(op, match, cpy, offset);
 2548|    878|            op = cpy;   /* wildcopy correction */
 2549|    878|        }
 2550|       |
 2551|       |        /* end of decoding */
 2552|     79|        DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst));
  ------------------
  |  |  289|     79|#  define DEBUGLOG(l, ...) {}    /* disabled */
  ------------------
 2553|     79|        return (int) (((char*)op)-dst);     /* Nb of output bytes decoded */
 2554|       |
 2555|       |        /* errors : see LZ4_decompress_safe() in lz4.h */
 2556|    317|    _output_error:
 2557|    317|        return -1;
 2558|     21|    _dst_too_small:
 2559|     21|        return -2;
 2560|    247|    _offset_error:
 2561|    247|        return -3;
 2562|    464|    }
 2563|    464|}
lz4.c:read_variable_length:
 2132|  42.4k|{
 2133|  42.4k|    Rvl_t s, length = 0;
 2134|  42.4k|    assert(ipPtr != NULL);
  ------------------
  |  |  273|  42.4k|#    define assert(condition) ((void)0)
  ------------------
 2135|  42.4k|    assert(*ipPtr !=  NULL);
  ------------------
  |  |  273|  42.4k|#    define assert(condition) ((void)0)
  ------------------
 2136|  42.4k|    assert(ilimit != NULL);
  ------------------
  |  |  273|  42.4k|#    define assert(condition) ((void)0)
  ------------------
 2137|  42.4k|    if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  42.4k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  42.4k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 39, False: 42.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2138|     39|        return rvl_error;
 2139|     39|    }
 2140|  42.4k|    s = **ipPtr;
 2141|  42.4k|    (*ipPtr)++;
 2142|  42.4k|    length += s;
 2143|  42.4k|    if (likely(s != 255)) return length;
  ------------------
  |  |  177|  42.4k|#define likely(expr)     expect((expr) != 0, 1)
  |  |  ------------------
  |  |  |  |  171|  42.4k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 40.5k, False: 1.82k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2144|  80.6k|    do {
 2145|  80.6k|        if (unlikely((*ipPtr) >= ilimit)) {    /* read limit reached */
  ------------------
  |  |  180|  80.6k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  80.6k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 18, False: 80.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2146|     18|            return rvl_error;
 2147|     18|        }
 2148|  80.6k|        s = **ipPtr;
 2149|  80.6k|        (*ipPtr)++;
 2150|  80.6k|        length += s;
 2151|       |        /* accumulator overflow detection (32-bit mode only) */
 2152|  80.6k|        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: 80.6k]
  ------------------
 2153|      0|            return rvl_error;
 2154|      0|        }
 2155|  80.6k|    } while (s == 255);
  ------------------
  |  Branch (2155:14): [True: 78.8k, False: 1.81k]
  ------------------
 2156|       |
 2157|  1.81k|    return length;
 2158|  1.82k|}
lz4.c:LZ4_wildCopy64:
  537|  14.7k|{
  538|  14.7k|    BYTE* d = (BYTE*)dstPtr;
  539|  14.7k|    const BYTE* s = (const BYTE*)srcPtr;
  540|  14.7k|    BYTE* const e = (BYTE*)dstEnd;
  541|       |
  542|  86.0k|    do { LZ4_memcpy(d,s,64); d+=64; s+=64; } while (d<e);
  ------------------
  |  |  349|  86.0k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (542:53): [True: 71.3k, False: 14.7k]
  ------------------
  543|  14.7k|}
lz4.c:LZ4_readLE16:
  431|  69.9k|{
  432|  69.9k|    if (LZ4_isLittleEndian()) {
  ------------------
  |  Branch (432:9): [True: 69.9k, False: 0]
  ------------------
  433|  69.9k|        return LZ4_read16(memPtr);
  434|  69.9k|    } else {
  435|      0|        const BYTE* p = (const BYTE*)memPtr;
  436|      0|        return (U16)((U16)p[0] | (p[1]<<8));
  437|      0|    }
  438|  69.9k|}
lz4.c:LZ4_copyExtDictMatch:
 2193|    728|{
 2194|    728|    if (length <= (size_t)(lowPrefix-match)) {
  ------------------
  |  Branch (2194:9): [True: 547, False: 181]
  ------------------
 2195|       |        /* match fits entirely within external dictionary : just copy */
 2196|    547|        LZ4_memmove(op, dictEnd - (lowPrefix-match), length);
  ------------------
  |  |  357|    547|#    define LZ4_memmove __builtin_memmove
  ------------------
 2197|    547|        return op + length;
 2198|    547|    } else {
 2199|       |        /* match stretches into both external dictionary and current block */
 2200|    181|        size_t const copySize = (size_t)(lowPrefix - match);
 2201|    181|        LZ4_memcpy(op, dictEnd - copySize, copySize);
  ------------------
  |  |  349|    181|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2202|    181|        return LZ4_copyMatchExact(op + copySize, lowPrefix, length - copySize);
 2203|    181|    }
 2204|    728|}
lz4.c:LZ4_memcpy_using_offset:
  564|  39.1k|{
  565|  39.1k|    BYTE v[8];
  566|       |
  567|  39.1k|    assert(dstEnd >= dstPtr + MINMATCH);
  ------------------
  |  |  273|  39.1k|#    define assert(condition) ((void)0)
  ------------------
  568|       |
  569|  39.1k|    switch(offset) {
  570|  25.3k|    case 1:
  ------------------
  |  Branch (570:5): [True: 25.3k, False: 13.8k]
  ------------------
  571|  25.3k|        MEM_INIT(v, *srcPtr, 8);
  ------------------
  |  |  236|  25.3k|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|  25.3k|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
  572|  25.3k|        break;
  573|    451|    case 2:
  ------------------
  |  Branch (573:5): [True: 451, False: 38.6k]
  ------------------
  574|    451|        LZ4_memcpy(v, srcPtr, 2);
  ------------------
  |  |  349|    451|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  575|    451|        LZ4_memcpy(&v[2], srcPtr, 2);
  ------------------
  |  |  349|    451|#    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|    451|        LZ4_memcpy(&v[4], v, 4);
  ------------------
  |  |  349|    451|#    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|    451|        break;
  585|  1.82k|    case 4:
  ------------------
  |  Branch (585:5): [True: 1.82k, False: 37.3k]
  ------------------
  586|  1.82k|        LZ4_memcpy(v, srcPtr, 4);
  ------------------
  |  |  349|  1.82k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  587|  1.82k|        LZ4_memcpy(&v[4], srcPtr, 4);
  ------------------
  |  |  349|  1.82k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  588|  1.82k|        break;
  589|  11.5k|    default:
  ------------------
  |  Branch (589:5): [True: 11.5k, False: 27.5k]
  ------------------
  590|  11.5k|        LZ4_memcpy_using_offset_base(dstPtr, srcPtr, dstEnd, offset);
  591|  11.5k|        return;
  592|  39.1k|    }
  593|       |
  594|  27.5k|    LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|  27.5k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  595|  27.5k|    dstPtr += 8;
  596|   835k|    while (dstPtr < dstEnd) {
  ------------------
  |  Branch (596:12): [True: 807k, False: 27.5k]
  ------------------
  597|   807k|        LZ4_memcpy(dstPtr, v, 8);
  ------------------
  |  |  349|   807k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  598|   807k|        dstPtr += 8;
  599|   807k|    }
  600|  27.5k|}
lz4.c:LZ4_wildCopy32:
  551|    820|{
  552|    820|    BYTE* d = (BYTE*)dstPtr;
  553|    820|    const BYTE* s = (const BYTE*)srcPtr;
  554|    820|    BYTE* const e = (BYTE*)dstEnd;
  555|       |
  556|  17.7k|    do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
  ------------------
  |  |  349|  17.7k|#    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|  17.7k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  |  Branch (556:79): [True: 16.8k, False: 820]
  ------------------
  557|    820|}
lz4.c:LZ4_copyMatchExact:
 2167|    255|{
 2168|    255|    if (unlikely(match == op)) {   /* invalid offset 0 : clear the match segment, see doc/lz4_Block_format.md */
  ------------------
  |  |  180|    255|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|    255|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 13, False: 242]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2169|     13|        MEM_INIT(op, 0, length);
  ------------------
  |  |  236|     13|#define MEM_INIT(p,v,s)   LZ4_memset((p),(v),(s))
  |  |  ------------------
  |  |  |  |  234|     13|#  define LZ4_memset(p,v,s) memset((p),(v),(s))
  |  |  ------------------
  ------------------
 2170|     13|        return op + length;
 2171|     13|    }
 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|  3.24k|    while (length > (size_t)(op - match)) {
  ------------------
  |  Branch (2175:12): [True: 2.99k, False: 242]
  ------------------
 2176|  2.99k|        size_t const available = (size_t)(op - match);
 2177|  2.99k|        LZ4_memcpy(op, match, available);
  ------------------
  |  |  349|  2.99k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2178|  2.99k|        op += available;
 2179|  2.99k|        length -= available;
 2180|  2.99k|        if (available >= 2048) match += available;
  ------------------
  |  Branch (2180:13): [True: 2.02k, False: 975]
  ------------------
 2181|  2.99k|    }
 2182|    242|    LZ4_memcpy(op, match, length);
  ------------------
  |  |  349|    242|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
 2183|    242|    return op + length;
 2184|    255|}
lz4.c:LZ4_memcpy_using_offset_base:
  497|  12.4k|{
  498|  12.4k|    assert(srcPtr + offset == dstPtr);
  ------------------
  |  |  273|  12.4k|#    define assert(condition) ((void)0)
  ------------------
  499|  12.4k|    if (unlikely(offset < 8)) {
  ------------------
  |  |  180|  12.4k|#define unlikely(expr)   expect((expr) != 0, 0)
  |  |  ------------------
  |  |  |  |  171|  12.4k|#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (171:33): [True: 10.3k, False: 2.04k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  500|  10.3k|        LZ4_write32(dstPtr, 0);   /* silence an msan warning when offset==0 */
  501|  10.3k|        dstPtr[0] = srcPtr[0];
  502|  10.3k|        dstPtr[1] = srcPtr[1];
  503|  10.3k|        dstPtr[2] = srcPtr[2];
  504|  10.3k|        dstPtr[3] = srcPtr[3];
  505|  10.3k|        srcPtr += inc32table[offset];
  506|  10.3k|        LZ4_memcpy(dstPtr+4, srcPtr, 4);
  ------------------
  |  |  349|  10.3k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  507|  10.3k|        srcPtr -= dec64table[offset];
  508|  10.3k|    } else {
  509|  2.04k|        LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|  2.04k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  510|  2.04k|        srcPtr += 8;
  511|  2.04k|    }
  512|  12.4k|    dstPtr += 8;
  513|       |
  514|       |    /* srcPtr is now at least 8 bytes behind dstPtr */
  515|  12.4k|    LZ4_memcpy(dstPtr, srcPtr, 8);
  ------------------
  |  |  349|  12.4k|#    define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size)
  ------------------
  516|  12.4k|    if (dstEnd > dstPtr + 8) { LZ4_wildCopy8(dstPtr + 8, srcPtr + 8, dstEnd); }
  ------------------
  |  Branch (516:9): [True: 3.94k, False: 8.49k]
  ------------------
  517|  12.4k|}

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

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

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

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

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

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

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

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

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

inflate_fast_avx2:
   53|  3.89k|void Z_INTERNAL INFLATE_FAST(PREFIX3(stream) *strm, uint32_t start) {
   54|       |    /* start: inflate()'s starting value for strm->avail_out */
   55|  3.89k|    struct inflate_state *state;
   56|  3.89k|    z_const unsigned char *in;  /* local strm->next_in */
  ------------------
  |  |   23|  3.89k|#define z_const const
  ------------------
   57|  3.89k|    const unsigned char *last;  /* have enough input while in < last */
   58|  3.89k|    unsigned char *out;         /* local strm->next_out */
   59|  3.89k|    unsigned char *beg;         /* inflate()'s initial strm->next_out */
   60|  3.89k|    unsigned char *end;         /* while out < end, enough space available */
   61|  3.89k|    unsigned char *safe;        /* can use chunkcopy provided out < safe */
   62|  3.89k|    unsigned char *window;      /* allocated sliding window, if wsize != 0 */
   63|  3.89k|    unsigned wsize;             /* window size or zero if not using window */
   64|  3.89k|    unsigned whave;             /* valid bytes in the window */
   65|  3.89k|    unsigned wnext;             /* window write index */
   66|       |
   67|       |    /* hold is a local copy of strm->hold. By default, hold satisfies the same
   68|       |       invariants that strm->hold does, namely that (hold >> bits) == 0. This
   69|       |       invariant is kept by loading bits into hold one byte at a time, like:
   70|       |
   71|       |       hold |= next_byte_of_input << bits; in++; bits += 8;
   72|       |
   73|       |       If we need to ensure that bits >= 15 then this code snippet is simply
   74|       |       repeated. Over one iteration of the outermost do/while loop, this
   75|       |       happens up to six times (48 bits of input), as described in the NOTES
   76|       |       above.
   77|       |
   78|       |       However, on some little endian architectures, it can be significantly
   79|       |       faster to load 64 bits once instead of 8 bits six times:
   80|       |
   81|       |       if (bits <= 16) {
   82|       |         hold |= next_8_bytes_of_input << bits; in += 6; bits += 48;
   83|       |       }
   84|       |
   85|       |       Unlike the simpler one byte load, shifting the next_8_bytes_of_input
   86|       |       by bits will overflow and lose those high bits, up to 2 bytes' worth.
   87|       |       The conservative estimate is therefore that we have read only 6 bytes
   88|       |       (48 bits). Again, as per the NOTES above, 48 bits is sufficient for the
   89|       |       rest of the iteration, and we will not need to load another 8 bytes.
   90|       |
   91|       |       Inside this function, we no longer satisfy (hold >> bits) == 0, but
   92|       |       this is not problematic, even if that overflow does not land on an 8 bit
   93|       |       byte boundary. Those excess bits will eventually shift down lower as the
   94|       |       Huffman decoder consumes input, and when new input bits need to be loaded
   95|       |       into the bits variable, the same input bits will be or'ed over those
   96|       |       existing bits. A bitwise or is idempotent: (a | b | b) equals (a | b).
   97|       |       Note that we therefore write that load operation as "hold |= etc" and not
   98|       |       "hold += etc".
   99|       |
  100|       |       Outside that loop, at the end of the function, hold is bitwise and'ed
  101|       |       with (1<<bits)-1 to drop those excess bits so that, on function exit, we
  102|       |       keep the invariant that (state->hold >> state->bits) == 0.
  103|       |    */
  104|  3.89k|    unsigned bits;              /* local strm->bits */
  105|  3.89k|    uint64_t hold;              /* local strm->hold */
  106|  3.89k|    unsigned lmask;             /* mask for first level of length codes */
  107|  3.89k|    unsigned dmask;             /* mask for first level of distance codes */
  108|  3.89k|    code const *lcode;          /* local strm->lencode */
  109|  3.89k|    code const *dcode;          /* local strm->distcode */
  110|  3.89k|    const code *here;           /* retrieved table entry */
  111|  3.89k|    unsigned op;                /* code bits, operation, extra bits, or */
  112|       |                                /*  window position, window bytes to copy */
  113|  3.89k|    unsigned len;               /* match length, unused bytes */
  114|  3.89k|    unsigned char *from;        /* where to copy match from */
  115|  3.89k|    unsigned dist;              /* match distance */
  116|  3.89k|    unsigned extra_safe;        /* copy chunks safely in all cases */
  117|       |
  118|       |    /* copy state to local variables */
  119|  3.89k|    state = (struct inflate_state *)strm->state;
  120|  3.89k|    in = strm->next_in;
  121|  3.89k|    last = in + (strm->avail_in - (INFLATE_FAST_MIN_HAVE - 1));
  ------------------
  |  |  137|  3.89k|#define INFLATE_FAST_MIN_HAVE 15
  ------------------
  122|  3.89k|    out = strm->next_out;
  123|  3.89k|    beg = out - (start - strm->avail_out);
  124|  3.89k|    end = out + (strm->avail_out - (INFLATE_FAST_MIN_LEFT - 1));
  ------------------
  |  |  138|  3.89k|#define INFLATE_FAST_MIN_LEFT 260
  ------------------
  125|  3.89k|    safe = out + strm->avail_out;
  126|  3.89k|    wsize = state->wsize;
  127|  3.89k|    whave = state->whave;
  128|  3.89k|    wnext = state->wnext;
  129|  3.89k|    window = state->window;
  130|  3.89k|    hold = state->hold;
  131|  3.89k|    bits = state->bits;
  132|  3.89k|    lcode = state->lencode;
  133|  3.89k|    dcode = state->distcode;
  134|  3.89k|    lmask = (1U << state->lenbits) - 1;
  135|  3.89k|    dmask = (1U << state->distbits) - 1;
  136|       |
  137|       |    /* Detect if out and window point to the same memory allocation. In this instance it is
  138|       |       necessary to use safe chunk copy functions to prevent overwriting the window. If the
  139|       |       window is overwritten then future matches with far distances will fail to copy correctly. */
  140|  3.89k|    extra_safe = (wsize != 0 && out >= window && out + INFLATE_FAST_MIN_LEFT <= window + state->wbufsize);
  ------------------
  |  |  138|      0|#define INFLATE_FAST_MIN_LEFT 260
  ------------------
  |  Branch (140:19): [True: 0, False: 3.89k]
  |  Branch (140:33): [True: 0, False: 0]
  |  Branch (140:50): [True: 0, False: 0]
  ------------------
  141|       |
  142|  3.89k|#define REFILL() do { \
  143|  3.89k|        hold |= load_64_bits(in, bits); \
  144|  3.89k|        in += 7; \
  145|  3.89k|        in -= ((bits >> 3) & 7); \
  146|  3.89k|        bits |= 56; \
  147|  3.89k|    } while (0)
  148|       |
  149|       |    /* decode literals and length/distances until end-of-block or not enough
  150|       |       input data or output space */
  151|   251k|    do {
  152|   251k|        REFILL();
  ------------------
  |  |  142|   251k|#define REFILL() do { \
  |  |  143|   251k|        hold |= load_64_bits(in, bits); \
  |  |  144|   251k|        in += 7; \
  |  |  145|   251k|        in -= ((bits >> 3) & 7); \
  |  |  146|   251k|        bits |= 56; \
  |  |  147|   251k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (147:14): [Folded, False: 251k]
  |  |  ------------------
  ------------------
  153|   251k|        here = lcode + (hold & lmask);
  154|   251k|        if (here->op == 0) {
  ------------------
  |  Branch (154:13): [True: 79.0k, False: 172k]
  ------------------
  155|  79.0k|            *out++ = (unsigned char)(here->val);
  156|  79.0k|            DROPBITS(here->bits);
  ------------------
  |  |  118|  79.0k|    do { \
  |  |  119|  79.0k|        hold >>= (n); \
  |  |  120|  79.0k|        bits -= (unsigned)(n); \
  |  |  121|  79.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 79.0k]
  |  |  ------------------
  ------------------
  157|  79.0k|            here = lcode + (hold & lmask);
  158|  79.0k|            if (here->op == 0) {
  ------------------
  |  Branch (158:17): [True: 27.3k, False: 51.7k]
  ------------------
  159|  27.3k|                *out++ = (unsigned char)(here->val);
  160|  27.3k|                DROPBITS(here->bits);
  ------------------
  |  |  118|  27.3k|    do { \
  |  |  119|  27.3k|        hold >>= (n); \
  |  |  120|  27.3k|        bits -= (unsigned)(n); \
  |  |  121|  27.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 27.3k]
  |  |  ------------------
  ------------------
  161|  27.3k|                here = lcode + (hold & lmask);
  162|  27.3k|            }
  163|  79.0k|        }
  164|   256k|      dolen:
  165|   256k|        DROPBITS(here->bits);
  ------------------
  |  |  118|   256k|    do { \
  |  |  119|   256k|        hold >>= (n); \
  |  |  120|   256k|        bits -= (unsigned)(n); \
  |  |  121|   256k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 256k]
  |  |  ------------------
  ------------------
  166|   256k|        op = here->op;
  167|   256k|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (167:13): [True: 22.9k, False: 233k]
  ------------------
  168|  22.9k|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  169|  22.9k|                    "inflate:         literal '%c'\n" :
  170|  22.9k|                    "inflate:         literal 0x%02x\n", here->val));
  171|  22.9k|            *out++ = (unsigned char)(here->val);
  172|   233k|        } else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (172:20): [True: 228k, False: 5.55k]
  ------------------
  173|   228k|            len = here->val;
  174|   228k|            op &= MAX_BITS;                       /* number of extra bits */
  ------------------
  |  |   39|   228k|#define MAX_BITS 15
  ------------------
  175|   228k|            len += BITS(op);
  ------------------
  |  |  114|   228k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  176|   228k|            DROPBITS(op);
  ------------------
  |  |  118|   228k|    do { \
  |  |  119|   228k|        hold >>= (n); \
  |  |  120|   228k|        bits -= (unsigned)(n); \
  |  |  121|   228k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 228k]
  |  |  ------------------
  ------------------
  177|   228k|            Tracevv((stderr, "inflate:         length %u\n", len));
  178|   228k|            here = dcode + (hold & dmask);
  179|   228k|            if (bits < MAX_BITS + MAX_DIST_EXTRA_BITS) {
  ------------------
  |  |   39|   228k|#define MAX_BITS 15
  ------------------
                          if (bits < MAX_BITS + MAX_DIST_EXTRA_BITS) {
  ------------------
  |  |   41|   228k|#define MAX_DIST_EXTRA_BITS 13
  ------------------
  |  Branch (179:17): [True: 222, False: 227k]
  ------------------
  180|    222|                REFILL();
  ------------------
  |  |  142|    222|#define REFILL() do { \
  |  |  143|    222|        hold |= load_64_bits(in, bits); \
  |  |  144|    222|        in += 7; \
  |  |  145|    222|        in -= ((bits >> 3) & 7); \
  |  |  146|    222|        bits |= 56; \
  |  |  147|    222|    } while (0)
  |  |  ------------------
  |  |  |  Branch (147:14): [Folded, False: 222]
  |  |  ------------------
  ------------------
  181|    222|            }
  182|   230k|          dodist:
  183|   230k|            DROPBITS(here->bits);
  ------------------
  |  |  118|   230k|    do { \
  |  |  119|   230k|        hold >>= (n); \
  |  |  120|   230k|        bits -= (unsigned)(n); \
  |  |  121|   230k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 230k]
  |  |  ------------------
  ------------------
  184|   230k|            op = here->op;
  185|   230k|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (185:17): [True: 228k, False: 2.03k]
  ------------------
  186|   228k|                dist = here->val;
  187|   228k|                op &= MAX_BITS;                 /* number of extra bits */
  ------------------
  |  |   39|   228k|#define MAX_BITS 15
  ------------------
  188|   228k|                dist += BITS(op);
  ------------------
  |  |  114|   228k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  189|       |#ifdef INFLATE_STRICT
  190|       |                if (dist > state->dmax) {
  191|       |                    SET_BAD("invalid distance too far back");
  192|       |                    break;
  193|       |                }
  194|       |#endif
  195|   228k|                DROPBITS(op);
  ------------------
  |  |  118|   228k|    do { \
  |  |  119|   228k|        hold >>= (n); \
  |  |  120|   228k|        bits -= (unsigned)(n); \
  |  |  121|   228k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (121:14): [Folded, False: 228k]
  |  |  ------------------
  ------------------
  196|   228k|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  197|   228k|                op = (unsigned)(out - beg);     /* max distance in output */
  198|   228k|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (198:21): [True: 27, False: 228k]
  ------------------
  199|     27|                    op = dist - op;             /* distance back in window */
  200|     27|                    if (op > whave) {
  ------------------
  |  Branch (200:25): [True: 27, False: 0]
  ------------------
  201|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  202|       |                        if (state->sane) {
  203|       |                            SET_BAD("invalid distance too far back");
  204|       |                            break;
  205|       |                        }
  206|       |                        if (len <= op - whave) {
  207|       |                            do {
  208|       |                                *out++ = 0;
  209|       |                            } while (--len);
  210|       |                            continue;
  211|       |                        }
  212|       |                        len -= op - whave;
  213|       |                        do {
  214|       |                            *out++ = 0;
  215|       |                        } while (--op > whave);
  216|       |                        if (op == 0) {
  217|       |                            from = out - dist;
  218|       |                            do {
  219|       |                                *out++ = *from++;
  220|       |                            } while (--len);
  221|       |                            continue;
  222|       |                        }
  223|       |#else
  224|     27|                        SET_BAD("invalid distance too far back");
  ------------------
  |  |  132|     27|    do { \
  |  |  133|     27|        state->mode = BAD; \
  |  |  134|     27|        strm->msg = (char *)errmsg; \
  |  |  135|     27|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 27]
  |  |  ------------------
  ------------------
  225|     27|                        break;
  226|     27|#endif
  227|     27|                    }
  228|      0|                    from = window;
  229|      0|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (229:25): [True: 0, False: 0]
  ------------------
  230|      0|                        from += wsize - op;
  231|      0|                    } else if (wnext >= op) {   /* contiguous in window */
  ------------------
  |  Branch (231:32): [True: 0, False: 0]
  ------------------
  232|      0|                        from += wnext - op;
  233|      0|                    } else {                    /* wrap around window */
  234|      0|                        op -= wnext;
  235|      0|                        from += wsize - op;
  236|      0|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (236:29): [True: 0, False: 0]
  ------------------
  237|      0|                            len -= op;
  238|      0|                            out = CHUNKCOPY_SAFE(out, from, op, safe);
  239|      0|                            from = window;      /* more from start of window */
  240|      0|                            op = wnext;
  241|       |                            /* This (rare) case can create a situation where
  242|       |                               the first chunkcopy below must be checked.
  243|       |                             */
  244|      0|                        }
  245|      0|                    }
  246|      0|                    if (op < len) {             /* still need some from output */
  ------------------
  |  Branch (246:25): [True: 0, False: 0]
  ------------------
  247|      0|                        len -= op;
  248|      0|                        if (!extra_safe) {
  ------------------
  |  Branch (248:29): [True: 0, False: 0]
  ------------------
  249|      0|                            out = CHUNKCOPY_SAFE(out, from, op, safe);
  250|      0|                            out = CHUNKUNROLL(out, &dist, &len);
  ------------------
  |  |  120|      0|#define CHUNKUNROLL      chunkunroll_avx2
  ------------------
  251|      0|                            out = CHUNKCOPY_SAFE(out, out - dist, len, safe);
  252|      0|                        } else {
  253|      0|                            out = chunkcopy_safe(out, from, op, safe);
  254|      0|                            out = chunkcopy_safe(out, out - dist, len, safe);
  255|      0|                        }
  256|      0|                    } else {
  257|      0|#ifndef HAVE_MASKED_READWRITE
  258|      0|                        if (extra_safe)
  ------------------
  |  Branch (258:29): [True: 0, False: 0]
  ------------------
  259|      0|                            out = chunkcopy_safe(out, from, len, safe);
  260|      0|                        else
  261|      0|#endif
  262|      0|                            out = CHUNKCOPY_SAFE(out, from, len, safe);
  263|      0|                    }
  264|      0|#ifndef HAVE_MASKED_READWRITE
  265|   228k|                } else if (extra_safe) {
  ------------------
  |  Branch (265:28): [True: 0, False: 228k]
  ------------------
  266|       |                    /* Whole reference is in range of current output. */
  267|      0|                        out = chunkcopy_safe(out, out - dist, len, safe);
  268|      0|#endif
  269|   228k|                } else {
  270|       |                    /* Whole reference is in range of current output.  No range checks are
  271|       |                       necessary because we start with room for at least 258 bytes of output,
  272|       |                       so unroll and roundoff operations can write beyond `out+len` so long
  273|       |                       as they stay within 258 bytes of `out`.
  274|       |                    */
  275|   228k|                    if (dist >= len || dist >= CHUNKSIZE())
  ------------------
  |  |  118|   186k|#define CHUNKSIZE        chunksize_avx2
  ------------------
  |  Branch (275:25): [True: 42.0k, False: 186k]
  |  Branch (275:40): [True: 2.13k, False: 183k]
  ------------------
  276|  44.2k|                        out = CHUNKCOPY(out, out - dist, len);
  ------------------
  |  |  119|  44.2k|#define CHUNKCOPY        chunkcopy_avx2
  ------------------
  277|   183k|                    else
  278|   183k|                        out = CHUNKMEMSET(out, out - dist, len);
  ------------------
  |  |  121|   183k|#define CHUNKMEMSET      chunkmemset_avx2
  ------------------
  279|   228k|                }
  280|   228k|            } else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (280:24): [True: 2.03k, False: 4]
  ------------------
  281|  2.03k|                here = dcode + here->val + BITS(op);
  ------------------
  |  |  114|  2.03k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  282|  2.03k|                goto dodist;
  283|  2.03k|            } else {
  284|      4|                SET_BAD("invalid distance code");
  ------------------
  |  |  132|      4|    do { \
  |  |  133|      4|        state->mode = BAD; \
  |  |  134|      4|        strm->msg = (char *)errmsg; \
  |  |  135|      4|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 4]
  |  |  ------------------
  ------------------
  285|      4|                break;
  286|      4|            }
  287|   230k|        } else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (287:20): [True: 4.75k, False: 800]
  ------------------
  288|  4.75k|            here = lcode + here->val + BITS(op);
  ------------------
  |  |  114|  4.75k|    (hold & ((1U << (unsigned)(n)) - 1))
  ------------------
  289|  4.75k|            goto dolen;
  290|  4.75k|        } else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (290:20): [True: 797, False: 3]
  ------------------
  291|    797|            Tracevv((stderr, "inflate:         end of block\n"));
  292|    797|            state->mode = TYPE;
  293|    797|            break;
  294|    797|        } else {
  295|      3|            SET_BAD("invalid literal/length code");
  ------------------
  |  |  132|      3|    do { \
  |  |  133|      3|        state->mode = BAD; \
  |  |  134|      3|        strm->msg = (char *)errmsg; \
  |  |  135|      3|    } while (0)
  |  |  ------------------
  |  |  |  Branch (135:14): [Folded, False: 3]
  |  |  ------------------
  ------------------
  296|      3|            break;
  297|      3|        }
  298|   256k|    } while (in < last && out < end);
  ------------------
  |  Branch (298:14): [True: 248k, False: 3.02k]
  |  Branch (298:27): [True: 247k, False: 39]
  ------------------
  299|       |
  300|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  301|  3.89k|    len = bits >> 3;
  302|  3.89k|    in -= len;
  303|  3.89k|    bits -= len << 3;
  304|  3.89k|    hold &= (UINT64_C(1) << bits) - 1;
  305|       |
  306|       |    /* update state and return */
  307|  3.89k|    strm->next_in = in;
  308|  3.89k|    strm->next_out = out;
  309|  3.89k|    strm->avail_in = (unsigned)(in < last ? (INFLATE_FAST_MIN_HAVE - 1) + (last - in)
  ------------------
  |  |  137|  3.62k|#define INFLATE_FAST_MIN_HAVE 15
  ------------------
  |  Branch (309:33): [True: 3.62k, False: 275]
  ------------------
  310|  3.89k|                                          : (INFLATE_FAST_MIN_HAVE - 1) - (in - last));
  ------------------
  |  |  137|    275|#define INFLATE_FAST_MIN_HAVE 15
  ------------------
  311|  3.89k|    strm->avail_out = (unsigned)(out < end ? (INFLATE_FAST_MIN_LEFT - 1) + (end - out)
  ------------------
  |  |  138|  3.85k|#define INFLATE_FAST_MIN_LEFT 260
  ------------------
  |  Branch (311:34): [True: 3.85k, False: 40]
  ------------------
  312|  3.89k|                                           : (INFLATE_FAST_MIN_LEFT - 1) - (out - end));
  ------------------
  |  |  138|     40|#define INFLATE_FAST_MIN_LEFT 260
  ------------------
  313|       |
  314|  3.89k|    Assert(bits <= 32, "Remaining bits greater than 32");
  315|  3.89k|    state->hold = (uint32_t)hold;
  316|  3.89k|    state->bits = bits;
  317|  3.89k|    return;
  318|  3.89k|}

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

chunkset_avx2.c:load_64_bits:
  141|   252k|static inline uint64_t load_64_bits(const unsigned char *in, unsigned bits) {
  142|   252k|    uint64_t chunk = zng_memread_8(in);
  143|       |
  144|   252k|#if BYTE_ORDER == LITTLE_ENDIAN
  145|   252k|    return chunk << bits;
  146|       |#else
  147|       |    return ZSWAP64(chunk) << bits;
  148|       |#endif
  149|   252k|}

zng_inflate_table:
   31|    827|                                code * *table, unsigned *bits, uint16_t *work) {
   32|    827|    unsigned len;               /* a code's length in bits */
   33|    827|    unsigned sym;               /* index of code symbols */
   34|    827|    unsigned min, max;          /* minimum and maximum code lengths */
   35|    827|    unsigned root;              /* number of index bits for root table */
   36|    827|    unsigned curr;              /* number of index bits for current table */
   37|    827|    unsigned drop;              /* code bits to drop for sub-table */
   38|    827|    int left;                   /* number of prefix codes available */
   39|    827|    unsigned used;              /* code entries in table used */
   40|    827|    unsigned huff;              /* Huffman code */
   41|    827|    unsigned incr;              /* for incrementing code, index */
   42|    827|    unsigned fill;              /* index for replicating entries */
   43|    827|    unsigned low;               /* low bits for current root entry */
   44|    827|    unsigned mask;              /* mask for low root bits */
   45|    827|    code here;                  /* table entry for duplication */
   46|    827|    code *next;                 /* next available space in table */
   47|    827|    const uint16_t *base;       /* base value table to use */
   48|    827|    const uint16_t *extra;      /* extra bits table to use */
   49|    827|    unsigned match;             /* use base and extra for symbol >= match */
   50|    827|    uint16_t count[MAX_BITS+1];  /* number of codes of each length */
   51|    827|    uint16_t offs[MAX_BITS+1];   /* offsets in table for each length */
   52|    827|    static const uint16_t lbase[31] = { /* Length codes 257..285 base */
   53|    827|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   54|    827|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   55|    827|    static const uint16_t lext[31] = { /* Length codes 257..285 extra */
   56|    827|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   57|    827|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77};
   58|    827|    static const uint16_t dbase[32] = { /* Distance codes 0..29 base */
   59|    827|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   60|    827|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   61|    827|        8193, 12289, 16385, 24577, 0, 0};
   62|    827|    static const uint16_t dext[32] = { /* Distance codes 0..29 extra */
   63|    827|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   64|    827|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   65|    827|        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|  14.0k|    for (len = 0; len <= MAX_BITS; len++)
  ------------------
  |  |   39|  14.0k|#define MAX_BITS 15
  ------------------
  |  Branch (99:19): [True: 13.2k, False: 827]
  ------------------
  100|  13.2k|        count[len] = 0;
  101|  91.4k|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (101:19): [True: 90.6k, False: 827]
  ------------------
  102|  90.6k|        count[lens[sym]]++;
  103|       |
  104|       |    /* bound code lengths, force root to be within code lengths */
  105|    827|    root = *bits;
  106|  6.30k|    for (max = MAX_BITS; max >= 1; max--)
  ------------------
  |  |   39|    827|#define MAX_BITS 15
  ------------------
  |  Branch (106:26): [True: 6.29k, False: 9]
  ------------------
  107|  6.29k|        if (count[max] != 0) break;
  ------------------
  |  Branch (107:13): [True: 818, False: 5.47k]
  ------------------
  108|    827|    root = MIN(root, max);
  ------------------
  |  |  124|    827|#define MIN(a, b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (124:20): [True: 195, False: 632]
  |  |  ------------------
  ------------------
  109|    827|    if (UNLIKELY(max == 0)) {           /* no symbols to code at all */
  ------------------
  |  |  214|    827|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 9, False: 818]
  |  |  ------------------
  ------------------
  110|      9|        here.op = (unsigned char)64;    /* invalid code marker */
  111|      9|        here.bits = (unsigned char)1;
  112|      9|        here.val = (uint16_t)0;
  113|      9|        *(*table)++ = here;             /* make a table to force an error */
  114|      9|        *(*table)++ = here;
  115|      9|        *bits = 1;
  116|      9|        return 0;     /* no symbols, but wait for decoding to report error */
  117|      9|    }
  118|  1.30k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (118:19): [True: 1.27k, False: 34]
  ------------------
  119|  1.27k|        if (count[min] != 0) break;
  ------------------
  |  Branch (119:13): [True: 784, False: 489]
  ------------------
  120|    818|    root = MAX(root, min);
  ------------------
  |  |  126|    818|#define MAX(a, b) ((a) < (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (126:20): [True: 4, False: 814]
  |  |  ------------------
  ------------------
  121|       |
  122|       |    /* check for an over-subscribed or incomplete set of lengths */
  123|    818|    left = 1;
  124|  12.2k|    for (len = 1; len <= MAX_BITS; len++) {
  ------------------
  |  |   39|  12.2k|#define MAX_BITS 15
  ------------------
  |  Branch (124:19): [True: 11.5k, False: 726]
  ------------------
  125|  11.5k|        left <<= 1;
  126|  11.5k|        left -= count[len];
  127|  11.5k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (127:13): [True: 92, False: 11.4k]
  ------------------
  128|  11.5k|    }
  129|    726|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (129:9): [True: 50, False: 676]
  |  Branch (129:22): [True: 10, False: 40]
  |  Branch (129:39): [True: 39, False: 1]
  ------------------
  130|     49|        return -1;                      /* incomplete set */
  131|       |
  132|       |    /* generate offsets into symbol table for each length for sorting */
  133|    677|    offs[1] = 0;
  134|  10.1k|    for (len = 1; len < MAX_BITS; len++)
  ------------------
  |  |   39|  10.1k|#define MAX_BITS 15
  ------------------
  |  Branch (134:19): [True: 9.47k, False: 677]
  ------------------
  135|  9.47k|        offs[len + 1] = offs[len] + count[len];
  136|       |
  137|       |    /* sort symbols by length, by symbol order within each length */
  138|  65.1k|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (138:19): [True: 64.4k, False: 677]
  ------------------
  139|  64.4k|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (uint16_t)sym;
  ------------------
  |  Branch (139:13): [True: 55.1k, False: 9.31k]
  ------------------
  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|    677|    switch (type) {
  174|    325|    case CODES:
  ------------------
  |  Branch (174:5): [True: 325, False: 352]
  ------------------
  175|    325|        base = extra = work;    /* dummy value--not used */
  176|    325|        match = 20;
  177|    325|        break;
  178|    187|    case LENS:
  ------------------
  |  Branch (178:5): [True: 187, False: 490]
  ------------------
  179|    187|        base = lbase;
  180|    187|        extra = lext;
  181|    187|        match = 257;
  182|    187|        break;
  183|    165|    default:    /* DISTS */
  ------------------
  |  Branch (183:5): [True: 165, False: 512]
  ------------------
  184|    165|        base = dbase;
  185|    165|        extra = dext;
  186|    165|        match = 0;
  187|    677|    }
  188|       |
  189|       |    /* initialize state for loop */
  190|    677|    huff = 0;                   /* starting code */
  191|    677|    sym = 0;                    /* starting code symbol */
  192|    677|    len = min;                  /* starting code length */
  193|    677|    next = *table;              /* current table to fill in */
  194|    677|    curr = root;                /* current table index bits */
  195|    677|    drop = 0;                   /* current bits to drop from code for index */
  196|    677|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  197|    677|    used = 1U << root;          /* use root table entries */
  198|    677|    mask = used - 1;            /* mask for comparing low */
  199|       |
  200|       |    /* check available table space */
  201|    677|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   52|    187|#define ENOUGH_LENS 1332
  ------------------
  |  Branch (201:10): [True: 187, False: 490]
  |  Branch (201:26): [True: 0, False: 187]
  ------------------
  202|    677|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|    165|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (202:10): [True: 165, False: 512]
  |  Branch (202:27): [True: 0, False: 165]
  ------------------
  203|      0|        return 1;
  204|       |
  205|       |    /* process all codes and make table entries */
  206|  55.1k|    for (;;) {
  207|       |        /* create table entry */
  208|  55.1k|        here.bits = (unsigned char)(len - drop);
  209|  55.1k|        if (LIKELY(work[sym] >= match)) {
  ------------------
  |  |  213|  55.1k|#  define LIKELY(x)             __builtin_expect(!!(x), 1)
  |  |  ------------------
  |  |  |  Branch (213:33): [True: 4.11k, False: 51.0k]
  |  |  ------------------
  ------------------
  210|  4.11k|            here.op = (unsigned char)(extra[work[sym] - match]);
  211|  4.11k|            here.val = base[work[sym] - match];
  212|  51.0k|        } else if (work[sym] + 1U < match) {
  ------------------
  |  Branch (212:20): [True: 50.8k, False: 187]
  ------------------
  213|  50.8k|            here.op = (unsigned char)0;
  214|  50.8k|            here.val = work[sym];
  215|  50.8k|        } else {
  216|    187|            here.op = (unsigned char)(32 + 64);         /* end of block */
  217|    187|            here.val = 0;
  218|    187|        }
  219|       |
  220|       |        /* replicate for those indices with low len bits equal to huff */
  221|  55.1k|        incr = 1U << (len - drop);
  222|  55.1k|        fill = 1U << curr;
  223|  55.1k|        min = fill;                 /* save offset to next table */
  224|   286k|        do {
  225|   286k|            fill -= incr;
  226|   286k|            next[(huff >> drop) + fill] = here;
  227|   286k|        } while (fill != 0);
  ------------------
  |  Branch (227:18): [True: 231k, False: 55.1k]
  ------------------
  228|       |
  229|       |        /* backwards increment the len-bit code huff */
  230|  55.1k|        incr = 1U << (len - 1);
  231|   109k|        while (huff & incr)
  ------------------
  |  Branch (231:16): [True: 54.4k, False: 55.1k]
  ------------------
  232|  54.4k|            incr >>= 1;
  233|  55.1k|        if (incr != 0) {
  ------------------
  |  Branch (233:13): [True: 54.4k, False: 676]
  ------------------
  234|  54.4k|            huff &= incr - 1;
  235|  54.4k|            huff += incr;
  236|  54.4k|        } else {
  237|    676|            huff = 0;
  238|    676|        }
  239|       |
  240|       |        /* go to next symbol, update count, len */
  241|  55.1k|        sym++;
  242|  55.1k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (242:13): [True: 3.78k, False: 51.3k]
  ------------------
  243|  3.78k|            if (len == max)
  ------------------
  |  Branch (243:17): [True: 677, False: 3.10k]
  ------------------
  244|    677|                break;
  245|  3.10k|            len = lens[work[sym]];
  246|  3.10k|        }
  247|       |
  248|       |        /* create new sub-table if needed */
  249|  54.4k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (249:13): [True: 6.52k, False: 47.9k]
  |  Branch (249:27): [True: 3.24k, False: 3.27k]
  ------------------
  250|       |            /* if first time, transition to sub-tables */
  251|  3.24k|            if (drop == 0)
  ------------------
  |  Branch (251:17): [True: 170, False: 3.07k]
  ------------------
  252|    170|                drop = root;
  253|       |
  254|       |            /* increment past last table */
  255|  3.24k|            next += min;            /* here min is 1 << curr */
  256|       |
  257|       |            /* determine length of next table */
  258|  3.24k|            curr = len - drop;
  259|  3.24k|            left = (int)(1 << curr);
  260|  3.26k|            while (curr + drop < max) {
  ------------------
  |  Branch (260:20): [True: 91, False: 3.17k]
  ------------------
  261|     91|                left -= count[curr + drop];
  262|     91|                if (left <= 0)
  ------------------
  |  Branch (262:21): [True: 70, False: 21]
  ------------------
  263|     70|                    break;
  264|     21|                curr++;
  265|     21|                left <<= 1;
  266|     21|            }
  267|       |
  268|       |            /* check for enough space */
  269|  3.24k|            used += 1U << curr;
  270|  3.24k|            if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   52|  3.09k|#define ENOUGH_LENS 1332
  ------------------
                          if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   53|    155|#define ENOUGH_DISTS 592
  ------------------
  |  Branch (270:18): [True: 3.09k, False: 155]
  |  Branch (270:34): [True: 0, False: 3.09k]
  |  Branch (270:58): [True: 155, False: 3.09k]
  |  Branch (270:75): [True: 0, False: 155]
  ------------------
  271|      0|                return 1;
  272|       |
  273|       |            /* point entry in root table to sub-table */
  274|  3.24k|            low = huff & mask;
  275|  3.24k|            (*table)[low].op = (unsigned char)curr;
  276|  3.24k|            (*table)[low].bits = (unsigned char)root;
  277|  3.24k|            (*table)[low].val = (uint16_t)(next - *table);
  278|  3.24k|        }
  279|  54.4k|    }
  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|    677|    if (UNLIKELY(huff != 0)) {
  ------------------
  |  |  214|    677|#  define UNLIKELY(x)           __builtin_expect(!!(x), 0)
  |  |  ------------------
  |  |  |  Branch (214:33): [True: 1, False: 676]
  |  |  ------------------
  ------------------
  285|      1|        here.op = (unsigned char)64;            /* invalid code marker */
  286|      1|        here.bits = (unsigned char)(len - drop);
  287|      1|        here.val = (uint16_t)0;
  288|      1|        next[huff] = here;
  289|      1|    }
  290|       |
  291|       |    /* set return parameters */
  292|    677|    *table += used;
  293|    677|    *bits = root;
  294|    677|    return 0;
  295|    677|}

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

chunkset_avx2.c:zng_memread_2:
   12|  3.66k|static inline uint16_t zng_memread_2(const void *ptr) {
   13|  3.66k|#if defined(HAVE_MAY_ALIAS)
   14|  3.66k|    typedef struct { uint16_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint16_t;
   15|  3.66k|    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|  3.66k|}
chunkset_avx2.c:zng_memread_4:
   23|  1.31k|static inline uint32_t zng_memread_4(const void *ptr) {
   24|  1.31k|#if defined(HAVE_MAY_ALIAS)
   25|  1.31k|    typedef struct { uint32_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint32_t;
   26|  1.31k|    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.31k|}
chunkset_avx2.c:zng_memread_8:
   34|   252k|static inline uint64_t zng_memread_8(const void *ptr) {
   35|   252k|#if defined(HAVE_MAY_ALIAS)
   36|   252k|    typedef struct { uint64_t val; } __attribute__ ((__packed__, __may_alias__)) unaligned_uint64_t;
   37|   252k|    return ((const unaligned_uint64_t *)ptr)->val;
   38|       |#else
   39|       |    uint64_t val;
   40|       |    memcpy(&val, ptr, sizeof(val));
   41|       |    return val;
   42|       |#endif
   43|   252k|}

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

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

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

zstd_decompress_block.c:ZSTD_highbit32:
  175|   352k|{
  176|   352k|    assert(val != 0);
  ------------------
  |  |   70|   352k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|   352k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|   352k|}
zstd_decompress_block.c:ZSTD_countLeadingZeros32:
   70|   352k|{
   71|   352k|    assert(val != 0);
  ------------------
  |  |   70|   352k|#    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|   352k|}
entropy_common.c:ZSTD_countTrailingZeros32:
   29|  8.50k|{
   30|  8.50k|    assert(val != 0);
  ------------------
  |  |   70|  8.50k|#    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|  8.50k|}
entropy_common.c:ZSTD_highbit32:
  175|  16.3k|{
  176|  16.3k|    assert(val != 0);
  ------------------
  |  |   70|  16.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  16.3k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  16.3k|}
entropy_common.c:ZSTD_countLeadingZeros32:
   70|  16.3k|{
   71|  16.3k|    assert(val != 0);
  ------------------
  |  |   70|  16.3k|#    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|  16.3k|}
fse_decompress.c:ZSTD_highbit32:
  175|  50.3k|{
  176|  50.3k|    assert(val != 0);
  ------------------
  |  |   70|  50.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  50.3k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  50.3k|}
fse_decompress.c:ZSTD_countLeadingZeros32:
   70|  50.3k|{
   71|  50.3k|    assert(val != 0);
  ------------------
  |  |   70|  50.3k|#    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|  50.3k|}
huf_decompress.c:ZSTD_highbit32:
  175|  1.55k|{
  176|  1.55k|    assert(val != 0);
  ------------------
  |  |   70|  1.55k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  177|  1.55k|    return 31 - ZSTD_countLeadingZeros32(val);
  178|  1.55k|}
huf_decompress.c:ZSTD_countLeadingZeros32:
   70|  1.55k|{
   71|  1.55k|    assert(val != 0);
  ------------------
  |  |   70|  1.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|  1.55k|}
huf_decompress.c:ZSTD_countTrailingZeros64:
   94|    485|{
   95|    485|    assert(val != 0);
  ------------------
  |  |   70|    485|#    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|    485|}

zstd_decompress_block.c:BIT_initDStream:
  255|  2.19k|{
  256|  2.19k|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|      3|# 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|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (256:9): [True: 3, False: 2.19k]
  ------------------
  257|       |
  258|  2.19k|    bitD->start = (const char*)srcBuffer;
  259|  2.19k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  2.19k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 2.12k, False: 71]
  ------------------
  262|  2.12k|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|  2.12k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|  2.12k|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|  2.12k|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 1.98k, False: 136]
  ------------------
  266|  2.12k|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|    136|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    136|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    136|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (266:15): [True: 136, False: 1.98k]
  ------------------
  267|  2.12k|    } else {
  268|     71|        bitD->ptr   = bitD->start;
  269|     71|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|     71|        switch(srcSize)
  271|     71|        {
  272|      9|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 9, False: 62]
  ------------------
  273|      9|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      9|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     16|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 7, False: 64]
  ------------------
  276|     16|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     16|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     27|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 11, False: 60]
  ------------------
  279|     27|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     27|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|     31|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 4, False: 67]
  ------------------
  282|     31|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     31|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|     45|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 14, False: 57]
  ------------------
  285|     45|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     45|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|     60|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 15, False: 56]
  ------------------
  288|     60|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     60|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|     71|        default: break;
  ------------------
  |  Branch (290:9): [True: 11, False: 60]
  ------------------
  291|     71|        }
  292|     71|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|     71|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 61, False: 10]
  ------------------
  294|     71|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   49|     10|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     10|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     10|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (294:17): [True: 10, False: 61]
  ------------------
  295|     71|        }
  296|     61|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|     61|    }
  298|       |
  299|  2.05k|    return srcSize;
  300|  2.19k|}
zstd_decompress_block.c:BIT_readBits:
  363|  7.49M|{
  364|  7.49M|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  7.49M|    BIT_skipBits(bitD, nbBits);
  366|  7.49M|    return value;
  367|  7.49M|}
zstd_decompress_block.c:BIT_lookBits:
  331|  7.49M|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  7.49M|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  7.49M|    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|  7.49M|}
zstd_decompress_block.c:BIT_getMiddleBits:
  308|  7.49M|{
  309|  7.49M|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  7.49M|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  7.49M|#    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|  7.49M|#if defined(__x86_64__) || defined(_M_X64)
  318|  7.49M|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  7.49M|}
zstd_decompress_block.c:BIT_skipBits:
  354|  8.86M|{
  355|  8.86M|    bitD->bitsConsumed += nbBits;
  356|  8.86M|}
zstd_decompress_block.c:BIT_reloadDStream:
  413|  2.50M|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  2.50M|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  196|  2.50M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 2.36M, False: 139k]
  |  |  ------------------
  ------------------
  416|  2.36M|        static const BitContainerType zeroFilled = 0;
  417|  2.36M|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|  2.36M|        return BIT_DStream_overflow;
  420|  2.36M|    }
  421|       |
  422|   139k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|   139k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|   139k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 118k, False: 20.3k]
  ------------------
  425|   118k|        return BIT_reloadDStream_internal(bitD);
  426|   118k|    }
  427|  20.3k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 10.9k, False: 9.43k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  10.9k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 10.6k, False: 251]
  ------------------
  430|    251|        return BIT_DStream_completed;
  431|  10.9k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  9.43k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  9.43k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  9.43k|        if (nbBytes > (size_t)(bitD->ptr - bitD->start)) {
  ------------------
  |  Branch (435:13): [True: 747, False: 8.69k]
  ------------------
  436|    747|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    747|            result = BIT_DStream_endOfBuffer;
  438|    747|        }
  439|  9.43k|        bitD->ptr -= nbBytes;
  440|  9.43k|        bitD->bitsConsumed -= nbBytes*8;
  441|  9.43k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  9.43k|        return result;
  443|  20.3k|    }
  444|  20.3k|}
zstd_decompress_block.c:BIT_reloadDStream_internal:
  385|   118k|{
  386|   118k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|   118k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|   118k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|   118k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|   118k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|   118k|    bitD->bitsConsumed &= 7;
  390|   118k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|   118k|    return BIT_DStream_unfinished;
  392|   118k|}
zstd_decompress_block.c:BIT_readBitsFast:
  372|  1.37M|{
  373|  1.37M|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  1.37M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.37M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  1.37M|    BIT_skipBits(bitD, nbBits);
  376|  1.37M|    return value;
  377|  1.37M|}
zstd_decompress_block.c:BIT_lookBitsFast:
  347|  1.37M|{
  348|  1.37M|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  1.37M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.37M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  1.37M|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  1.37M|}
zstd_decompress_block.c:BIT_endOfDStream:
  450|    679|{
  451|    679|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 644, False: 35]
  |  Branch (451:49): [True: 624, False: 20]
  ------------------
  452|    679|}
fse_decompress.c:BIT_initDStream:
  255|  1.03k|{
  256|  1.03k|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|      7|# 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|      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 (256:9): [True: 7, False: 1.03k]
  ------------------
  257|       |
  258|  1.03k|    bitD->start = (const char*)srcBuffer;
  259|  1.03k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  1.03k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 828, False: 203]
  ------------------
  262|    828|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|    828|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|    828|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|    828|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 770, False: 58]
  ------------------
  266|    828|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|     58|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     58|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     58|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (266:15): [True: 58, False: 770]
  ------------------
  267|    828|    } else {
  268|    203|        bitD->ptr   = bitD->start;
  269|    203|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|    203|        switch(srcSize)
  271|    203|        {
  272|      7|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 7, False: 196]
  ------------------
  273|      7|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|      7|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     18|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 11, False: 192]
  ------------------
  276|     18|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     18|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     84|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 66, False: 137]
  ------------------
  279|     84|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     84|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|    124|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 40, False: 163]
  ------------------
  282|    124|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|    124|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|    161|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 37, False: 166]
  ------------------
  285|    161|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|    161|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|    196|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 35, False: 168]
  ------------------
  288|    196|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|    196|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|    203|        default: break;
  ------------------
  |  Branch (290:9): [True: 7, False: 196]
  ------------------
  291|    203|        }
  292|    203|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|    203|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 196, False: 7]
  ------------------
  294|    203|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   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 (294:17): [True: 7, False: 196]
  ------------------
  295|    203|        }
  296|    196|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|    196|    }
  298|       |
  299|    966|    return srcSize;
  300|  1.03k|}
fse_decompress.c:BIT_readBits:
  363|  82.7k|{
  364|  82.7k|    BitContainerType const value = BIT_lookBits(bitD, nbBits);
  365|  82.7k|    BIT_skipBits(bitD, nbBits);
  366|  82.7k|    return value;
  367|  82.7k|}
fse_decompress.c:BIT_lookBits:
  331|  82.7k|{
  332|       |    /* arbitrate between double-shift and shift+mask */
  333|  82.7k|#if 1
  334|       |    /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
  335|       |     * bitstream is likely corrupted, and result is undefined */
  336|  82.7k|    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|  82.7k|}
fse_decompress.c:BIT_getMiddleBits:
  308|  82.7k|{
  309|  82.7k|    U32 const regMask = sizeof(bitContainer)*8 - 1;
  310|       |    /* if start > regMask, bitstream is corrupted, and result is undefined */
  311|  82.7k|    assert(nbBits < BIT_MASK_SIZE);
  ------------------
  |  |   70|  82.7k|#    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|  82.7k|#if defined(__x86_64__) || defined(_M_X64)
  318|  82.7k|    return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
  319|       |#else
  320|       |    return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
  321|       |#endif
  322|  82.7k|}
fse_decompress.c:BIT_skipBits:
  354|   102k|{
  355|   102k|    bitD->bitsConsumed += nbBits;
  356|   102k|}
fse_decompress.c:BIT_reloadDStream:
  413|  50.0k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  50.0k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  196|  50.0k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 946, False: 49.0k]
  |  |  ------------------
  ------------------
  416|    946|        static const BitContainerType zeroFilled = 0;
  417|    946|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|    946|        return BIT_DStream_overflow;
  420|    946|    }
  421|       |
  422|  49.0k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  49.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  49.0k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 13.3k, False: 35.7k]
  ------------------
  425|  13.3k|        return BIT_reloadDStream_internal(bitD);
  426|  13.3k|    }
  427|  35.7k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 28.6k, False: 7.05k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  28.6k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 27.7k, False: 907]
  ------------------
  430|    907|        return BIT_DStream_completed;
  431|  28.6k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  7.05k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  7.05k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  7.05k|        if (nbBytes > (size_t)(bitD->ptr - bitD->start)) {
  ------------------
  |  Branch (435:13): [True: 104, False: 6.94k]
  ------------------
  436|    104|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    104|            result = BIT_DStream_endOfBuffer;
  438|    104|        }
  439|  7.05k|        bitD->ptr -= nbBytes;
  440|  7.05k|        bitD->bitsConsumed -= nbBytes*8;
  441|  7.05k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  7.05k|        return result;
  443|  35.7k|    }
  444|  35.7k|}
fse_decompress.c:BIT_reloadDStream_internal:
  385|  13.3k|{
  386|  13.3k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  13.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  13.3k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  13.3k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  13.3k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  13.3k|    bitD->bitsConsumed &= 7;
  390|  13.3k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  13.3k|    return BIT_DStream_unfinished;
  392|  13.3k|}
fse_decompress.c:BIT_readBitsFast:
  372|  20.0k|{
  373|  20.0k|    BitContainerType const value = BIT_lookBitsFast(bitD, nbBits);
  374|  20.0k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  20.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  375|  20.0k|    BIT_skipBits(bitD, nbBits);
  376|  20.0k|    return value;
  377|  20.0k|}
fse_decompress.c:BIT_lookBitsFast:
  347|  20.0k|{
  348|  20.0k|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  20.0k|    assert(nbBits >= 1);
  ------------------
  |  |   70|  20.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  20.0k|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  20.0k|}
huf_decompress.c:BIT_initDStream:
  255|  1.12k|{
  256|  1.12k|    if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
  ------------------
  |  |   46|     14|# 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|     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 (256:9): [True: 14, False: 1.11k]
  ------------------
  257|       |
  258|  1.11k|    bitD->start = (const char*)srcBuffer;
  259|  1.11k|    bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
  260|       |
  261|  1.11k|    if (srcSize >=  sizeof(bitD->bitContainer)) {  /* normal case */
  ------------------
  |  Branch (261:9): [True: 869, False: 244]
  ------------------
  262|    869|        bitD->ptr   = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
  263|    869|        bitD->bitContainer = MEM_readLEST(bitD->ptr);
  264|    869|        { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  265|    869|          bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;  /* ensures bitsConsumed is always set */
  ------------------
  |  Branch (265:32): [True: 854, False: 15]
  ------------------
  266|    869|          if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
  ------------------
  |  |   49|     15|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     15|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     15|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (266:15): [True: 15, False: 854]
  ------------------
  267|    869|    } else {
  268|    244|        bitD->ptr   = bitD->start;
  269|    244|        bitD->bitContainer = *(const BYTE*)(bitD->start);
  270|    244|        switch(srcSize)
  271|    244|        {
  272|     21|        case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
  ------------------
  |  Branch (272:9): [True: 21, False: 223]
  ------------------
  273|     21|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     21|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  274|       |
  275|     48|        case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
  ------------------
  |  Branch (275:9): [True: 27, False: 217]
  ------------------
  276|     48|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     48|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  277|       |
  278|     72|        case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
  ------------------
  |  Branch (278:9): [True: 24, False: 220]
  ------------------
  279|     72|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     72|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  280|       |
  281|    109|        case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
  ------------------
  |  Branch (281:9): [True: 37, False: 207]
  ------------------
  282|    109|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|    109|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  283|       |
  284|    142|        case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
  ------------------
  |  Branch (284:9): [True: 33, False: 211]
  ------------------
  285|    142|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|    142|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  286|       |
  287|    180|        case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) <<  8;
  ------------------
  |  Branch (287:9): [True: 38, False: 206]
  ------------------
  288|    180|                ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|    180|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  289|       |
  290|    244|        default: break;
  ------------------
  |  Branch (290:9): [True: 64, False: 180]
  ------------------
  291|    244|        }
  292|    244|        {   BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
  293|    244|            bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (293:34): [True: 229, False: 15]
  ------------------
  294|    244|            if (lastByte == 0) return ERROR(corruption_detected);  /* endMark not present */
  ------------------
  |  |   49|     15|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     15|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     15|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (294:17): [True: 15, False: 229]
  ------------------
  295|    244|        }
  296|    229|        bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
  297|    229|    }
  298|       |
  299|  1.08k|    return srcSize;
  300|  1.11k|}
huf_decompress.c:BIT_reloadDStream:
  413|  60.1k|{
  414|       |    /* note : once in overflow mode, a bitstream remains in this mode until it's reset */
  415|  60.1k|    if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
  ------------------
  |  |  196|  60.1k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 89, False: 60.0k]
  |  |  ------------------
  ------------------
  416|     89|        static const BitContainerType zeroFilled = 0;
  417|     89|        bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
  418|       |        /* overflow detected, erroneous scenario or end of stream: no update */
  419|     89|        return BIT_DStream_overflow;
  420|     89|    }
  421|       |
  422|  60.0k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  60.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  423|       |
  424|  60.0k|    if (bitD->ptr >= bitD->limitPtr) {
  ------------------
  |  Branch (424:9): [True: 55.5k, False: 4.49k]
  ------------------
  425|  55.5k|        return BIT_reloadDStream_internal(bitD);
  426|  55.5k|    }
  427|  4.49k|    if (bitD->ptr == bitD->start) {
  ------------------
  |  Branch (427:9): [True: 1.05k, False: 3.44k]
  ------------------
  428|       |        /* reached end of bitStream => no update */
  429|  1.05k|        if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
  ------------------
  |  Branch (429:13): [True: 1.04k, False: 11]
  ------------------
  430|     11|        return BIT_DStream_completed;
  431|  1.05k|    }
  432|       |    /* start < ptr < limitPtr => cautious update */
  433|  3.44k|    {   U32 nbBytes = bitD->bitsConsumed >> 3;
  434|  3.44k|        BIT_DStream_status result = BIT_DStream_unfinished;
  435|  3.44k|        if (nbBytes > (size_t)(bitD->ptr - bitD->start)) {
  ------------------
  |  Branch (435:13): [True: 473, False: 2.96k]
  ------------------
  436|    473|            nbBytes = (U32)(bitD->ptr - bitD->start);  /* ptr > start */
  437|    473|            result = BIT_DStream_endOfBuffer;
  438|    473|        }
  439|  3.44k|        bitD->ptr -= nbBytes;
  440|  3.44k|        bitD->bitsConsumed -= nbBytes*8;
  441|  3.44k|        bitD->bitContainer = MEM_readLEST(bitD->ptr);   /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
  442|  3.44k|        return result;
  443|  4.49k|    }
  444|  4.49k|}
huf_decompress.c:BIT_reloadDStream_internal:
  385|  78.7k|{
  386|  78.7k|    assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
  ------------------
  |  |   70|  78.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  387|  78.7k|    bitD->ptr -= bitD->bitsConsumed >> 3;
  388|  78.7k|    assert(bitD->ptr >= bitD->start);
  ------------------
  |  |   70|  78.7k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  389|  78.7k|    bitD->bitsConsumed &= 7;
  390|  78.7k|    bitD->bitContainer = MEM_readLEST(bitD->ptr);
  391|  78.7k|    return BIT_DStream_unfinished;
  392|  78.7k|}
huf_decompress.c:BIT_lookBitsFast:
  347|  1.25M|{
  348|  1.25M|    U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
  349|  1.25M|    assert(nbBits >= 1);
  ------------------
  |  |   70|  1.25M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  350|  1.25M|    return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
  351|  1.25M|}
huf_decompress.c:BIT_skipBits:
  354|  1.25M|{
  355|  1.25M|    bitD->bitsConsumed += nbBits;
  356|  1.25M|}
huf_decompress.c:BIT_endOfDStream:
  450|  1.03k|{
  451|  1.03k|    return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
  ------------------
  |  Branch (451:13): [True: 740, False: 296]
  |  Branch (451:49): [True: 20, False: 720]
  ------------------
  452|  1.03k|}
huf_decompress.c:BIT_reloadDStreamFast:
  401|  23.5k|{
  402|  23.5k|    if (UNLIKELY(bitD->ptr < bitD->limitPtr))
  ------------------
  |  |  196|  23.5k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 356, False: 23.2k]
  |  |  ------------------
  ------------------
  403|    356|        return BIT_DStream_overflow;
  404|  23.2k|    return BIT_reloadDStream_internal(bitD);
  405|  23.5k|}

zstd_decompress_block.c:ZSTD_wrappedPtrDiff:
  375|  2.47k|{
  376|  2.47k|    return lhs - rhs;
  377|  2.47k|}
zstd_decompress_block.c:ZSTD_maybeNullPtrAdd:
  412|  4.37k|{
  413|  4.37k|    return add > 0 ? (char*)ptr + add : ptr;
  ------------------
  |  Branch (413:12): [True: 4.37k, False: 3]
  ------------------
  414|  4.37k|}
zstd_decompress_block.c:ZSTD_wrappedPtrSub:
  400|  1.07M|{
  401|  1.07M|    return (const char*)ptr - sub;
  402|  1.07M|}
zstd_decompress_block.c:ZSTD_wrappedPtrAdd:
  387|  2.14M|{
  388|  2.14M|    return (const char*)ptr + add;
  389|  2.14M|}
huf_decompress.c:ZSTD_maybeNullPtrAdd:
  412|  1.10k|{
  413|  1.10k|    return add > 0 ? (char*)ptr + add : ptr;
  ------------------
  |  Branch (413:12): [True: 1.09k, False: 2]
  ------------------
  414|  1.10k|}

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

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

zstd_common.c:ERR_isError:
   52|  6.89k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  6.89k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  6.89k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  6.89k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_common.c:ERR_getErrorCode:
   54|  3.49k|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: 420, False: 3.07k]
  ------------------
zstd_ddict.c:ERR_isError:
   52|  18.8k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  18.8k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  18.8k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  18.8k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress.c:ERR_isError:
   52|  32.5k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  32.5k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  32.5k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  32.5k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
zstd_decompress_block.c:ERR_isError:
   52|  2.50M|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  2.50M|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  2.50M|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  2.50M|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
entropy_common.c:ERR_isError:
   52|  1.44k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  1.44k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  1.44k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  1.44k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
fse_decompress.c:ERR_isError:
   52|  3.18k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  3.18k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  3.18k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  3.18k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
huf_decompress.c:ERR_isError:
   52|  4.10k|ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
  ------------------
  |  |   49|  4.10k|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|  4.10k|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  4.10k|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------

fse_decompress.c:FSE_initDState:
  518|  1.93k|{
  519|  1.93k|    const void* ptr = dt;
  520|  1.93k|    const FSE_DTableHeader* const DTableH = (const FSE_DTableHeader*)ptr;
  521|  1.93k|    DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog);
  522|  1.93k|    BIT_reloadDStream(bitD);
  523|  1.93k|    DStatePtr->table = dt + 1;
  524|  1.93k|}
fse_decompress.c:FSE_decodeSymbolFast:
  554|  20.0k|{
  555|  20.0k|    FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state];
  556|  20.0k|    U32 const nbBits = DInfo.nbBits;
  557|  20.0k|    BYTE const symbol = DInfo.symbol;
  558|  20.0k|    size_t const lowBits = BIT_readBitsFast(bitD, nbBits);
  559|       |
  560|  20.0k|    DStatePtr->state = DInfo.newState + lowBits;
  561|  20.0k|    return symbol;
  562|  20.0k|}
fse_decompress.c:FSE_decodeSymbol:
  541|  80.8k|{
  542|  80.8k|    FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state];
  543|  80.8k|    U32 const nbBits = DInfo.nbBits;
  544|  80.8k|    BYTE const symbol = DInfo.symbol;
  545|  80.8k|    size_t const lowBits = BIT_readBits(bitD, nbBits);
  546|       |
  547|  80.8k|    DStatePtr->state = DInfo.newState + lowBits;
  548|  80.8k|    return symbol;
  549|  80.8k|}

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

zstd_ddict.c:MEM_readLE32:
  322|  3.90k|{
  323|  3.90k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 3.90k, False: 0]
  ------------------
  324|  3.90k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  3.90k|}
zstd_ddict.c:MEM_isLittleEndian:
  141|  3.90k|{
  142|  3.90k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  3.90k|    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.90k|}
zstd_ddict.c:MEM_read32:
  183|  3.90k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE32:
  322|  7.66k|{
  323|  7.66k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 7.66k, False: 0]
  ------------------
  324|  7.66k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  7.66k|}
zstd_decompress.c:MEM_isLittleEndian:
  141|  8.68k|{
  142|  8.68k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  8.68k|    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.68k|}
zstd_decompress.c:MEM_read32:
  183|  7.66k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress.c:MEM_readLE16:
  290|    487|{
  291|    487|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 487, False: 0]
  ------------------
  292|    487|        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|    487|}
zstd_decompress.c:MEM_read16:
  182|    487|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress.c:MEM_readLE64:
  338|    537|{
  339|    537|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 537, False: 0]
  ------------------
  340|    537|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|    537|}
zstd_decompress.c:MEM_read64:
  184|    537|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
zstd_decompress_block.c:MEM_readLE24:
  311|  7.16k|{
  312|  7.16k|    return (U32)MEM_readLE16(memPtr) + ((U32)(((const BYTE*)memPtr)[2]) << 16);
  313|  7.16k|}
zstd_decompress_block.c:MEM_readLE32:
  322|    827|{
  323|    827|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 827, False: 0]
  ------------------
  324|    827|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|    827|}
zstd_decompress_block.c:MEM_isLittleEndian:
  141|   138k|{
  142|   138k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   138k|    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|   138k|}
zstd_decompress_block.c:MEM_read32:
  183|    827|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
zstd_decompress_block.c:MEM_write64:
  189|  41.5k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
zstd_decompress_block.c:MEM_readLE16:
  290|  7.56k|{
  291|  7.56k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 7.56k, False: 0]
  ------------------
  292|  7.56k|        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|  7.56k|}
zstd_decompress_block.c:MEM_read16:
  182|  7.56k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }
zstd_decompress_block.c:MEM_32bits:
  137|  11.6M|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
zstd_decompress_block.c:MEM_64bits:
  138|  2.49M|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
zstd_decompress_block.c:MEM_readLEST:
  354|   130k|{
  355|   130k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 130k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|   130k|    else
  358|   130k|        return (size_t)MEM_readLE64(memPtr);
  359|   130k|}
zstd_decompress_block.c:MEM_readLE64:
  338|   130k|{
  339|   130k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 130k, False: 0]
  ------------------
  340|   130k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|   130k|}
zstd_decompress_block.c:MEM_read64:
  184|   130k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
entropy_common.c:MEM_readLE32:
  322|  58.7k|{
  323|  58.7k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (323:9): [True: 58.7k, False: 0]
  ------------------
  324|  58.7k|        return MEM_read32(memPtr);
  325|      0|    else
  326|      0|        return MEM_swap32(MEM_read32(memPtr));
  327|  58.7k|}
entropy_common.c:MEM_isLittleEndian:
  141|  58.7k|{
  142|  58.7k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  58.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|  58.7k|}
entropy_common.c:MEM_read32:
  183|  58.7k|MEM_STATIC U32 MEM_read32(const void* ptr) { return *(const unalign32*)ptr; }
fse_decompress.c:MEM_write64:
  189|  1.73k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
fse_decompress.c:MEM_readLEST:
  354|  21.1k|{
  355|  21.1k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 21.1k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  21.1k|    else
  358|  21.1k|        return (size_t)MEM_readLE64(memPtr);
  359|  21.1k|}
fse_decompress.c:MEM_32bits:
  137|  21.1k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
fse_decompress.c:MEM_isLittleEndian:
  141|  21.1k|{
  142|  21.1k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|  21.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|  21.1k|}
fse_decompress.c:MEM_readLE64:
  338|  21.1k|{
  339|  21.1k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 21.1k, False: 0]
  ------------------
  340|  21.1k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  21.1k|}
fse_decompress.c:MEM_read64:
  184|  21.1k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_isLittleEndian:
  141|   301k|{
  142|   301k|#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  143|   301k|    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|   301k|}
huf_decompress.c:MEM_write64:
  189|   180k|MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(unalign64*)memPtr = value; }
huf_decompress.c:MEM_readLEST:
  354|  84.1k|{
  355|  84.1k|    if (MEM_32bits())
  ------------------
  |  Branch (355:9): [True: 0, False: 84.1k]
  ------------------
  356|      0|        return (size_t)MEM_readLE32(memPtr);
  357|  84.1k|    else
  358|  84.1k|        return (size_t)MEM_readLE64(memPtr);
  359|  84.1k|}
huf_decompress.c:MEM_32bits:
  137|  85.2k|MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; }
huf_decompress.c:MEM_readLE64:
  338|  84.1k|{
  339|  84.1k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (339:9): [True: 84.1k, False: 0]
  ------------------
  340|  84.1k|        return MEM_read64(memPtr);
  341|      0|    else
  342|      0|        return MEM_swap64(MEM_read64(memPtr));
  343|  84.1k|}
huf_decompress.c:MEM_read64:
  184|  84.1k|MEM_STATIC U64 MEM_read64(const void* ptr) { return *(const unalign64*)ptr; }
huf_decompress.c:MEM_64bits:
  138|   182k|MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; }
huf_decompress.c:MEM_readLE16:
  290|  1.96k|{
  291|  1.96k|    if (MEM_isLittleEndian())
  ------------------
  |  Branch (291:9): [True: 1.96k, False: 0]
  ------------------
  292|  1.96k|        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.96k|}
huf_decompress.c:MEM_read16:
  182|  1.96k|MEM_STATIC U16 MEM_read16(const void* ptr) { return *(const unalign16*)ptr; }

ZSTD_XXH64_reset:
 3561|    630|{
 3562|    630|    XXH_ASSERT(statePtr != NULL);
  ------------------
  |  | 2430|    630|#    define XXH_ASSERT(c)   XXH_ASSUME(c)
  |  |  ------------------
  |  |  |  | 2707|    630|#  define XXH_ASSUME(c) __builtin_assume(c)
  |  |  ------------------
  ------------------
 3563|    630|    memset(statePtr, 0, sizeof(*statePtr));
 3564|    630|    statePtr->v[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2;
  ------------------
  |  | 3361|    630|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
                  statePtr->v[0] = seed + XXH_PRIME64_1 + XXH_PRIME64_2;
  ------------------
  |  | 3362|    630|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3565|    630|    statePtr->v[1] = seed + XXH_PRIME64_2;
  ------------------
  |  | 3362|    630|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3566|    630|    statePtr->v[2] = seed + 0;
 3567|    630|    statePtr->v[3] = seed - XXH_PRIME64_1;
  ------------------
  |  | 3361|    630|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
 3568|    630|    return XXH_OK;
 3569|    630|}
ZSTD_XXH64_update:
 3574|  1.26k|{
 3575|  1.26k|    if (input==NULL) {
  ------------------
  |  Branch (3575:9): [True: 0, False: 1.26k]
  ------------------
 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|  1.26k|    {   const xxh_u8* p = (const xxh_u8*)input;
 3581|  1.26k|        const xxh_u8* const bEnd = p + len;
 3582|       |
 3583|  1.26k|        state->total_len += len;
 3584|       |
 3585|  1.26k|        if (state->memsize + len < 32) {  /* fill in tmp buffer */
  ------------------
  |  Branch (3585:13): [True: 904, False: 361]
  ------------------
 3586|    904|            XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, len);
 3587|    904|            state->memsize += (xxh_u32)len;
 3588|    904|            return XXH_OK;
 3589|    904|        }
 3590|       |
 3591|    361|        if (state->memsize) {   /* tmp buffer is full */
  ------------------
  |  Branch (3591:13): [True: 145, False: 216]
  ------------------
 3592|    145|            XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize);
 3593|    145|            state->v[0] = XXH64_round(state->v[0], XXH_readLE64(state->mem64+0));
 3594|    145|            state->v[1] = XXH64_round(state->v[1], XXH_readLE64(state->mem64+1));
 3595|    145|            state->v[2] = XXH64_round(state->v[2], XXH_readLE64(state->mem64+2));
 3596|    145|            state->v[3] = XXH64_round(state->v[3], XXH_readLE64(state->mem64+3));
 3597|    145|            p += 32 - state->memsize;
 3598|    145|            state->memsize = 0;
 3599|    145|        }
 3600|       |
 3601|    361|        if (p+32 <= bEnd) {
  ------------------
  |  Branch (3601:13): [True: 305, False: 56]
  ------------------
 3602|    305|            const xxh_u8* const limit = bEnd - 32;
 3603|       |
 3604|  81.5k|            do {
 3605|  81.5k|                state->v[0] = XXH64_round(state->v[0], XXH_readLE64(p)); p+=8;
 3606|  81.5k|                state->v[1] = XXH64_round(state->v[1], XXH_readLE64(p)); p+=8;
 3607|  81.5k|                state->v[2] = XXH64_round(state->v[2], XXH_readLE64(p)); p+=8;
 3608|  81.5k|                state->v[3] = XXH64_round(state->v[3], XXH_readLE64(p)); p+=8;
 3609|  81.5k|            } while (p<=limit);
  ------------------
  |  Branch (3609:22): [True: 81.2k, False: 305]
  ------------------
 3610|       |
 3611|    305|        }
 3612|       |
 3613|    361|        if (p < bEnd) {
  ------------------
  |  Branch (3613:13): [True: 293, False: 68]
  ------------------
 3614|    293|            XXH_memcpy(state->mem64, p, (size_t)(bEnd-p));
 3615|    293|            state->memsize = (unsigned)(bEnd-p);
 3616|    293|        }
 3617|    361|    }
 3618|       |
 3619|      0|    return XXH_OK;
 3620|  1.26k|}
ZSTD_XXH64_digest:
 3625|     35|{
 3626|     35|    xxh_u64 h64;
 3627|       |
 3628|     35|    if (state->total_len >= 32) {
  ------------------
  |  Branch (3628:9): [True: 23, False: 12]
  ------------------
 3629|     23|        h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18);
  ------------------
  |  | 2728|     23|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18);
  ------------------
  |  | 2728|     23|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18);
  ------------------
  |  | 2728|     23|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      h64 = XXH_rotl64(state->v[0], 1) + XXH_rotl64(state->v[1], 7) + XXH_rotl64(state->v[2], 12) + XXH_rotl64(state->v[3], 18);
  ------------------
  |  | 2728|     23|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
 3630|     23|        h64 = XXH64_mergeRound(h64, state->v[0]);
 3631|     23|        h64 = XXH64_mergeRound(h64, state->v[1]);
 3632|     23|        h64 = XXH64_mergeRound(h64, state->v[2]);
 3633|     23|        h64 = XXH64_mergeRound(h64, state->v[3]);
 3634|     23|    } else {
 3635|     12|        h64  = state->v[2] /*seed*/ + XXH_PRIME64_5;
  ------------------
  |  | 3365|     12|#define XXH_PRIME64_5  0x27D4EB2F165667C5ULL  /*!< 0b0010011111010100111010110010111100010110010101100110011111000101 */
  ------------------
 3636|     12|    }
 3637|       |
 3638|     35|    h64 += (xxh_u64) state->total_len;
 3639|       |
 3640|     35|    return XXH64_finalize(h64, (const xxh_u8*)state->mem64, (size_t)state->total_len, XXH_aligned);
 3641|     35|}
xxhash.c:XXH_readLE32_align:
 2813|     11|{
 2814|     11|    if (align==XXH_unaligned) {
  ------------------
  |  Branch (2814:9): [True: 0, False: 11]
  ------------------
 2815|      0|        return XXH_readLE32(ptr);
 2816|     11|    } else {
 2817|     11|        return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u32*)ptr : XXH_swap32(*(const xxh_u32*)ptr);
  ------------------
  |  | 2629|     11|#    define XXH_CPU_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (2629:35): [True: 11, Folded]
  |  |  ------------------
  ------------------
 2818|     11|    }
 2819|     11|}
xxhash.c:XXH_memcpy:
 2359|  1.34k|{
 2360|  1.34k|    return memcpy(dest,src,size);
 2361|  1.34k|}
xxhash.c:XXH_readLE64_align:
 3343|     42|{
 3344|     42|    if (align==XXH_unaligned)
  ------------------
  |  Branch (3344:9): [True: 0, False: 42]
  ------------------
 3345|      0|        return XXH_readLE64(ptr);
 3346|     42|    else
 3347|     42|        return XXH_CPU_LITTLE_ENDIAN ? *(const xxh_u64*)ptr : XXH_swap64(*(const xxh_u64*)ptr);
  ------------------
  |  | 2629|     42|#    define XXH_CPU_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (2629:35): [True: 42, Folded]
  |  |  ------------------
  ------------------
 3348|     42|}
xxhash.c:XXH64_round:
 3377|   327k|{
 3378|   327k|    acc += input * XXH_PRIME64_2;
  ------------------
  |  | 3362|   327k|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3379|   327k|    acc  = XXH_rotl64(acc, 31);
  ------------------
  |  | 2728|   327k|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
 3380|   327k|    acc *= XXH_PRIME64_1;
  ------------------
  |  | 3361|   327k|#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|   327k|    return acc;
 3399|   327k|}
xxhash.c:XXH_readLE64:
 3331|   326k|{
 3332|   326k|    return XXH_CPU_LITTLE_ENDIAN ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr));
  ------------------
  |  | 2629|   326k|#    define XXH_CPU_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (2629:35): [True: 326k, Folded]
  |  |  ------------------
  ------------------
 3333|   326k|}
xxhash.c:XXH_read64:
 3261|   326k|{
 3262|   326k|    typedef __attribute__((aligned(1))) xxh_u64 xxh_unalign64;
 3263|   326k|    return *((const xxh_unalign64*)ptr);
 3264|   326k|}
xxhash.c:XXH64_mergeRound:
 3402|     92|{
 3403|     92|    val  = XXH64_round(0, val);
 3404|     92|    acc ^= val;
 3405|     92|    acc  = acc * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 3361|     92|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
                  acc  = acc * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 3364|     92|#define XXH_PRIME64_4  0x85EBCA77C2B2AE63ULL  /*!< 0b1000010111101011110010100111011111000010101100101010111001100011 */
  ------------------
 3406|     92|    return acc;
 3407|     92|}
xxhash.c:XXH64_finalize:
 3440|     35|{
 3441|     35|    if (ptr==NULL) XXH_ASSERT(len == 0);
  ------------------
  |  | 2430|      0|#    define XXH_ASSERT(c)   XXH_ASSUME(c)
  |  |  ------------------
  |  |  |  | 2707|      0|#  define XXH_ASSUME(c) __builtin_assume(c)
  |  |  ------------------
  ------------------
  |  Branch (3441:9): [True: 0, False: 35]
  ------------------
 3442|     35|    len &= 31;
 3443|     77|    while (len >= 8) {
  ------------------
  |  Branch (3443:12): [True: 42, False: 35]
  ------------------
 3444|     42|        xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr));
  ------------------
  |  | 3421|     42|#define XXH_get64bits(p) XXH_readLE64_align(p, align)
  ------------------
 3445|     42|        ptr += 8;
 3446|     42|        hash ^= k1;
 3447|     42|        hash  = XXH_rotl64(hash,27) * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 2728|     42|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      hash  = XXH_rotl64(hash,27) * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 3361|     42|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
                      hash  = XXH_rotl64(hash,27) * XXH_PRIME64_1 + XXH_PRIME64_4;
  ------------------
  |  | 3364|     42|#define XXH_PRIME64_4  0x85EBCA77C2B2AE63ULL  /*!< 0b1000010111101011110010100111011111000010101100101010111001100011 */
  ------------------
 3448|     42|        len -= 8;
 3449|     42|    }
 3450|     35|    if (len >= 4) {
  ------------------
  |  Branch (3450:9): [True: 11, False: 24]
  ------------------
 3451|     11|        hash ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1;
  ------------------
  |  | 2933|     11|#define XXH_get32bits(p) XXH_readLE32_align(p, align)
  ------------------
                      hash ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1;
  ------------------
  |  | 3361|     11|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
 3452|     11|        ptr += 4;
 3453|     11|        hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3;
  ------------------
  |  | 2728|     11|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3;
  ------------------
  |  | 3362|     11|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
                      hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3;
  ------------------
  |  | 3363|     11|#define XXH_PRIME64_3  0x165667B19E3779F9ULL  /*!< 0b0001011001010110011001111011000110011110001101110111100111111001 */
  ------------------
 3454|     11|        len -= 4;
 3455|     11|    }
 3456|     72|    while (len > 0) {
  ------------------
  |  Branch (3456:12): [True: 37, False: 35]
  ------------------
 3457|     37|        hash ^= (*ptr++) * XXH_PRIME64_5;
  ------------------
  |  | 3365|     37|#define XXH_PRIME64_5  0x27D4EB2F165667C5ULL  /*!< 0b0010011111010100111010110010111100010110010101100110011111000101 */
  ------------------
 3458|     37|        hash = XXH_rotl64(hash, 11) * XXH_PRIME64_1;
  ------------------
  |  | 2728|     37|#  define XXH_rotl64 __builtin_rotateleft64
  ------------------
                      hash = XXH_rotl64(hash, 11) * XXH_PRIME64_1;
  ------------------
  |  | 3361|     37|#define XXH_PRIME64_1  0x9E3779B185EBCA87ULL  /*!< 0b1001111000110111011110011011000110000101111010111100101010000111 */
  ------------------
 3459|     37|        --len;
 3460|     37|    }
 3461|     35|    return  XXH64_avalanche(hash);
 3462|     35|}
xxhash.c:XXH64_avalanche:
 3411|     35|{
 3412|     35|    hash ^= hash >> 33;
 3413|     35|    hash *= XXH_PRIME64_2;
  ------------------
  |  | 3362|     35|#define XXH_PRIME64_2  0xC2B2AE3D27D4EB4FULL  /*!< 0b1100001010110010101011100011110100100111110101001110101101001111 */
  ------------------
 3414|     35|    hash ^= hash >> 29;
 3415|     35|    hash *= XXH_PRIME64_3;
  ------------------
  |  | 3363|     35|#define XXH_PRIME64_3  0x165667B19E3779F9ULL  /*!< 0b0001011001010110011001111011000110011110001101110111100111111001 */
  ------------------
 3416|     35|    hash ^= hash >> 32;
 3417|     35|    return hash;
 3418|     35|}

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

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

HUF_readDTableX1_wksp:
  390|    508|{
  391|    508|    U32 tableLog = 0;
  392|    508|    U32 nbSymbols = 0;
  393|    508|    size_t iSize;
  394|    508|    void* const dtPtr = DTable + 1;
  395|    508|    HUF_DEltX1* const dt = (HUF_DEltX1*)dtPtr;
  396|    508|    HUF_ReadDTableX1_Workspace* wksp = (HUF_ReadDTableX1_Workspace*)workSpace;
  397|       |
  398|    508|    DEBUG_STATIC_ASSERT(HUF_DECOMPRESS_WORKSPACE_SIZE >= sizeof(*wksp));
  ------------------
  |  |   39|    508|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  399|    508|    if (sizeof(*wksp) > wkspSize) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (399:9): [True: 0, False: 508]
  ------------------
  400|       |
  401|    508|    DEBUG_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUF_DTable));
  ------------------
  |  |   39|    508|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  402|       |    /* ZSTD_memset(huffWeight, 0, sizeof(huffWeight)); */   /* is not necessary, even though some analyzer complain ... */
  403|       |
  404|    508|    iSize = HUF_readStats_wksp(wksp->huffWeight, HUF_SYMBOLVALUE_MAX + 1, wksp->rankVal, &nbSymbols, &tableLog, src, srcSize, wksp->statsWksp, sizeof(wksp->statsWksp), flags);
  ------------------
  |  |   39|    508|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
  405|    508|    if (HUF_isError(iSize)) return iSize;
  ------------------
  |  |   80|    508|#define HUF_isError ERR_isError
  ------------------
  |  Branch (405:9): [True: 202, False: 306]
  ------------------
  406|       |
  407|       |
  408|       |    /* Table header */
  409|    306|    {   DTableDesc dtd = HUF_getDTableDesc(DTable);
  410|    306|        U32 const maxTableLog = dtd.maxTableLog + 1;
  411|    306|        U32 const targetTableLog = MIN(maxTableLog, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   54|    306|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 306]
  |  |  ------------------
  ------------------
  412|    306|        tableLog = HUF_rescaleStats(wksp->huffWeight, wksp->rankVal, nbSymbols, tableLog, targetTableLog);
  413|    306|        if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge);   /* DTable too small, Huffman tree cannot fit in */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (413:13): [True: 0, False: 306]
  ------------------
  414|    306|        dtd.tableType = 0;
  415|    306|        dtd.tableLog = (BYTE)tableLog;
  416|    306|        ZSTD_memcpy(DTable, &dtd, sizeof(dtd));
  ------------------
  |  |   44|    306|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  417|    306|    }
  418|       |
  419|       |    /* Compute symbols and rankStart given rankVal:
  420|       |     *
  421|       |     * rankVal already contains the number of values of each weight.
  422|       |     *
  423|       |     * symbols contains the symbols ordered by weight. First are the rankVal[0]
  424|       |     * weight 0 symbols, followed by the rankVal[1] weight 1 symbols, and so on.
  425|       |     * symbols[0] is filled (but unused) to avoid a branch.
  426|       |     *
  427|       |     * rankStart contains the offset where each rank belongs in the DTable.
  428|       |     * rankStart[0] is not filled because there are no entries in the table for
  429|       |     * weight 0.
  430|       |     */
  431|      0|    {   int n;
  432|    306|        U32 nextRankStart = 0;
  433|    306|        int const unroll = 4;
  434|    306|        int const nLimit = (int)nbSymbols - unroll + 1;
  435|  4.03k|        for (n=0; n<(int)tableLog+1; n++) {
  ------------------
  |  Branch (435:19): [True: 3.72k, False: 306]
  ------------------
  436|  3.72k|            U32 const curr = nextRankStart;
  437|  3.72k|            nextRankStart += wksp->rankVal[n];
  438|  3.72k|            wksp->rankStart[n] = curr;
  439|  3.72k|        }
  440|  7.16k|        for (n=0; n < nLimit; n += unroll) {
  ------------------
  |  Branch (440:19): [True: 6.85k, False: 306]
  ------------------
  441|  6.85k|            int u;
  442|  34.2k|            for (u=0; u < unroll; ++u) {
  ------------------
  |  Branch (442:23): [True: 27.4k, False: 6.85k]
  ------------------
  443|  27.4k|                size_t const w = wksp->huffWeight[n+u];
  444|  27.4k|                wksp->symbols[wksp->rankStart[w]++] = (BYTE)(n+u);
  445|  27.4k|            }
  446|  6.85k|        }
  447|    770|        for (; n < (int)nbSymbols; ++n) {
  ------------------
  |  Branch (447:16): [True: 464, False: 306]
  ------------------
  448|    464|            size_t const w = wksp->huffWeight[n];
  449|    464|            wksp->symbols[wksp->rankStart[w]++] = (BYTE)n;
  450|    464|        }
  451|    306|    }
  452|       |
  453|       |    /* fill DTable
  454|       |     * We fill all entries of each weight in order.
  455|       |     * That way length is a constant for each iteration of the outer loop.
  456|       |     * We can switch based on the length to a different inner loop which is
  457|       |     * optimized for that particular case.
  458|       |     */
  459|    306|    {   U32 w;
  460|    306|        int symbol = wksp->rankVal[0];
  461|    306|        int rankStart = 0;
  462|  3.72k|        for (w=1; w<tableLog+1; ++w) {
  ------------------
  |  Branch (462:19): [True: 3.41k, False: 306]
  ------------------
  463|  3.41k|            int const symbolCount = wksp->rankVal[w];
  464|  3.41k|            int const length = (1 << w) >> 1;
  465|  3.41k|            int uStart = rankStart;
  466|  3.41k|            BYTE const nbBits = (BYTE)(tableLog + 1 - w);
  467|  3.41k|            int s;
  468|  3.41k|            int u;
  469|  3.41k|            switch (length) {
  470|    306|            case 1:
  ------------------
  |  Branch (470:13): [True: 306, False: 3.11k]
  ------------------
  471|  6.87k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (471:27): [True: 6.56k, False: 306]
  ------------------
  472|  6.56k|                    HUF_DEltX1 D;
  473|  6.56k|                    D.byte = wksp->symbols[symbol + s];
  474|  6.56k|                    D.nbBits = nbBits;
  475|  6.56k|                    dt[uStart] = D;
  476|  6.56k|                    uStart += 1;
  477|  6.56k|                }
  478|    306|                break;
  479|    306|            case 2:
  ------------------
  |  Branch (479:13): [True: 306, False: 3.11k]
  ------------------
  480|  3.42k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (480:27): [True: 3.12k, False: 306]
  ------------------
  481|  3.12k|                    HUF_DEltX1 D;
  482|  3.12k|                    D.byte = wksp->symbols[symbol + s];
  483|  3.12k|                    D.nbBits = nbBits;
  484|  3.12k|                    dt[uStart+0] = D;
  485|  3.12k|                    dt[uStart+1] = D;
  486|  3.12k|                    uStart += 2;
  487|  3.12k|                }
  488|    306|                break;
  489|    306|            case 4:
  ------------------
  |  Branch (489:13): [True: 306, False: 3.11k]
  ------------------
  490|  2.41k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (490:27): [True: 2.10k, False: 306]
  ------------------
  491|  2.10k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  492|  2.10k|                    MEM_write64(dt + uStart, D4);
  493|  2.10k|                    uStart += 4;
  494|  2.10k|                }
  495|    306|                break;
  496|    306|            case 8:
  ------------------
  |  Branch (496:13): [True: 306, False: 3.11k]
  ------------------
  497|  2.30k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (497:27): [True: 2.00k, False: 306]
  ------------------
  498|  2.00k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  499|  2.00k|                    MEM_write64(dt + uStart, D4);
  500|  2.00k|                    MEM_write64(dt + uStart + 4, D4);
  501|  2.00k|                    uStart += 8;
  502|  2.00k|                }
  503|    306|                break;
  504|  2.19k|            default:
  ------------------
  |  Branch (504:13): [True: 2.19k, False: 1.22k]
  ------------------
  505|  8.10k|                for (s=0; s<symbolCount; ++s) {
  ------------------
  |  Branch (505:27): [True: 5.91k, False: 2.19k]
  ------------------
  506|  5.91k|                    U64 const D4 = HUF_DEltX1_set4(wksp->symbols[symbol + s], nbBits);
  507|  49.5k|                    for (u=0; u < length; u += 16) {
  ------------------
  |  Branch (507:31): [True: 43.6k, False: 5.91k]
  ------------------
  508|  43.6k|                        MEM_write64(dt + uStart + u + 0, D4);
  509|  43.6k|                        MEM_write64(dt + uStart + u + 4, D4);
  510|  43.6k|                        MEM_write64(dt + uStart + u + 8, D4);
  511|  43.6k|                        MEM_write64(dt + uStart + u + 12, D4);
  512|  43.6k|                    }
  513|  5.91k|                    assert(u == length);
  ------------------
  |  |   70|  5.91k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  514|  5.91k|                    uStart += length;
  515|  5.91k|                }
  516|  2.19k|                break;
  517|  3.41k|            }
  518|  3.41k|            symbol += symbolCount;
  519|  3.41k|            rankStart += symbolCount * length;
  520|  3.41k|        }
  521|    306|    }
  522|    306|    return iSize;
  523|    306|}
HUF_readDTableX2_wksp:
 1186|    661|{
 1187|    661|    U32 tableLog, maxW, nbSymbols;
 1188|    661|    DTableDesc dtd = HUF_getDTableDesc(DTable);
 1189|    661|    U32 maxTableLog = dtd.maxTableLog;
 1190|    661|    size_t iSize;
 1191|    661|    void* dtPtr = DTable+1;   /* force compiler to avoid strict-aliasing */
 1192|    661|    HUF_DEltX2* const dt = (HUF_DEltX2*)dtPtr;
 1193|    661|    U32 *rankStart;
 1194|       |
 1195|    661|    HUF_ReadDTableX2_Workspace* const wksp = (HUF_ReadDTableX2_Workspace*)workSpace;
 1196|       |
 1197|    661|    if (sizeof(*wksp) > wkspSize) 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 (1197:9): [True: 0, False: 661]
  ------------------
 1198|       |
 1199|    661|    rankStart = wksp->rankStart0 + 1;
 1200|    661|    ZSTD_memset(wksp->rankStats, 0, sizeof(wksp->rankStats));
  ------------------
  |  |   46|    661|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 1201|    661|    ZSTD_memset(wksp->rankStart0, 0, sizeof(wksp->rankStart0));
  ------------------
  |  |   46|    661|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
 1202|       |
 1203|    661|    DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(HUF_DTable));   /* if compiler fails here, assertion is wrong */
  ------------------
  |  |   39|    661|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
 1204|    661|    if (maxTableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge);
  ------------------
  |  |   37|    661|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  ------------------
                  if (maxTableLog > 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 (1204:9): [True: 0, False: 661]
  ------------------
 1205|       |    /* ZSTD_memset(weightList, 0, sizeof(weightList)); */  /* is not necessary, even though some analyzer complain ... */
 1206|       |
 1207|    661|    iSize = HUF_readStats_wksp(wksp->weightList, HUF_SYMBOLVALUE_MAX + 1, wksp->rankStats, &nbSymbols, &tableLog, src, srcSize, wksp->calleeWksp, sizeof(wksp->calleeWksp), flags);
  ------------------
  |  |   39|    661|#define HUF_SYMBOLVALUE_MAX  255
  ------------------
 1208|    661|    if (HUF_isError(iSize)) return iSize;
  ------------------
  |  |   80|    661|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1208:9): [True: 121, False: 540]
  ------------------
 1209|       |
 1210|       |    /* check result */
 1211|    540|    if (tableLog > maxTableLog) return ERROR(tableLog_tooLarge);   /* DTable can't fit code depth */
  ------------------
  |  |   49|      0|#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 (1211:9): [True: 0, False: 540]
  ------------------
 1212|    540|    if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
  ------------------
  |  |   33|  1.08k|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
                  if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
  ------------------
  |  |   33|    417|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
                  if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
  ------------------
  |  |   33|    417|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
  |  Branch (1212:9): [True: 417, False: 123]
  |  Branch (1212:50): [True: 417, False: 0]
  ------------------
 1213|       |
 1214|       |    /* find maxWeight */
 1215|  1.13k|    for (maxW = tableLog; wksp->rankStats[maxW]==0; maxW--) {}  /* necessarily finds a solution before 0 */
  ------------------
  |  Branch (1215:27): [True: 596, False: 540]
  ------------------
 1216|       |
 1217|       |    /* Get start index of each weight */
 1218|    540|    {   U32 w, nextRankStart = 0;
 1219|  4.65k|        for (w=1; w<maxW+1; w++) {
  ------------------
  |  Branch (1219:19): [True: 4.11k, False: 540]
  ------------------
 1220|  4.11k|            U32 curr = nextRankStart;
 1221|  4.11k|            nextRankStart += wksp->rankStats[w];
 1222|  4.11k|            rankStart[w] = curr;
 1223|  4.11k|        }
 1224|    540|        rankStart[0] = nextRankStart;   /* put all 0w symbols at the end of sorted list*/
 1225|    540|        rankStart[maxW+1] = nextRankStart;
 1226|    540|    }
 1227|       |
 1228|       |    /* sort symbols by weight */
 1229|    540|    {   U32 s;
 1230|  60.8k|        for (s=0; s<nbSymbols; s++) {
  ------------------
  |  Branch (1230:19): [True: 60.3k, False: 540]
  ------------------
 1231|  60.3k|            U32 const w = wksp->weightList[s];
 1232|  60.3k|            U32 const r = rankStart[w]++;
 1233|  60.3k|            wksp->sortedSymbol[r].symbol = (BYTE)s;
 1234|  60.3k|        }
 1235|    540|        rankStart[0] = 0;   /* forget 0w symbols; this is beginning of weight(1) */
 1236|    540|    }
 1237|       |
 1238|       |    /* Build rankVal */
 1239|    540|    {   U32* const rankVal0 = wksp->rankVal[0];
 1240|    540|        {   int const rescale = (maxTableLog-tableLog) - 1;   /* tableLog <= maxTableLog */
 1241|    540|            U32 nextRankVal = 0;
 1242|    540|            U32 w;
 1243|  4.65k|            for (w=1; w<maxW+1; w++) {
  ------------------
  |  Branch (1243:23): [True: 4.11k, False: 540]
  ------------------
 1244|  4.11k|                U32 curr = nextRankVal;
 1245|  4.11k|                nextRankVal += wksp->rankStats[w] << (w+rescale);
 1246|  4.11k|                rankVal0[w] = curr;
 1247|  4.11k|        }   }
 1248|    540|        {   U32 const minBits = tableLog+1 - maxW;
 1249|    540|            U32 consumed;
 1250|  4.87k|            for (consumed = minBits; consumed < maxTableLog - minBits + 1; consumed++) {
  ------------------
  |  Branch (1250:38): [True: 4.33k, False: 540]
  ------------------
 1251|  4.33k|                U32* const rankValPtr = wksp->rankVal[consumed];
 1252|  4.33k|                U32 w;
 1253|  41.5k|                for (w = 1; w < maxW+1; w++) {
  ------------------
  |  Branch (1253:29): [True: 37.2k, False: 4.33k]
  ------------------
 1254|  37.2k|                    rankValPtr[w] = rankVal0[w] >> consumed;
 1255|  37.2k|    }   }   }   }
 1256|       |
 1257|    540|    HUF_fillDTableX2(dt, maxTableLog,
 1258|    540|                   wksp->sortedSymbol,
 1259|    540|                   wksp->rankStart0, wksp->rankVal, maxW,
 1260|    540|                   tableLog+1);
 1261|       |
 1262|    540|    dtd.tableLog = (BYTE)maxTableLog;
 1263|    540|    dtd.tableType = 1;
 1264|    540|    ZSTD_memcpy(DTable, &dtd, sizeof(dtd));
  ------------------
  |  |   44|    540|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1265|    540|    return iSize;
 1266|    540|}
HUF_selectDecoder:
 1836|    697|{
 1837|    697|    assert(dstSize > 0);
  ------------------
  |  |   70|    697|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1838|    697|    assert(dstSize <= 128*1024);
  ------------------
  |  |   70|    697|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1839|       |#if defined(HUF_FORCE_DECOMPRESS_X1)
 1840|       |    (void)dstSize;
 1841|       |    (void)cSrcSize;
 1842|       |    return 0;
 1843|       |#elif defined(HUF_FORCE_DECOMPRESS_X2)
 1844|       |    (void)dstSize;
 1845|       |    (void)cSrcSize;
 1846|       |    return 1;
 1847|       |#else
 1848|       |    /* decoder timing evaluation */
 1849|    697|    {   U32 const Q = (cSrcSize >= dstSize) ? 15 : (U32)(cSrcSize * 16 / dstSize);   /* Q < 16 */
  ------------------
  |  Branch (1849:23): [True: 43, False: 654]
  ------------------
 1850|    697|        U32 const D256 = (U32)(dstSize >> 8);
 1851|    697|        U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256);
 1852|    697|        U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256);
 1853|    697|        DTime1 += DTime1 >> 5;  /* small advantage to algorithm using less memory, to reduce cache eviction */
 1854|    697|        return DTime1 < DTime0;
 1855|    697|    }
 1856|    697|#endif
 1857|    697|}
HUF_decompress1X_usingDTable:
 1891|     36|{
 1892|     36|    DTableDesc const dtd = HUF_getDTableDesc(DTable);
 1893|       |#if defined(HUF_FORCE_DECOMPRESS_X1)
 1894|       |    (void)dtd;
 1895|       |    assert(dtd.tableType == 0);
 1896|       |    return HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags);
 1897|       |#elif defined(HUF_FORCE_DECOMPRESS_X2)
 1898|       |    (void)dtd;
 1899|       |    assert(dtd.tableType == 1);
 1900|       |    return HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags);
 1901|       |#else
 1902|     36|    return dtd.tableType ? HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags) :
  ------------------
  |  Branch (1902:12): [True: 34, False: 2]
  ------------------
 1903|     36|                           HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags);
 1904|     36|#endif
 1905|     36|}
HUF_decompress1X1_DCtx_wksp:
 1909|     78|{
 1910|     78|    const BYTE* ip = (const BYTE*) cSrc;
 1911|       |
 1912|     78|    size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1913|     78|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   80|     78|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1913:9): [True: 36, False: 42]
  ------------------
 1914|     42|    if (hSize >= cSrcSize) return ERROR(srcSize_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 (1914:9): [True: 2, False: 40]
  ------------------
 1915|     40|    ip += hSize; cSrcSize -= hSize;
 1916|       |
 1917|     40|    return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
 1918|     42|}
HUF_decompress4X_usingDTable:
 1922|      3|{
 1923|      3|    DTableDesc const dtd = HUF_getDTableDesc(DTable);
 1924|       |#if defined(HUF_FORCE_DECOMPRESS_X1)
 1925|       |    (void)dtd;
 1926|       |    assert(dtd.tableType == 0);
 1927|       |    return HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags);
 1928|       |#elif defined(HUF_FORCE_DECOMPRESS_X2)
 1929|       |    (void)dtd;
 1930|       |    assert(dtd.tableType == 1);
 1931|       |    return HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags);
 1932|       |#else
 1933|      3|    return dtd.tableType ? HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags) :
  ------------------
  |  Branch (1933:12): [True: 1, False: 2]
  ------------------
 1934|      3|                           HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, flags);
 1935|      3|#endif
 1936|      3|}
HUF_decompress4X_hufOnly_wksp:
 1939|    699|{
 1940|       |    /* validation checks */
 1941|    699|    if (dstSize == 0) return ERROR(dstSize_tooSmall);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1941:9): [True: 0, False: 699]
  ------------------
 1942|    699|    if (cSrcSize == 0) return ERROR(corruption_detected);
  ------------------
  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1942:9): [True: 2, False: 697]
  ------------------
 1943|       |
 1944|    697|    {   U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize);
 1945|       |#if defined(HUF_FORCE_DECOMPRESS_X1)
 1946|       |        (void)algoNb;
 1947|       |        assert(algoNb == 0);
 1948|       |        return HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1949|       |#elif defined(HUF_FORCE_DECOMPRESS_X2)
 1950|       |        (void)algoNb;
 1951|       |        assert(algoNb == 1);
 1952|       |        return HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1953|       |#else
 1954|    697|        return algoNb ? HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags) :
  ------------------
  |  Branch (1954:16): [True: 267, False: 430]
  ------------------
 1955|    697|                        HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, flags);
 1956|    699|#endif
 1957|    699|    }
 1958|    699|}
huf_decompress.c:HUF_getDTableDesc:
  147|  1.91k|{
  148|  1.91k|    DTableDesc dtd;
  149|  1.91k|    ZSTD_memcpy(&dtd, table, sizeof(dtd));
  ------------------
  |  |   44|  1.91k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  150|  1.91k|    return dtd;
  151|  1.91k|}
huf_decompress.c:HUF_rescaleStats:
  357|    306|{
  358|    306|    if (tableLog > targetTableLog)
  ------------------
  |  Branch (358:9): [True: 53, False: 253]
  ------------------
  359|     53|        return tableLog;
  360|    253|    if (tableLog < targetTableLog) {
  ------------------
  |  Branch (360:9): [True: 221, False: 32]
  ------------------
  361|    221|        U32 const scale = targetTableLog - tableLog;
  362|    221|        U32 s;
  363|       |        /* Increase the weight for all non-zero probability symbols by scale. */
  364|  15.9k|        for (s = 0; s < nbSymbols; ++s) {
  ------------------
  |  Branch (364:21): [True: 15.6k, False: 221]
  ------------------
  365|  15.6k|            huffWeight[s] += (BYTE)((huffWeight[s] == 0) ? 0 : scale);
  ------------------
  |  Branch (365:37): [True: 6.48k, False: 9.20k]
  ------------------
  366|  15.6k|        }
  367|       |        /* Update rankVal to reflect the new weights.
  368|       |         * All weights except 0 get moved to weight + scale.
  369|       |         * Weights [1, scale] are empty.
  370|       |         */
  371|  1.46k|        for (s = targetTableLog; s > scale; --s) {
  ------------------
  |  Branch (371:34): [True: 1.24k, False: 221]
  ------------------
  372|  1.24k|            rankVal[s] = rankVal[s - scale];
  373|  1.24k|        }
  374|  1.41k|        for (s = scale; s > 0; --s) {
  ------------------
  |  Branch (374:25): [True: 1.19k, False: 221]
  ------------------
  375|  1.19k|            rankVal[s] = 0;
  376|  1.19k|        }
  377|    221|    }
  378|    253|    return targetTableLog;
  379|    306|}
huf_decompress.c:HUF_DEltX1_set4:
  339|  10.0k|static U64 HUF_DEltX1_set4(BYTE symbol, BYTE nbBits) {
  340|  10.0k|    U64 D4;
  341|  10.0k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (341:9): [True: 10.0k, False: 0]
  ------------------
  342|  10.0k|        D4 = (U64)((symbol << 8) + nbBits);
  343|  10.0k|    } else {
  344|      0|        D4 = (U64)(symbol + (nbBits << 8));
  345|      0|    }
  346|  10.0k|    assert(D4 < (1U << 16));
  ------------------
  |  |   70|  10.0k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  347|  10.0k|    D4 *= 0x0001000100010001ULL;
  348|  10.0k|    return D4;
  349|  10.0k|}
huf_decompress.c:HUF_fillDTableX2:
 1132|    540|{
 1133|    540|    U32* const rankVal = rankValOrigin[0];
 1134|    540|    const int scaleLog = nbBitsBaseline - targetLog;   /* note : targetLog >= srcLog, hence scaleLog <= 1 */
 1135|    540|    const U32 minBits  = nbBitsBaseline - maxWeight;
 1136|    540|    int w;
 1137|    540|    int const wEnd = (int)maxWeight + 1;
 1138|       |
 1139|       |    /* Fill DTable in order of weight. */
 1140|  4.65k|    for (w = 1; w < wEnd; ++w) {
  ------------------
  |  Branch (1140:17): [True: 4.11k, False: 540]
  ------------------
 1141|  4.11k|        int const begin = (int)rankStart[w];
 1142|  4.11k|        int const end = (int)rankStart[w+1];
 1143|  4.11k|        U32 const nbBits = nbBitsBaseline - w;
 1144|       |
 1145|  4.11k|        if (targetLog-nbBits >= minBits) {
  ------------------
  |  Branch (1145:13): [True: 3.69k, False: 415]
  ------------------
 1146|       |            /* Enough room for a second symbol. */
 1147|  3.69k|            int start = rankVal[w];
 1148|  3.69k|            U32 const length = 1U << ((targetLog - nbBits) & 0x1F /* quiet static-analyzer */);
 1149|  3.69k|            int minWeight = nbBits + scaleLog;
 1150|  3.69k|            int s;
 1151|  3.69k|            if (minWeight < 1) minWeight = 1;
  ------------------
  |  Branch (1151:17): [True: 397, False: 3.29k]
  ------------------
 1152|       |            /* Fill the DTable for every symbol of weight w.
 1153|       |             * These symbols get at least 1 second symbol.
 1154|       |             */
 1155|  27.3k|            for (s = begin; s != end; ++s) {
  ------------------
  |  Branch (1155:29): [True: 23.6k, False: 3.69k]
  ------------------
 1156|  23.6k|                HUF_fillDTableX2Level2(
 1157|  23.6k|                    DTable + start, targetLog, nbBits,
 1158|  23.6k|                    rankValOrigin[nbBits], minWeight, wEnd,
 1159|  23.6k|                    sortedList, rankStart,
 1160|  23.6k|                    nbBitsBaseline, sortedList[s].symbol);
 1161|  23.6k|                start += length;
 1162|  23.6k|            }
 1163|  3.69k|        } else {
 1164|       |            /* Only a single symbol. */
 1165|    415|            HUF_fillDTableX2ForWeight(
 1166|    415|                DTable + rankVal[w],
 1167|    415|                sortedList + begin, sortedList + end,
 1168|    415|                nbBits, targetLog,
 1169|    415|                /* baseSeq */ 0, /* level */ 1);
 1170|    415|        }
 1171|  4.11k|    }
 1172|    540|}
huf_decompress.c:HUF_fillDTableX2Level2:
 1077|  23.6k|{
 1078|       |    /* Fill skipped values (all positions up to rankVal[minWeight]).
 1079|       |     * These are positions only get a single symbol because the combined weight
 1080|       |     * is too large.
 1081|       |     */
 1082|  23.6k|    if (minWeight>1) {
  ------------------
  |  Branch (1082:9): [True: 21.9k, False: 1.69k]
  ------------------
 1083|  21.9k|        U32 const length = 1U << ((targetLog - consumedBits) & 0x1F /* quiet static-analyzer */);
 1084|  21.9k|        U64 const DEltX2 = HUF_buildDEltX2U64(baseSeq, consumedBits, /* baseSeq */ 0, /* level */ 1);
 1085|  21.9k|        int const skipSize = rankVal[minWeight];
 1086|  21.9k|        assert(length > 1);
  ------------------
  |  |   70|  21.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1087|  21.9k|        assert((U32)skipSize < length);
  ------------------
  |  |   70|  21.9k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1088|  21.9k|        switch (length) {
 1089|  7.31k|        case 2:
  ------------------
  |  Branch (1089:9): [True: 7.31k, False: 14.6k]
  ------------------
 1090|  7.31k|            assert(skipSize == 1);
  ------------------
  |  |   70|  7.31k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1091|  7.31k|            ZSTD_memcpy(DTable, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  7.31k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1092|  7.31k|            break;
 1093|  2.62k|        case 4:
  ------------------
  |  Branch (1093:9): [True: 2.62k, False: 19.3k]
  ------------------
 1094|  2.62k|            assert(skipSize <= 4);
  ------------------
  |  |   70|  2.62k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1095|  2.62k|            ZSTD_memcpy(DTable + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  2.62k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1096|  2.62k|            ZSTD_memcpy(DTable + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  2.62k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1097|  2.62k|            break;
 1098|  11.9k|        default:
  ------------------
  |  Branch (1098:9): [True: 11.9k, False: 9.94k]
  ------------------
 1099|  11.9k|            {
 1100|  11.9k|                int i;
 1101|  36.0k|                for (i = 0; i < skipSize; i += 8) {
  ------------------
  |  Branch (1101:29): [True: 24.0k, False: 11.9k]
  ------------------
 1102|  24.0k|                    ZSTD_memcpy(DTable + i + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  24.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1103|  24.0k|                    ZSTD_memcpy(DTable + i + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  24.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1104|  24.0k|                    ZSTD_memcpy(DTable + i + 4, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  24.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1105|  24.0k|                    ZSTD_memcpy(DTable + i + 6, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  24.0k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1106|  24.0k|                }
 1107|  11.9k|            }
 1108|  21.9k|        }
 1109|  21.9k|    }
 1110|       |
 1111|       |    /* Fill each of the second level symbols by weight. */
 1112|  23.6k|    {
 1113|  23.6k|        int w;
 1114|  82.4k|        for (w = minWeight; w < maxWeight1; ++w) {
  ------------------
  |  Branch (1114:29): [True: 58.8k, False: 23.6k]
  ------------------
 1115|  58.8k|            int const begin = rankStart[w];
 1116|  58.8k|            int const end = rankStart[w+1];
 1117|  58.8k|            U32 const nbBits = nbBitsBaseline - w;
 1118|  58.8k|            U32 const totalBits = nbBits + consumedBits;
 1119|  58.8k|            HUF_fillDTableX2ForWeight(
 1120|  58.8k|                DTable + rankVal[w],
 1121|  58.8k|                sortedSymbols + begin, sortedSymbols + end,
 1122|  58.8k|                totalBits, targetLog,
 1123|  58.8k|                baseSeq, /* level */ 2);
 1124|  58.8k|        }
 1125|  23.6k|    }
 1126|  23.6k|}
huf_decompress.c:HUF_buildDEltX2U64:
  997|  68.8k|{
  998|  68.8k|    U32 DElt = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level);
  999|  68.8k|    return (U64)DElt + ((U64)DElt << 32);
 1000|  68.8k|}
huf_decompress.c:HUF_buildDEltX2U32:
  966|   204k|{
  967|   204k|    U32 seq;
  968|   204k|    DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, sequence) == 0);
  ------------------
  |  |   39|   204k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  969|   204k|    DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, nbBits) == 2);
  ------------------
  |  |   39|   204k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  970|   204k|    DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, length) == 3);
  ------------------
  |  |   39|   204k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  971|   204k|    DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(U32));
  ------------------
  |  |   39|   204k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  972|   204k|    if (MEM_isLittleEndian()) {
  ------------------
  |  Branch (972:9): [True: 204k, False: 0]
  ------------------
  973|   204k|        seq = level == 1 ? symbol : (baseSeq + (symbol << 8));
  ------------------
  |  Branch (973:15): [True: 48.4k, False: 156k]
  ------------------
  974|   204k|        return seq + (nbBits << 16) + ((U32)level << 24);
  975|   204k|    } else {
  976|      0|        seq = level == 1 ? (symbol << 8) : ((baseSeq << 8) + symbol);
  ------------------
  |  Branch (976:15): [True: 0, False: 0]
  ------------------
  977|      0|        return (seq << 16) + (nbBits << 8) + (U32)level;
  978|      0|    }
  979|   204k|}
huf_decompress.c:HUF_fillDTableX2ForWeight:
 1019|  59.2k|{
 1020|  59.2k|    U32 const length = 1U << ((tableLog - nbBits) & 0x1F /* quiet static-analyzer */);
 1021|  59.2k|    const sortedSymbol_t* ptr;
 1022|  59.2k|    assert(level >= 1 && level <= 2);
  ------------------
  |  |   70|  59.2k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1023|  59.2k|    switch (length) {
 1024|  22.9k|    case 1:
  ------------------
  |  Branch (1024:5): [True: 22.9k, False: 36.3k]
  ------------------
 1025|   117k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1025:27): [True: 94.6k, False: 22.9k]
  ------------------
 1026|  94.6k|            HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level);
 1027|  94.6k|            *DTableRank++ = DElt;
 1028|  94.6k|        }
 1029|  22.9k|        break;
 1030|  12.2k|    case 2:
  ------------------
  |  Branch (1030:5): [True: 12.2k, False: 46.9k]
  ------------------
 1031|  53.6k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1031:27): [True: 41.3k, False: 12.2k]
  ------------------
 1032|  41.3k|            HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level);
 1033|  41.3k|            DTableRank[0] = DElt;
 1034|  41.3k|            DTableRank[1] = DElt;
 1035|  41.3k|            DTableRank += 2;
 1036|  41.3k|        }
 1037|  12.2k|        break;
 1038|  8.89k|    case 4:
  ------------------
  |  Branch (1038:5): [True: 8.89k, False: 50.3k]
  ------------------
 1039|  28.3k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1039:27): [True: 19.5k, False: 8.89k]
  ------------------
 1040|  19.5k|            U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level);
 1041|  19.5k|            ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  19.5k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1042|  19.5k|            ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  19.5k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1043|  19.5k|            DTableRank += 4;
 1044|  19.5k|        }
 1045|  8.89k|        break;
 1046|  6.74k|    case 8:
  ------------------
  |  Branch (1046:5): [True: 6.74k, False: 52.5k]
  ------------------
 1047|  21.1k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1047:27): [True: 14.4k, False: 6.74k]
  ------------------
 1048|  14.4k|            U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level);
 1049|  14.4k|            ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  14.4k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1050|  14.4k|            ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  14.4k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1051|  14.4k|            ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  14.4k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1052|  14.4k|            ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|  14.4k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1053|  14.4k|            DTableRank += 8;
 1054|  14.4k|        }
 1055|  6.74k|        break;
 1056|  8.42k|    default:
  ------------------
  |  Branch (1056:5): [True: 8.42k, False: 50.8k]
  ------------------
 1057|  21.4k|        for (ptr = begin; ptr != end; ++ptr) {
  ------------------
  |  Branch (1057:27): [True: 13.0k, False: 8.42k]
  ------------------
 1058|  13.0k|            U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level);
 1059|  13.0k|            HUF_DEltX2* const DTableRankEnd = DTableRank + length;
 1060|   115k|            for (; DTableRank != DTableRankEnd; DTableRank += 8) {
  ------------------
  |  Branch (1060:20): [True: 102k, False: 13.0k]
  ------------------
 1061|   102k|                ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|   102k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1062|   102k|                ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|   102k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1063|   102k|                ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|   102k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1064|   102k|                ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2));
  ------------------
  |  |   44|   102k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1065|   102k|            }
 1066|  13.0k|        }
 1067|  8.42k|        break;
 1068|  59.2k|    }
 1069|  59.2k|}
huf_decompress.c:HUF_buildDEltX2:
  985|   136k|{
  986|   136k|    HUF_DEltX2 DElt;
  987|   136k|    U32 const val = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level);
  988|   136k|    DEBUG_STATIC_ASSERT(sizeof(DElt) == sizeof(val));
  ------------------
  |  |   39|   136k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  ------------------
  989|   136k|    ZSTD_memcpy(&DElt, &val, sizeof(val));
  ------------------
  |  |   44|   136k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  990|   136k|    return DElt;
  991|   136k|}
huf_decompress.c:HUF_decompress1X2_usingDTable_internal:
  120|     34|    {                                                                       \
  121|     34|        if (ZSTD_USE_BMI2(flags & HUF_flags_bmi2)) {                        \
  ------------------
  |  |   36|     34|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 34, False: 0]
  |  |  ------------------
  ------------------
  122|     34|            return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable);         \
  123|     34|        }                                                                   \
  124|     34|        (void)flags;                                                        \
  125|      0|        return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable);          \
  126|     34|    }
huf_decompress.c:HUF_decompress1X2_usingDTable_internal_bmi2:
  114|     34|    {                                                                       \
  115|     34|        return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable);             \
  116|     34|    }                                                                       \
huf_decompress.c:HUF_decompress1X2_usingDTable_internal_body:
 1363|     34|{
 1364|     34|    BIT_DStream_t bitD;
 1365|       |
 1366|       |    /* Init */
 1367|     34|    CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) );
  ------------------
  |  |   63|     34|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     34|    size_t const e = f;     \
  |  |  |  |   59|     34|    do {                    \
  |  |  |  |   60|     34|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 5, False: 29]
  |  |  |  |  ------------------
  |  |  |  |   61|     34|            return e;       \
  |  |  |  |   62|     34|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 29]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 29]
  |  |  ------------------
  ------------------
 1368|       |
 1369|       |    /* decode */
 1370|     29|    {   BYTE* const ostart = (BYTE*) dst;
 1371|     29|        BYTE* const oend = (BYTE*)ZSTD_maybeNullPtrAdd(ostart, (ptrdiff_t)dstSize);
 1372|     29|        const void* const dtPtr = DTable+1;   /* force compiler to not use strict-aliasing */
 1373|     29|        const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr;
 1374|     29|        DTableDesc const dtd = HUF_getDTableDesc(DTable);
 1375|     29|        HUF_decodeStreamX2(ostart, &bitD, oend, dt, dtd.tableLog);
 1376|     29|    }
 1377|       |
 1378|       |    /* check */
 1379|     29|    if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     26|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     26|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     26|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1379:9): [True: 26, False: 3]
  ------------------
 1380|       |
 1381|       |    /* decoded size */
 1382|      3|    return dstSize;
 1383|     29|}
huf_decompress.c:HUF_decodeStreamX2:
 1314|    869|{
 1315|    869|    BYTE* const pStart = p;
 1316|       |
 1317|       |    /* up to 8 symbols at a time */
 1318|    869|    if ((size_t)(pEnd - p) >= sizeof(bitDPtr->bitContainer)) {
  ------------------
  |  Branch (1318:9): [True: 812, False: 57]
  ------------------
 1319|    812|        if (dtLog <= 11 && MEM_64bits()) {
  ------------------
  |  Branch (1319:13): [True: 481, False: 331]
  |  Branch (1319:28): [True: 481, False: 0]
  ------------------
 1320|       |            /* up to 10 symbols at a time */
 1321|       |            /* For an 8-byte output, pEnd - 9 would precede the buffer. */
 1322|    481|            BYTE* const pLimit = (size_t)(pEnd - p) >= 10 ? pEnd - 9 : p;
  ------------------
  |  Branch (1322:34): [True: 466, False: 15]
  ------------------
 1323|  20.4k|            while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pLimit)) {
  ------------------
  |  Branch (1323:20): [True: 19.9k, False: 481]
  ------------------
 1324|  19.9k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1297|  19.9k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 19.9k]
  |  |  ------------------
  ------------------
 1325|  19.9k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1297|  19.9k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 19.9k]
  |  |  ------------------
  ------------------
 1326|  19.9k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1297|  19.9k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 19.9k]
  |  |  ------------------
  ------------------
 1327|  19.9k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1297|  19.9k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 19.9k]
  |  |  ------------------
  ------------------
 1328|  19.9k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1297|  19.9k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 19.9k]
  |  |  ------------------
  ------------------
 1329|  19.9k|            }
 1330|    481|        } else {
 1331|       |            /* up to 8 symbols at a time */
 1332|  9.18k|            while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) {
  ------------------
  |  Branch (1332:20): [True: 8.85k, False: 331]
  ------------------
 1333|  8.85k|                HUF_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1306|  8.85k|    do {                                                           \
  |  | 1307|  8.85k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 8.85k, False: 0]
  |  |  ------------------
  |  | 1308|  8.85k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  8.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 8.85k]
  |  |  ------------------
  ------------------
 1334|  8.85k|                HUF_DECODE_SYMBOLX2_1(p, bitDPtr);
  ------------------
  |  | 1300|  8.85k|    do {                                                           \
  |  | 1301|  8.85k|        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 (1301:13): [True: 8.85k, False: 0]
  |  |  |  Branch (1301:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1302|  8.85k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1303|  8.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1303:14): [Folded, False: 8.85k]
  |  |  ------------------
  ------------------
 1335|  8.85k|                HUF_DECODE_SYMBOLX2_2(p, bitDPtr);
  ------------------
  |  | 1306|  8.85k|    do {                                                           \
  |  | 1307|  8.85k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 8.85k, False: 0]
  |  |  ------------------
  |  | 1308|  8.85k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  8.85k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 8.85k]
  |  |  ------------------
  ------------------
 1336|  8.85k|                HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1297|  8.85k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 8.85k]
  |  |  ------------------
  ------------------
 1337|  8.85k|            }
 1338|    331|        }
 1339|    812|    } else {
 1340|     57|        BIT_reloadDStream(bitDPtr);
 1341|     57|    }
 1342|       |
 1343|       |    /* closer to end : up to 2 symbols at a time */
 1344|    869|    if ((size_t)(pEnd - p) >= 2) {
  ------------------
  |  Branch (1344:9): [True: 822, False: 47]
  ------------------
 1345|  1.69k|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2))
  ------------------
  |  Branch (1345:16): [True: 875, False: 822]
  ------------------
 1346|    875|            HUF_DECODE_SYMBOLX2_0(p, bitDPtr);
  ------------------
  |  | 1297|    875|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 875]
  |  |  ------------------
  ------------------
 1347|       |
 1348|   214k|        while (p <= pEnd-2)
  ------------------
  |  Branch (1348:16): [True: 213k, False: 822]
  ------------------
 1349|   213k|            HUF_DECODE_SYMBOLX2_0(p, bitDPtr);   /* no need to reload : reached the end of DStream */
  ------------------
  |  | 1297|   213k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 213k]
  |  |  ------------------
  ------------------
 1350|    822|    }
 1351|       |
 1352|    869|    if (p < pEnd)
  ------------------
  |  Branch (1352:9): [True: 599, False: 270]
  ------------------
 1353|    599|        p += HUF_decodeLastSymbolX2(p, bitDPtr, dt, dtLog);
 1354|       |
 1355|    869|    return p-pStart;
 1356|    869|}
huf_decompress.c:HUF_decodeSymbolX2:
 1271|   412k|{
 1272|   412k|    size_t const val = BIT_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 1273|   412k|    ZSTD_memcpy(op, &dt[val].sequence, 2);
  ------------------
  |  |   44|   412k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1274|   412k|    BIT_skipBits(DStream, dt[val].nbBits);
 1275|   412k|    return dt[val].length;
 1276|   412k|}
huf_decompress.c:HUF_decodeLastSymbolX2:
 1280|    599|{
 1281|    599|    size_t const val = BIT_lookBitsFast(DStream, dtLog);   /* note : dtLog >= 1 */
 1282|    599|    ZSTD_memcpy(op, &dt[val].sequence, 1);
  ------------------
  |  |   44|    599|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1283|    599|    if (dt[val].length==1) {
  ------------------
  |  Branch (1283:9): [True: 290, False: 309]
  ------------------
 1284|    290|        BIT_skipBits(DStream, dt[val].nbBits);
 1285|    309|    } else {
 1286|    309|        if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) {
  ------------------
  |  Branch (1286:13): [True: 182, False: 127]
  ------------------
 1287|    182|            BIT_skipBits(DStream, dt[val].nbBits);
 1288|    182|            if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8))
  ------------------
  |  Branch (1288:17): [True: 8, False: 174]
  ------------------
 1289|       |                /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */
 1290|      8|                DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8);
 1291|    182|        }
 1292|    309|    }
 1293|    599|    return 1;
 1294|    599|}
huf_decompress.c:HUF_decompress1X1_usingDTable_internal:
  120|     42|    {                                                                       \
  121|     42|        if (ZSTD_USE_BMI2(flags & HUF_flags_bmi2)) {                        \
  ------------------
  |  |   36|     42|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 42, False: 0]
  |  |  ------------------
  ------------------
  122|     42|            return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable);         \
  123|     42|        }                                                                   \
  124|     42|        (void)flags;                                                        \
  125|      0|        return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable);          \
  126|     42|    }
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_bmi2:
  114|     42|    {                                                                       \
  115|     42|        return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable);             \
  116|     42|    }                                                                       \
huf_decompress.c:HUF_decompress1X1_usingDTable_internal_body:
  583|     42|{
  584|     42|    BYTE* op = (BYTE*)dst;
  585|     42|    BYTE* const oend = (BYTE*)ZSTD_maybeNullPtrAdd(op, (ptrdiff_t)dstSize);
  586|     42|    const void* dtPtr = DTable + 1;
  587|     42|    const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr;
  588|     42|    BIT_DStream_t bitD;
  589|     42|    DTableDesc const dtd = HUF_getDTableDesc(DTable);
  590|     42|    U32 const dtLog = dtd.tableLog;
  591|       |
  592|     42|    CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) );
  ------------------
  |  |   63|     42|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|     42|    size_t const e = f;     \
  |  |  |  |   59|     42|    do {                    \
  |  |  |  |   60|     42|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 7, False: 35]
  |  |  |  |  ------------------
  |  |  |  |   61|     42|            return e;       \
  |  |  |  |   62|     42|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 35]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 35]
  |  |  ------------------
  ------------------
  593|       |
  594|     35|    HUF_decodeStreamX1(op, &bitD, oend, dt, dtLog);
  595|       |
  596|     35|    if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected);
  ------------------
  |  |   49|     34|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     34|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     34|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (596:9): [True: 34, False: 1]
  ------------------
  597|       |
  598|      1|    return dstSize;
  599|     35|}
huf_decompress.c:HUF_decodeStreamX1:
  551|    652|{
  552|    652|    BYTE* const pStart = p;
  553|       |
  554|       |    /* up to 4 symbols at a time */
  555|    652|    if ((pEnd - p) > 3) {
  ------------------
  |  Branch (555:9): [True: 568, False: 84]
  ------------------
  556|  28.6k|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) {
  ------------------
  |  Branch (556:16): [True: 28.1k, False: 568]
  ------------------
  557|  28.1k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  544|  28.1k|    do {                                            \
  |  |  545|  28.1k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 28.1k, False: 0]
  |  |  ------------------
  |  |  546|  28.1k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  28.1k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 28.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  28.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 28.1k]
  |  |  ------------------
  ------------------
  558|  28.1k|            HUF_DECODE_SYMBOLX1_1(p, bitDPtr);
  ------------------
  |  |  538|  28.1k|    do {                                            \
  |  |  539|  28.1k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (539:13): [True: 28.1k, False: 0]
  |  |  |  Branch (539:29): [True: 0, Folded]
  |  |  ------------------
  |  |  540|  28.1k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  28.1k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 28.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  541|  28.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (541:14): [Folded, False: 28.1k]
  |  |  ------------------
  ------------------
  559|  28.1k|            HUF_DECODE_SYMBOLX1_2(p, bitDPtr);
  ------------------
  |  |  544|  28.1k|    do {                                            \
  |  |  545|  28.1k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 28.1k, False: 0]
  |  |  ------------------
  |  |  546|  28.1k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  28.1k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 28.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  28.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 28.1k]
  |  |  ------------------
  ------------------
  560|  28.1k|            HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  535|  28.1k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 28.1k]
  |  |  ------------------
  ------------------
  561|  28.1k|        }
  562|    568|    } else {
  563|     84|        BIT_reloadDStream(bitDPtr);
  564|     84|    }
  565|       |
  566|       |    /* [0-3] symbols remaining */
  567|    652|    if (MEM_32bits())
  ------------------
  |  Branch (567:9): [True: 0, False: 652]
  ------------------
  568|      0|        while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd))
  ------------------
  |  Branch (568:16): [True: 0, False: 0]
  ------------------
  569|      0|            HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  535|      0|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  570|       |
  571|       |    /* no more data to retrieve from bitstream, no need to reload */
  572|   702k|    while (p < pEnd)
  ------------------
  |  Branch (572:12): [True: 702k, False: 652]
  ------------------
  573|   702k|        HUF_DECODE_SYMBOLX1_0(p, bitDPtr);
  ------------------
  |  |  535|   702k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 702k]
  |  |  ------------------
  ------------------
  574|       |
  575|    652|    return (size_t)(pEnd-pStart);
  576|    652|}
huf_decompress.c:HUF_decodeSymbolX1:
  527|   846k|{
  528|   846k|    size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */
  529|   846k|    BYTE const c = dt[val].byte;
  530|   846k|    BIT_skipBits(Dstream, dt[val].nbBits);
  531|   846k|    return c;
  532|   846k|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal:
 1737|    259|{
 1738|    259|    HUF_DecompressUsingDTableFn fallbackFn = HUF_decompress4X2_usingDTable_internal_default;
 1739|    259|    HUF_DecompressFastLoopFn loopFn = HUF_decompress4X2_usingDTable_internal_fast_c_loop;
 1740|       |
 1741|    259|    if (ZSTD_USE_BMI2(flags & HUF_flags_bmi2)) {
  ------------------
  |  |   36|    259|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 259, False: 0]
  |  |  ------------------
  ------------------
 1742|    259|        fallbackFn = HUF_decompress4X2_usingDTable_internal_bmi2;
 1743|    259|# if ZSTD_ENABLE_ASM_X86_64_BMI2
 1744|    259|        if (!(flags & HUF_flags_disableAsm)) {
  ------------------
  |  Branch (1744:13): [True: 259, False: 0]
  ------------------
 1745|    259|            loopFn = HUF_decompress4X2_usingDTable_internal_fast_asm_loop;
 1746|    259|        }
 1747|    259|# endif
 1748|    259|    } else if (DYNAMIC_BMI2) {
  ------------------
  |  |   99|      0|#    define DYNAMIC_BMI2 1
  |  |  ------------------
  |  |  |  Branch (99:26): [True: 0, Folded]
  |  |  ------------------
  ------------------
 1749|      0|        return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
 1750|      0|    }
 1751|       |
 1752|       |#if ZSTD_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__)
 1753|       |    if (!(flags & HUF_flags_disableAsm)) {
 1754|       |        loopFn = HUF_decompress4X2_usingDTable_internal_fast_asm_loop;
 1755|       |    }
 1756|       |#endif
 1757|       |
 1758|    259|    if (HUF_ENABLE_FAST_DECODE && !(flags & HUF_flags_disableFast)) {
  ------------------
  |  |   42|    518|# define HUF_ENABLE_FAST_DECODE 1
  |  |  ------------------
  |  |  |  Branch (42:33): [True: 259, Folded]
  |  |  ------------------
  ------------------
  |  Branch (1758:35): [True: 259, False: 0]
  ------------------
 1759|    259|        size_t const ret = HUF_decompress4X2_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn);
 1760|    259|        if (ret != 0)
  ------------------
  |  Branch (1760:13): [True: 87, False: 172]
  ------------------
 1761|     87|            return ret;
 1762|    259|    }
 1763|    172|    return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
 1764|    259|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal_body:
 1394|    172|{
 1395|    172|    if (cSrcSize < 10) return ERROR(corruption_detected);   /* strict minimum : jump table + 1 byte per stream */
  ------------------
  |  |   49|      0|#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 (1395:9): [True: 0, False: 172]
  ------------------
 1396|    172|    if (dstSize < 6) return ERROR(corruption_detected);         /* stream 4-split doesn't work */
  ------------------
  |  |   49|      0|#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 (1396:9): [True: 0, False: 172]
  ------------------
 1397|       |
 1398|    172|    {   const BYTE* const istart = (const BYTE*) cSrc;
 1399|    172|        BYTE* const ostart = (BYTE*) dst;
 1400|    172|        BYTE* const oend = ostart + dstSize;
 1401|    172|        BYTE* const olimit = oend - (sizeof(size_t)-1);
 1402|    172|        const void* const dtPtr = DTable+1;
 1403|    172|        const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr;
 1404|       |
 1405|       |        /* Init */
 1406|    172|        BIT_DStream_t bitD1;
 1407|    172|        BIT_DStream_t bitD2;
 1408|    172|        BIT_DStream_t bitD3;
 1409|    172|        BIT_DStream_t bitD4;
 1410|    172|        size_t const length1 = MEM_readLE16(istart);
 1411|    172|        size_t const length2 = MEM_readLE16(istart+2);
 1412|    172|        size_t const length3 = MEM_readLE16(istart+4);
 1413|    172|        size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
 1414|    172|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
 1415|    172|        const BYTE* const istart2 = istart1 + length1;
 1416|    172|        const BYTE* const istart3 = istart2 + length2;
 1417|    172|        const BYTE* const istart4 = istart3 + length3;
 1418|    172|        size_t const segmentSize = (dstSize+3) / 4;
 1419|    172|        BYTE* const opStart2 = ostart + segmentSize;
 1420|    172|        BYTE* const opStart3 = opStart2 + segmentSize;
 1421|    172|        BYTE* const opStart4 = opStart3 + segmentSize;
 1422|    172|        BYTE* op1 = ostart;
 1423|    172|        BYTE* op2 = opStart2;
 1424|    172|        BYTE* op3 = opStart3;
 1425|    172|        BYTE* op4 = opStart4;
 1426|    172|        U32 endSignal = 1;
 1427|    172|        DTableDesc const dtd = HUF_getDTableDesc(DTable);
 1428|    172|        U32 const dtLog = dtd.tableLog;
 1429|       |
 1430|    172|        if (length4 > cSrcSize) return ERROR(corruption_detected);  /* overflow */
  ------------------
  |  |   49|     16|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     16|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     16|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1430:13): [True: 16, False: 156]
  ------------------
 1431|    156|        if (opStart4 > oend) 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 (1431:13): [True: 0, False: 156]
  ------------------
 1432|    156|        assert(dstSize >= 6 /* validated above */);
  ------------------
  |  |   70|    156|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1433|    156|        CHECK_F( BIT_initDStream(&bitD1, istart1, length1) );
  ------------------
  |  |   63|    156|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    156|    size_t const e = f;     \
  |  |  |  |   59|    156|    do {                    \
  |  |  |  |   60|    156|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 5, False: 151]
  |  |  |  |  ------------------
  |  |  |  |   61|    156|            return e;       \
  |  |  |  |   62|    156|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 151]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 151]
  |  |  ------------------
  ------------------
 1434|    151|        CHECK_F( BIT_initDStream(&bitD2, istart2, length2) );
  ------------------
  |  |   63|    151|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    151|    size_t const e = f;     \
  |  |  |  |   59|    151|    do {                    \
  |  |  |  |   60|    151|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 5, False: 146]
  |  |  |  |  ------------------
  |  |  |  |   61|    151|            return e;       \
  |  |  |  |   62|    151|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 146]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 146]
  |  |  ------------------
  ------------------
 1435|    146|        CHECK_F( BIT_initDStream(&bitD3, istart3, length3) );
  ------------------
  |  |   63|    146|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    146|    size_t const e = f;     \
  |  |  |  |   59|    146|    do {                    \
  |  |  |  |   60|    146|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 4, False: 142]
  |  |  |  |  ------------------
  |  |  |  |   61|    146|            return e;       \
  |  |  |  |   62|    146|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 142]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 142]
  |  |  ------------------
  ------------------
 1436|    142|        CHECK_F( BIT_initDStream(&bitD4, istart4, length4) );
  ------------------
  |  |   63|    142|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    142|    size_t const e = f;     \
  |  |  |  |   59|    142|    do {                    \
  |  |  |  |   60|    142|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 1, False: 141]
  |  |  |  |  ------------------
  |  |  |  |   61|    142|            return e;       \
  |  |  |  |   62|    142|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 141]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 141]
  |  |  ------------------
  ------------------
 1437|       |
 1438|       |        /* 16-32 symbols per loop (4-8 symbols per stream) */
 1439|    141|        if ((size_t)(oend - op4) >= sizeof(size_t)) {
  ------------------
  |  Branch (1439:13): [True: 141, False: 0]
  ------------------
 1440|  4.04k|            for ( ; (endSignal) & (op4 < olimit); ) {
  ------------------
  |  Branch (1440:21): [True: 3.90k, False: 141]
  ------------------
 1441|  3.90k|#if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
 1442|  3.90k|                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1306|  3.90k|    do {                                                           \
  |  | 1307|  3.90k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 3.90k, False: 0]
  |  |  ------------------
  |  | 1308|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1443|  3.90k|                HUF_DECODE_SYMBOLX2_1(op1, &bitD1);
  ------------------
  |  | 1300|  3.90k|    do {                                                           \
  |  | 1301|  3.90k|        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 (1301:13): [True: 3.90k, False: 0]
  |  |  |  Branch (1301:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1302|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1303|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1303:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1444|  3.90k|                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
  ------------------
  |  | 1306|  3.90k|    do {                                                           \
  |  | 1307|  3.90k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 3.90k, False: 0]
  |  |  ------------------
  |  | 1308|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1445|  3.90k|                HUF_DECODE_SYMBOLX2_0(op1, &bitD1);
  ------------------
  |  | 1297|  3.90k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1446|  3.90k|                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1306|  3.90k|    do {                                                           \
  |  | 1307|  3.90k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 3.90k, False: 0]
  |  |  ------------------
  |  | 1308|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1447|  3.90k|                HUF_DECODE_SYMBOLX2_1(op2, &bitD2);
  ------------------
  |  | 1300|  3.90k|    do {                                                           \
  |  | 1301|  3.90k|        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 (1301:13): [True: 3.90k, False: 0]
  |  |  |  Branch (1301:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1302|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1303|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1303:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1448|  3.90k|                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
  ------------------
  |  | 1306|  3.90k|    do {                                                           \
  |  | 1307|  3.90k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 3.90k, False: 0]
  |  |  ------------------
  |  | 1308|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1449|  3.90k|                HUF_DECODE_SYMBOLX2_0(op2, &bitD2);
  ------------------
  |  | 1297|  3.90k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1450|  3.90k|                endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished;
 1451|  3.90k|                endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished;
 1452|  3.90k|                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1306|  3.90k|    do {                                                           \
  |  | 1307|  3.90k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 3.90k, False: 0]
  |  |  ------------------
  |  | 1308|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1453|  3.90k|                HUF_DECODE_SYMBOLX2_1(op3, &bitD3);
  ------------------
  |  | 1300|  3.90k|    do {                                                           \
  |  | 1301|  3.90k|        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 (1301:13): [True: 3.90k, False: 0]
  |  |  |  Branch (1301:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1302|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1303|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1303:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1454|  3.90k|                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
  ------------------
  |  | 1306|  3.90k|    do {                                                           \
  |  | 1307|  3.90k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 3.90k, False: 0]
  |  |  ------------------
  |  | 1308|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1455|  3.90k|                HUF_DECODE_SYMBOLX2_0(op3, &bitD3);
  ------------------
  |  | 1297|  3.90k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1456|  3.90k|                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1306|  3.90k|    do {                                                           \
  |  | 1307|  3.90k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 3.90k, False: 0]
  |  |  ------------------
  |  | 1308|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1457|  3.90k|                HUF_DECODE_SYMBOLX2_1(op4, &bitD4);
  ------------------
  |  | 1300|  3.90k|    do {                                                           \
  |  | 1301|  3.90k|        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 (1301:13): [True: 3.90k, False: 0]
  |  |  |  Branch (1301:29): [True: 0, Folded]
  |  |  ------------------
  |  | 1302|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1303|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1303:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1458|  3.90k|                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
  ------------------
  |  | 1306|  3.90k|    do {                                                           \
  |  | 1307|  3.90k|        if (MEM_64bits())                                          \
  |  |  ------------------
  |  |  |  Branch (1307:13): [True: 3.90k, False: 0]
  |  |  ------------------
  |  | 1308|  3.90k|            ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); \
  |  | 1309|  3.90k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1309:14): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1459|  3.90k|                HUF_DECODE_SYMBOLX2_0(op4, &bitD4);
  ------------------
  |  | 1297|  3.90k|    do { ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (1297:74): [Folded, False: 3.90k]
  |  |  ------------------
  ------------------
 1460|  3.90k|                endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished;
 1461|  3.90k|                endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished;
 1462|       |#else
 1463|       |                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
 1464|       |                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
 1465|       |                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
 1466|       |                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
 1467|       |                HUF_DECODE_SYMBOLX2_1(op1, &bitD1);
 1468|       |                HUF_DECODE_SYMBOLX2_1(op2, &bitD2);
 1469|       |                HUF_DECODE_SYMBOLX2_1(op3, &bitD3);
 1470|       |                HUF_DECODE_SYMBOLX2_1(op4, &bitD4);
 1471|       |                HUF_DECODE_SYMBOLX2_2(op1, &bitD1);
 1472|       |                HUF_DECODE_SYMBOLX2_2(op2, &bitD2);
 1473|       |                HUF_DECODE_SYMBOLX2_2(op3, &bitD3);
 1474|       |                HUF_DECODE_SYMBOLX2_2(op4, &bitD4);
 1475|       |                HUF_DECODE_SYMBOLX2_0(op1, &bitD1);
 1476|       |                HUF_DECODE_SYMBOLX2_0(op2, &bitD2);
 1477|       |                HUF_DECODE_SYMBOLX2_0(op3, &bitD3);
 1478|       |                HUF_DECODE_SYMBOLX2_0(op4, &bitD4);
 1479|       |                endSignal = (U32)LIKELY((U32)
 1480|       |                            (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
 1481|       |                        & (BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished)
 1482|       |                        & (BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished)
 1483|       |                        & (BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished));
 1484|       |#endif
 1485|  3.90k|            }
 1486|    141|        }
 1487|       |
 1488|       |        /* check corruption */
 1489|    141|        if (op1 > opStart2) 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 (1489:13): [True: 1, False: 140]
  ------------------
 1490|    140|        if (op2 > opStart3) 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 (1490:13): [True: 1, False: 139]
  ------------------
 1491|    139|        if (op3 > opStart4) 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 (1491:13): [True: 1, False: 138]
  ------------------
 1492|       |        /* note : op4 already verified within main loop */
 1493|       |
 1494|       |        /* finish bitStreams one by one */
 1495|    138|        HUF_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog);
 1496|    138|        HUF_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog);
 1497|    138|        HUF_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog);
 1498|    138|        HUF_decodeStreamX2(op4, &bitD4, oend,     dt, dtLog);
 1499|       |
 1500|       |        /* check */
 1501|    138|        { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4);
 1502|    138|          if (!endCheck) return ERROR(corruption_detected); }
  ------------------
  |  |   49|    137|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    137|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    137|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1502:15): [True: 137, False: 1]
  ------------------
 1503|       |
 1504|       |        /* decoded size */
 1505|      1|        return dstSize;
 1506|    138|    }
 1507|    138|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal_bmi2:
 1512|    172|                    size_t cSrcSize, HUF_DTable const* DTable) {
 1513|    172|    return HUF_decompress4X2_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable);
 1514|    172|}
huf_decompress.c:HUF_decompress4X2_usingDTable_internal_fast:
 1687|    259|    HUF_DecompressFastLoopFn loopFn) {
 1688|    259|    void const* dt = DTable + 1;
 1689|    259|    const BYTE* const ilowest = (const BYTE*)cSrc;
 1690|    259|    BYTE* const oend = (BYTE*)ZSTD_maybeNullPtrAdd(dst, (ptrdiff_t)dstSize);
 1691|    259|    HUF_DecompressFastArgs args;
 1692|    259|    {
 1693|    259|        size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable);
 1694|    259|        FORWARD_IF_ERROR(ret, "Failed to init asm args");
  ------------------
  |  |  146|    259|    do {                                                                           \
  |  |  147|    259|        size_t const err_code = (err);                                             \
  |  |  148|    259|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 3, False: 256]
  |  |  ------------------
  |  |  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|    259|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 256]
  |  |  ------------------
  ------------------
 1695|    256|        if (ret == 0)
  ------------------
  |  Branch (1695:13): [True: 172, False: 84]
  ------------------
 1696|    172|            return 0;
 1697|    256|    }
 1698|       |
 1699|     84|    assert(args.ip[0] >= args.ilowest);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1700|     84|    loopFn(&args);
 1701|       |
 1702|       |    /* note : op4 already verified within main loop */
 1703|     84|    assert(args.ip[0] >= ilowest);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1704|     84|    assert(args.ip[1] >= ilowest);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1705|     84|    assert(args.ip[2] >= ilowest);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1706|     84|    assert(args.ip[3] >= ilowest);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1707|     84|    assert(args.op[3] <= oend);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1708|       |
 1709|     84|    assert(ilowest == args.ilowest);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1710|     84|    assert(ilowest + 6 == args.iend[0]);
  ------------------
  |  |   70|     84|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1711|     84|    (void)ilowest;
 1712|       |
 1713|       |    /* finish bitStreams one by one */
 1714|     84|    {
 1715|     84|        size_t const segmentSize = (dstSize+3) / 4;
 1716|     84|        BYTE* segmentEnd = (BYTE*)dst;
 1717|     84|        int i;
 1718|    372|        for (i = 0; i < 4; ++i) {
  ------------------
  |  Branch (1718:21): [True: 309, False: 63]
  ------------------
 1719|    309|            BIT_DStream_t bit;
 1720|    309|            if (segmentSize <= (size_t)(oend - segmentEnd))
  ------------------
  |  Branch (1720:17): [True: 252, False: 57]
  ------------------
 1721|    252|                segmentEnd += segmentSize;
 1722|     57|            else
 1723|     57|                segmentEnd = oend;
 1724|    309|            FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption");
  ------------------
  |  |  146|    309|    do {                                                                           \
  |  |  147|    309|        size_t const err_code = (err);                                             \
  |  |  148|    309|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 21, False: 288]
  |  |  ------------------
  |  |  149|     21|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     21|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     21|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     21|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     21|    do {                                           \
  |  |  |  |   99|     21|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     21|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     21|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     21|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     21|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     21|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     21|            return err_code;                                                       \
  |  |  155|     21|        }                                                                          \
  |  |  156|    309|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 288]
  |  |  ------------------
  ------------------
 1725|    288|            args.op[i] += HUF_decodeStreamX2(args.op[i], &bit, segmentEnd, (HUF_DEltX2 const*)dt, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   33|    288|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
 1726|    288|            if (args.op[i] != segmentEnd)
  ------------------
  |  Branch (1726:17): [True: 0, False: 288]
  ------------------
 1727|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1728|    288|        }
 1729|     84|    }
 1730|       |
 1731|       |    /* decoded size */
 1732|     63|    return dstSize;
 1733|     84|}
huf_decompress.c:HUF_DecompressFastArgs_init:
  195|    515|{
  196|    515|    void const* dt = DTable + 1;
  197|    515|    U32 const dtLog = HUF_getDTableDesc(DTable).tableLog;
  198|       |
  199|    515|    const BYTE* const istart = (const BYTE*)src;
  200|       |
  201|    515|    BYTE* const oend = (BYTE*)ZSTD_maybeNullPtrAdd(dst, (ptrdiff_t)dstSize);
  202|       |
  203|       |    /* The fast decoding loop assumes 64-bit little-endian.
  204|       |     * This condition is false on x32.
  205|       |     */
  206|    515|    if (!MEM_isLittleEndian() || MEM_32bits())
  ------------------
  |  Branch (206:9): [True: 0, False: 515]
  |  Branch (206:34): [True: 0, False: 515]
  ------------------
  207|      0|        return 0;
  208|       |
  209|       |    /* Avoid nullptr addition */
  210|    515|    if (dstSize == 0)
  ------------------
  |  Branch (210:9): [True: 0, False: 515]
  ------------------
  211|      0|        return 0;
  212|    515|    assert(dst != NULL);
  ------------------
  |  |   70|    515|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  213|       |
  214|       |    /* strict minimum : jump table + 1 byte per stream */
  215|    515|    if (srcSize < 10)
  ------------------
  |  Branch (215:9): [True: 19, False: 496]
  ------------------
  216|     19|        return ERROR(corruption_detected);
  ------------------
  |  |   49|     19|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     19|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     19|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  217|       |
  218|       |    /* Must have at least 8 bytes per stream because we don't handle initializing smaller bit containers.
  219|       |     * If table log is not correct at this point, fallback to the old decoder.
  220|       |     * On small inputs we don't have enough data to trigger the fast loop, so use the old decoder.
  221|       |     */
  222|    496|    if (dtLog != HUF_DECODER_FAST_TABLELOG)
  ------------------
  |  |   33|    496|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
  |  Branch (222:9): [True: 160, False: 336]
  ------------------
  223|    160|        return 0;
  224|       |
  225|       |    /* Read the jump table. */
  226|    336|    {
  227|    336|        size_t const length1 = MEM_readLE16(istart);
  228|    336|        size_t const length2 = MEM_readLE16(istart+2);
  229|    336|        size_t const length3 = MEM_readLE16(istart+4);
  230|    336|        size_t const length4 = srcSize - (length1 + length2 + length3 + 6);
  231|    336|        args->iend[0] = istart + 6;  /* jumpTable */
  232|    336|        args->iend[1] = args->iend[0] + length1;
  233|    336|        args->iend[2] = args->iend[1] + length2;
  234|    336|        args->iend[3] = args->iend[2] + length3;
  235|       |
  236|       |        /* HUF_initFastDStream() requires this, and this small of an input
  237|       |         * won't benefit from the ASM loop anyways.
  238|       |         */
  239|    336|        if (length1 < 8 || length2 < 8 || length3 < 8 || length4 < 8)
  ------------------
  |  Branch (239:13): [True: 62, False: 274]
  |  Branch (239:28): [True: 42, False: 232]
  |  Branch (239:43): [True: 47, False: 185]
  |  Branch (239:58): [True: 7, False: 178]
  ------------------
  240|    158|            return 0;
  241|    178|        if (length4 > srcSize) return ERROR(corruption_detected);   /* overflow */
  ------------------
  |  |   49|     38|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     38|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     38|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (241:13): [True: 38, False: 140]
  ------------------
  242|    178|    }
  243|       |    /* ip[] contains the position that is currently loaded into bits[]. */
  244|    140|    args->ip[0] = args->iend[1] - sizeof(U64);
  245|    140|    args->ip[1] = args->iend[2] - sizeof(U64);
  246|    140|    args->ip[2] = args->iend[3] - sizeof(U64);
  247|    140|    args->ip[3] = (BYTE const*)src + srcSize - sizeof(U64);
  248|       |
  249|       |    /* op[] contains the output pointers. */
  250|    140|    args->op[0] = (BYTE*)dst;
  251|    140|    args->op[1] = args->op[0] + (dstSize+3)/4;
  252|    140|    args->op[2] = args->op[1] + (dstSize+3)/4;
  253|    140|    args->op[3] = args->op[2] + (dstSize+3)/4;
  254|       |
  255|       |    /* No point to call the ASM loop for tiny outputs. */
  256|    140|    if (args->op[3] >= oend)
  ------------------
  |  Branch (256:9): [True: 1, False: 139]
  ------------------
  257|      1|        return 0;
  258|       |
  259|       |    /* bits[] is the bit container.
  260|       |        * It is read from the MSB down to the LSB.
  261|       |        * It is shifted left as it is read, and zeros are
  262|       |        * shifted in. After the lowest valid bit a 1 is
  263|       |        * set, so that CountTrailingZeros(bits[]) can be used
  264|       |        * to count how many bits we've consumed.
  265|       |        */
  266|    139|    args->bits[0] = HUF_initFastDStream(args->ip[0]);
  267|    139|    args->bits[1] = HUF_initFastDStream(args->ip[1]);
  268|    139|    args->bits[2] = HUF_initFastDStream(args->ip[2]);
  269|    139|    args->bits[3] = HUF_initFastDStream(args->ip[3]);
  270|       |
  271|       |    /* The decoders must be sure to never read beyond ilowest.
  272|       |     * This is lower than iend[0], but allowing decoders to read
  273|       |     * down to ilowest can allow an extra iteration or two in the
  274|       |     * fast loop.
  275|       |     */
  276|    139|    args->ilowest = istart;
  277|       |
  278|    139|    args->oend = oend;
  279|    139|    args->dt = dt;
  280|       |
  281|    139|    return 1;
  282|    140|}
huf_decompress.c:HUF_initFastDStream:
  153|    556|static size_t HUF_initFastDStream(BYTE const* ip) {
  154|    556|    BYTE const lastByte = ip[7];
  155|    556|    size_t const bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
  ------------------
  |  Branch (155:33): [True: 472, False: 84]
  ------------------
  156|    556|    size_t const value = MEM_readLEST(ip) | 1;
  157|    556|    assert(bitsConsumed <= 8);
  ------------------
  |  |   70|    556|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  158|    556|    assert(sizeof(size_t) == 8);
  ------------------
  |  |   70|    556|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  159|    556|    return value << bitsConsumed;
  160|    556|}
huf_decompress.c:HUF_initRemainingDStream:
  285|    516|{
  286|       |    /* Validate that we haven't overwritten. */
  287|    516|    if (args->op[stream] > segmentEnd)
  ------------------
  |  Branch (287:9): [True: 0, False: 516]
  ------------------
  288|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  289|       |    /* The MSB is the next bit to read, so ip[] may be up to 8 bytes before
  290|       |     * iend[] when the stream is fully consumed. Compare distances rather than
  291|       |     * forming iend[0] - 8, which can be before the compressed input.
  292|       |     * No loaded word may precede ilowest. */
  293|    516|    if (args->ip[stream] < args->ilowest
  ------------------
  |  Branch (293:9): [True: 0, False: 516]
  ------------------
  294|    516|        || (args->ip[stream] < args->iend[stream]
  ------------------
  |  Branch (294:13): [True: 210, False: 306]
  ------------------
  295|    210|            && (size_t)(args->iend[stream] - args->ip[stream]) > 8))
  ------------------
  |  Branch (295:16): [True: 31, False: 179]
  ------------------
  296|     31|        return ERROR(corruption_detected);
  ------------------
  |  |   49|     31|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     31|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     31|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  297|       |
  298|       |    /* Construct the BIT_DStream_t. */
  299|    485|    assert(sizeof(size_t) == 8);
  ------------------
  |  |   70|    485|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  300|    485|    bit->bitContainer = MEM_readLEST(args->ip[stream]);
  301|    485|    bit->bitsConsumed = ZSTD_countTrailingZeros64(args->bits[stream]);
  302|    485|    bit->start = (const char*)args->ilowest;
  303|    485|    bit->limitPtr = bit->start + sizeof(size_t);
  304|    485|    bit->ptr = (const char*)args->ip[stream];
  305|       |
  306|    485|    return 0;
  307|    516|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal:
  905|    256|{
  906|    256|    HUF_DecompressUsingDTableFn fallbackFn = HUF_decompress4X1_usingDTable_internal_default;
  907|    256|    HUF_DecompressFastLoopFn loopFn = HUF_decompress4X1_usingDTable_internal_fast_c_loop;
  908|       |
  909|    256|    if (ZSTD_USE_BMI2(flags & HUF_flags_bmi2)) {
  ------------------
  |  |   36|    256|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 256, False: 0]
  |  |  ------------------
  ------------------
  910|    256|        fallbackFn = HUF_decompress4X1_usingDTable_internal_bmi2;
  911|    256|# if ZSTD_ENABLE_ASM_X86_64_BMI2
  912|    256|        if (!(flags & HUF_flags_disableAsm)) {
  ------------------
  |  Branch (912:13): [True: 256, False: 0]
  ------------------
  913|    256|            loopFn = HUF_decompress4X1_usingDTable_internal_fast_asm_loop;
  914|    256|        }
  915|    256|# endif
  916|    256|    } else if (DYNAMIC_BMI2) {
  ------------------
  |  |   99|      0|#    define DYNAMIC_BMI2 1
  |  |  ------------------
  |  |  |  Branch (99:26): [True: 0, Folded]
  |  |  ------------------
  ------------------
  917|      0|        return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
  918|      0|    }
  919|       |
  920|       |#if ZSTD_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__)
  921|       |    if (!(flags & HUF_flags_disableAsm)) {
  922|       |        loopFn = HUF_decompress4X1_usingDTable_internal_fast_asm_loop;
  923|       |    }
  924|       |#endif
  925|       |
  926|    256|    if (HUF_ENABLE_FAST_DECODE && !(flags & HUF_flags_disableFast)) {
  ------------------
  |  |   42|    512|# define HUF_ENABLE_FAST_DECODE 1
  |  |  ------------------
  |  |  |  Branch (42:33): [True: 256, Folded]
  |  |  ------------------
  ------------------
  |  Branch (926:35): [True: 256, False: 0]
  ------------------
  927|    256|        size_t const ret = HUF_decompress4X1_usingDTable_internal_fast(dst, dstSize, cSrc, cSrcSize, DTable, loopFn);
  928|    256|        if (ret != 0)
  ------------------
  |  Branch (928:13): [True: 109, False: 147]
  ------------------
  929|    109|            return ret;
  930|    256|    }
  931|    147|    return fallbackFn(dst, dstSize, cSrc, cSrcSize, DTable);
  932|    256|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal_body:
  610|    147|{
  611|       |    /* Check */
  612|    147|    if (cSrcSize < 10) return ERROR(corruption_detected);  /* strict minimum : jump table + 1 byte per stream */
  ------------------
  |  |   49|      0|#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 (612:9): [True: 0, False: 147]
  ------------------
  613|    147|    if (dstSize < 6) return ERROR(corruption_detected);         /* stream 4-split doesn't work */
  ------------------
  |  |   49|      0|#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 (613:9): [True: 0, False: 147]
  ------------------
  614|       |
  615|    147|    {   const BYTE* const istart = (const BYTE*) cSrc;
  616|    147|        BYTE* const ostart = (BYTE*) dst;
  617|    147|        BYTE* const oend = ostart + dstSize;
  618|    147|        BYTE* const olimit = oend - 3;
  619|    147|        const void* const dtPtr = DTable + 1;
  620|    147|        const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr;
  621|       |
  622|       |        /* Init */
  623|    147|        BIT_DStream_t bitD1;
  624|    147|        BIT_DStream_t bitD2;
  625|    147|        BIT_DStream_t bitD3;
  626|    147|        BIT_DStream_t bitD4;
  627|    147|        size_t const length1 = MEM_readLE16(istart);
  628|    147|        size_t const length2 = MEM_readLE16(istart+2);
  629|    147|        size_t const length3 = MEM_readLE16(istart+4);
  630|    147|        size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6);
  631|    147|        const BYTE* const istart1 = istart + 6;  /* jumpTable */
  632|    147|        const BYTE* const istart2 = istart1 + length1;
  633|    147|        const BYTE* const istart3 = istart2 + length2;
  634|    147|        const BYTE* const istart4 = istart3 + length3;
  635|    147|        const size_t segmentSize = (dstSize+3) / 4;
  636|    147|        BYTE* const opStart2 = ostart + segmentSize;
  637|    147|        BYTE* const opStart3 = opStart2 + segmentSize;
  638|    147|        BYTE* const opStart4 = opStart3 + segmentSize;
  639|    147|        BYTE* op1 = ostart;
  640|    147|        BYTE* op2 = opStart2;
  641|    147|        BYTE* op3 = opStart3;
  642|    147|        BYTE* op4 = opStart4;
  643|    147|        DTableDesc const dtd = HUF_getDTableDesc(DTable);
  644|    147|        U32 const dtLog = dtd.tableLog;
  645|    147|        U32 endSignal = 1;
  646|       |
  647|    147|        if (length4 > cSrcSize) return ERROR(corruption_detected);   /* overflow */
  ------------------
  |  |   49|     25|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     25|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     25|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (647:13): [True: 25, False: 122]
  ------------------
  648|    122|        if (opStart4 > oend) 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 (648:13): [True: 0, False: 122]
  ------------------
  649|    122|        assert(dstSize >= 6); /* validated above */
  ------------------
  |  |   70|    122|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  650|    122|        CHECK_F( BIT_initDStream(&bitD1, istart1, length1) );
  ------------------
  |  |   63|    122|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    122|    size_t const e = f;     \
  |  |  |  |   59|    122|    do {                    \
  |  |  |  |   60|    122|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 6, False: 116]
  |  |  |  |  ------------------
  |  |  |  |   61|    122|            return e;       \
  |  |  |  |   62|    122|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 116]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 116]
  |  |  ------------------
  ------------------
  651|    116|        CHECK_F( BIT_initDStream(&bitD2, istart2, length2) );
  ------------------
  |  |   63|    116|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    116|    size_t const e = f;     \
  |  |  |  |   59|    116|    do {                    \
  |  |  |  |   60|    116|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 6, False: 110]
  |  |  |  |  ------------------
  |  |  |  |   61|    116|            return e;       \
  |  |  |  |   62|    116|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 110]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 110]
  |  |  ------------------
  ------------------
  652|    110|        CHECK_F( BIT_initDStream(&bitD3, istart3, length3) );
  ------------------
  |  |   63|    110|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    110|    size_t const e = f;     \
  |  |  |  |   59|    110|    do {                    \
  |  |  |  |   60|    110|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 2, False: 108]
  |  |  |  |  ------------------
  |  |  |  |   61|    110|            return e;       \
  |  |  |  |   62|    110|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 108]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 108]
  |  |  ------------------
  ------------------
  653|    108|        CHECK_F( BIT_initDStream(&bitD4, istart4, length4) );
  ------------------
  |  |   63|    108|#define CHECK_F(f)   do { CHECK_V_F(_var_err__, f); } while (0)
  |  |  ------------------
  |  |  |  |   58|    108|    size_t const e = f;     \
  |  |  |  |   59|    108|    do {                    \
  |  |  |  |   60|    108|        if (ERR_isError(e)) \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (60:13): [True: 3, False: 105]
  |  |  |  |  ------------------
  |  |  |  |   61|    108|            return e;       \
  |  |  |  |   62|    108|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:14): [Folded, False: 105]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:62): [Folded, False: 105]
  |  |  ------------------
  ------------------
  654|       |
  655|       |        /* up to 16 symbols per loop (4 symbols per stream) in 64-bit mode */
  656|    105|        if ((size_t)(oend - op4) >= sizeof(size_t)) {
  ------------------
  |  Branch (656:13): [True: 95, False: 10]
  ------------------
  657|  2.08k|            for ( ; (endSignal) & (op4 < olimit) ; ) {
  ------------------
  |  Branch (657:21): [True: 1.98k, False: 95]
  ------------------
  658|  1.98k|                HUF_DECODE_SYMBOLX1_2(op1, &bitD1);
  ------------------
  |  |  544|  1.98k|    do {                                            \
  |  |  545|  1.98k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 1.98k, False: 0]
  |  |  ------------------
  |  |  546|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  659|  1.98k|                HUF_DECODE_SYMBOLX1_2(op2, &bitD2);
  ------------------
  |  |  544|  1.98k|    do {                                            \
  |  |  545|  1.98k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 1.98k, False: 0]
  |  |  ------------------
  |  |  546|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  660|  1.98k|                HUF_DECODE_SYMBOLX1_2(op3, &bitD3);
  ------------------
  |  |  544|  1.98k|    do {                                            \
  |  |  545|  1.98k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 1.98k, False: 0]
  |  |  ------------------
  |  |  546|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  661|  1.98k|                HUF_DECODE_SYMBOLX1_2(op4, &bitD4);
  ------------------
  |  |  544|  1.98k|    do {                                            \
  |  |  545|  1.98k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 1.98k, False: 0]
  |  |  ------------------
  |  |  546|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  662|  1.98k|                HUF_DECODE_SYMBOLX1_1(op1, &bitD1);
  ------------------
  |  |  538|  1.98k|    do {                                            \
  |  |  539|  1.98k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (539:13): [True: 1.98k, False: 0]
  |  |  |  Branch (539:29): [True: 0, Folded]
  |  |  ------------------
  |  |  540|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  541|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (541:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  663|  1.98k|                HUF_DECODE_SYMBOLX1_1(op2, &bitD2);
  ------------------
  |  |  538|  1.98k|    do {                                            \
  |  |  539|  1.98k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (539:13): [True: 1.98k, False: 0]
  |  |  |  Branch (539:29): [True: 0, Folded]
  |  |  ------------------
  |  |  540|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  541|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (541:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  664|  1.98k|                HUF_DECODE_SYMBOLX1_1(op3, &bitD3);
  ------------------
  |  |  538|  1.98k|    do {                                            \
  |  |  539|  1.98k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (539:13): [True: 1.98k, False: 0]
  |  |  |  Branch (539:29): [True: 0, Folded]
  |  |  ------------------
  |  |  540|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  541|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (541:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  665|  1.98k|                HUF_DECODE_SYMBOLX1_1(op4, &bitD4);
  ------------------
  |  |  538|  1.98k|    do {                                            \
  |  |  539|  1.98k|        if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \
  |  |  ------------------
  |  |  |  |   37|      0|#define HUF_TABLELOG_MAX      12      /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
  |  |  ------------------
  |  |  |  Branch (539:13): [True: 1.98k, False: 0]
  |  |  |  Branch (539:29): [True: 0, Folded]
  |  |  ------------------
  |  |  540|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  541|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (541:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  666|  1.98k|                HUF_DECODE_SYMBOLX1_2(op1, &bitD1);
  ------------------
  |  |  544|  1.98k|    do {                                            \
  |  |  545|  1.98k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 1.98k, False: 0]
  |  |  ------------------
  |  |  546|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  667|  1.98k|                HUF_DECODE_SYMBOLX1_2(op2, &bitD2);
  ------------------
  |  |  544|  1.98k|    do {                                            \
  |  |  545|  1.98k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 1.98k, False: 0]
  |  |  ------------------
  |  |  546|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  668|  1.98k|                HUF_DECODE_SYMBOLX1_2(op3, &bitD3);
  ------------------
  |  |  544|  1.98k|    do {                                            \
  |  |  545|  1.98k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 1.98k, False: 0]
  |  |  ------------------
  |  |  546|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  669|  1.98k|                HUF_DECODE_SYMBOLX1_2(op4, &bitD4);
  ------------------
  |  |  544|  1.98k|    do {                                            \
  |  |  545|  1.98k|        if (MEM_64bits())                           \
  |  |  ------------------
  |  |  |  Branch (545:13): [True: 1.98k, False: 0]
  |  |  ------------------
  |  |  546|  1.98k|            HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr); \
  |  |  ------------------
  |  |  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  1.98k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (547:14): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  670|  1.98k|                HUF_DECODE_SYMBOLX1_0(op1, &bitD1);
  ------------------
  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  671|  1.98k|                HUF_DECODE_SYMBOLX1_0(op2, &bitD2);
  ------------------
  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  672|  1.98k|                HUF_DECODE_SYMBOLX1_0(op3, &bitD3);
  ------------------
  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  673|  1.98k|                HUF_DECODE_SYMBOLX1_0(op4, &bitD4);
  ------------------
  |  |  535|  1.98k|    do { *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog); } while (0)
  |  |  ------------------
  |  |  |  Branch (535:71): [Folded, False: 1.98k]
  |  |  ------------------
  ------------------
  674|  1.98k|                endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished;
  675|  1.98k|                endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished;
  676|  1.98k|                endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished;
  677|  1.98k|                endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished;
  678|  1.98k|            }
  679|     95|        }
  680|       |
  681|       |        /* check corruption */
  682|       |        /* note : should not be necessary : op# advance in lock step, and we control op4.
  683|       |         *        but curiously, binary generated by gcc 7.2 & 7.3 with -mbmi2 runs faster when >=1 test is present */
  684|    105|        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 (684:13): [True: 0, False: 105]
  ------------------
  685|    105|        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 (685:13): [True: 0, False: 105]
  ------------------
  686|    105|        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 (686:13): [True: 0, False: 105]
  ------------------
  687|       |        /* note : op4 supposed already verified within main loop */
  688|       |
  689|       |        /* finish bitStreams one by one */
  690|    105|        HUF_decodeStreamX1(op1, &bitD1, opStart2, dt, dtLog);
  691|    105|        HUF_decodeStreamX1(op2, &bitD2, opStart3, dt, dtLog);
  692|    105|        HUF_decodeStreamX1(op3, &bitD3, opStart4, dt, dtLog);
  693|    105|        HUF_decodeStreamX1(op4, &bitD4, oend,     dt, dtLog);
  694|       |
  695|       |        /* check */
  696|    105|        { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4);
  697|    105|          if (!endCheck) return ERROR(corruption_detected); }
  ------------------
  |  |   49|    105|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|    105|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|    105|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (697:15): [True: 105, False: 0]
  ------------------
  698|       |
  699|       |        /* decoded size */
  700|      0|        return dstSize;
  701|    105|    }
  702|    105|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal_bmi2:
  707|    147|                    size_t cSrcSize, HUF_DTable const* DTable) {
  708|    147|    return HUF_decompress4X1_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable);
  709|    147|}
huf_decompress.c:HUF_decompress4X1_usingDTable_internal_fast:
  851|    256|{
  852|    256|    void const* dt = DTable + 1;
  853|    256|    BYTE const* const ilowest = (BYTE const*)cSrc;
  854|    256|    BYTE* const oend = (BYTE*)ZSTD_maybeNullPtrAdd(dst, (ptrdiff_t)dstSize);
  855|    256|    HUF_DecompressFastArgs args;
  856|    256|    {   size_t const ret = HUF_DecompressFastArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable);
  857|    256|        FORWARD_IF_ERROR(ret, "Failed to init fast loop args");
  ------------------
  |  |  146|    256|    do {                                                                           \
  |  |  147|    256|        size_t const err_code = (err);                                             \
  |  |  148|    256|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 54, False: 202]
  |  |  ------------------
  |  |  149|     54|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     54|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     54|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     54|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     54|    do {                                           \
  |  |  |  |   99|     54|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     54|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     54|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     54|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     54|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     54|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     54|            return err_code;                                                       \
  |  |  155|     54|        }                                                                          \
  |  |  156|    256|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 202]
  |  |  ------------------
  ------------------
  858|    202|        if (ret == 0)
  ------------------
  |  Branch (858:13): [True: 147, False: 55]
  ------------------
  859|    147|            return 0;
  860|    202|    }
  861|       |
  862|     55|    assert(args.ip[0] >= args.ilowest);
  ------------------
  |  |   70|     55|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  863|     55|    loopFn(&args);
  864|       |
  865|       |    /* Our loop guarantees that ip[] >= ilowest and that we haven't
  866|       |    * overwritten any op[].
  867|       |    */
  868|     55|    assert(args.ip[0] >= ilowest);
  ------------------
  |  |   70|     55|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  869|     55|    assert(args.ip[0] >= ilowest);
  ------------------
  |  |   70|     55|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  870|     55|    assert(args.ip[1] >= ilowest);
  ------------------
  |  |   70|     55|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  871|     55|    assert(args.ip[2] >= ilowest);
  ------------------
  |  |   70|     55|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  872|     55|    assert(args.ip[3] >= ilowest);
  ------------------
  |  |   70|     55|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  873|     55|    assert(args.op[3] <= oend);
  ------------------
  |  |   70|     55|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  874|       |
  875|     55|    assert(ilowest == args.ilowest);
  ------------------
  |  |   70|     55|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  876|     55|    assert(ilowest + 6 == args.iend[0]);
  ------------------
  |  |   70|     55|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  877|     55|    (void)ilowest;
  878|       |
  879|       |    /* finish bit streams one by one. */
  880|     55|    {   size_t const segmentSize = (dstSize+3) / 4;
  881|     55|        BYTE* segmentEnd = (BYTE*)dst;
  882|     55|        int i;
  883|    252|        for (i = 0; i < 4; ++i) {
  ------------------
  |  Branch (883:21): [True: 207, False: 45]
  ------------------
  884|    207|            BIT_DStream_t bit;
  885|    207|            if (segmentSize <= (size_t)(oend - segmentEnd))
  ------------------
  |  Branch (885:17): [True: 166, False: 41]
  ------------------
  886|    166|                segmentEnd += segmentSize;
  887|     41|            else
  888|     41|                segmentEnd = oend;
  889|    207|            FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption");
  ------------------
  |  |  146|    207|    do {                                                                           \
  |  |  147|    207|        size_t const err_code = (err);                                             \
  |  |  148|    207|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 10, False: 197]
  |  |  ------------------
  |  |  149|     10|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|     10|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|     10|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|     10|    do {                                           \
  |  |  |  |   99|     10|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     10|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|     10|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|     10|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|     10|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|     10|            return err_code;                                                       \
  |  |  155|     10|        }                                                                          \
  |  |  156|    207|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 197]
  |  |  ------------------
  ------------------
  890|       |            /* Decompress and validate that we've produced exactly the expected length. */
  891|    197|            args.op[i] += HUF_decodeStreamX1(args.op[i], &bit, segmentEnd, (HUF_DEltX1 const*)dt, HUF_DECODER_FAST_TABLELOG);
  ------------------
  |  |   33|    197|#define HUF_DECODER_FAST_TABLELOG 11
  ------------------
  892|    197|            if (args.op[i] != segmentEnd) 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 (892:17): [True: 0, False: 197]
  ------------------
  893|    197|        }
  894|     55|    }
  895|       |
  896|       |    /* decoded size */
  897|     45|    assert(dstSize != 0);
  ------------------
  |  |   70|     45|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  898|     45|    return dstSize;
  899|     55|}
huf_decompress.c:HUF_decompress4X2_DCtx_wksp:
 1786|    267|{
 1787|    267|    const BYTE* ip = (const BYTE*) cSrc;
 1788|       |
 1789|    267|    size_t hSize = HUF_readDTableX2_wksp(dctx, cSrc, cSrcSize,
 1790|    267|                                         workSpace, wkspSize, flags);
 1791|    267|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   80|    267|#define HUF_isError ERR_isError
  ------------------
  |  Branch (1791:9): [True: 9, False: 258]
  ------------------
 1792|    258|    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 (1792:9): [True: 0, False: 258]
  ------------------
 1793|    258|    ip += hSize; cSrcSize -= hSize;
 1794|       |
 1795|    258|    return HUF_decompress4X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
 1796|    258|}
huf_decompress.c:HUF_decompress4X1_DCtx_wksp:
  937|    430|{
  938|    430|    const BYTE* ip = (const BYTE*) cSrc;
  939|       |
  940|    430|    size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize, flags);
  941|    430|    if (HUF_isError(hSize)) return hSize;
  ------------------
  |  |   80|    430|#define HUF_isError ERR_isError
  ------------------
  |  Branch (941:9): [True: 166, False: 264]
  ------------------
  942|    264|    if (hSize >= cSrcSize) return ERROR(srcSize_wrong);
  ------------------
  |  |   49|     10|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|     10|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|     10|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (942:9): [True: 10, False: 254]
  ------------------
  943|    254|    ip += hSize; cSrcSize -= hSize;
  944|       |
  945|    254|    return HUF_decompress4X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, flags);
  946|    264|}

ZSTD_DDict_dictContent:
   48|  1.39k|{
   49|  1.39k|    assert(ddict != NULL);
  ------------------
  |  |   70|  1.39k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   50|  1.39k|    return ddict->dictContent;
   51|  1.39k|}
ZSTD_DDict_dictSize:
   54|  2.78k|{
   55|  2.78k|    assert(ddict != NULL);
  ------------------
  |  |   70|  2.78k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   56|  2.78k|    return ddict->dictSize;
   57|  2.78k|}
ZSTD_copyDDictParameters:
   60|  1.39k|{
   61|  1.39k|    const void* content;
   62|  1.39k|    DEBUGLOG(4, "ZSTD_copyDDictParameters");
  ------------------
  |  |  104|  1.39k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 1.39k]
  |  |  ------------------
  ------------------
   63|  1.39k|    assert(dctx != NULL);
  ------------------
  |  |   70|  1.39k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   64|  1.39k|    assert(ddict != NULL);
  ------------------
  |  |   70|  1.39k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   65|  1.39k|    content = ddict->dictHeaderSize != 0
  ------------------
  |  Branch (65:15): [True: 1, False: 1.39k]
  ------------------
   66|  1.39k|            ? (const BYTE*)ddict->dictContent + ddict->dictHeaderSize
   67|  1.39k|            : ddict->dictContent;
   68|  1.39k|    dctx->dictID = ddict->dictID;
   69|  1.39k|    dctx->prefixStart = content;
   70|  1.39k|    dctx->virtualStart = content;
   71|       |    /* An empty DDict may have NULL content. */
   72|  1.39k|    dctx->dictEnd = ddict->dictSize != 0
  ------------------
  |  Branch (72:21): [True: 1.39k, False: 0]
  ------------------
   73|  1.39k|            ? (const BYTE*)ddict->dictContent + ddict->dictSize
   74|  1.39k|            : ddict->dictContent;
   75|  1.39k|    dctx->previousDstEnd = dctx->dictEnd;
   76|  1.39k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
   77|  1.39k|    dctx->dictContentBeginForFuzzing = dctx->prefixStart;
   78|  1.39k|    dctx->dictContentEndForFuzzing = dctx->previousDstEnd;
   79|  1.39k|#endif
   80|  1.39k|    if (ddict->entropyPresent) {
  ------------------
  |  Branch (80:9): [True: 1, False: 1.39k]
  ------------------
   81|      1|        dctx->litEntropy = 1;
   82|      1|        dctx->fseEntropy = 1;
   83|      1|        dctx->LLTptr = ddict->entropy.LLTable;
   84|      1|        dctx->MLTptr = ddict->entropy.MLTable;
   85|      1|        dctx->OFTptr = ddict->entropy.OFTable;
   86|      1|        dctx->HUFptr = ddict->entropy.hufTable;
   87|      1|        dctx->entropy.rep[0] = ddict->entropy.rep[0];
   88|      1|        dctx->entropy.rep[1] = ddict->entropy.rep[1];
   89|      1|        dctx->entropy.rep[2] = ddict->entropy.rep[2];
   90|  1.39k|    } else {
   91|  1.39k|        dctx->litEntropy = 0;
   92|  1.39k|        dctx->fseEntropy = 0;
   93|  1.39k|    }
   94|  1.39k|}
ZSTD_createDDict_advanced_internal:
  164|  6.14k|{
  165|  6.14k|    ZSTD_DDict* ddict;
  166|  6.14k|    *ddictPtr = NULL;
  167|  6.14k|    RETURN_ERROR_IF((!customMem.customAlloc) ^ (!customMem.customFree),
  ------------------
  |  |  114|  6.14k|    do {                                                                       \
  |  |  115|  6.14k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 6.14k]
  |  |  ------------------
  |  |  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.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 6.14k]
  |  |  ------------------
  ------------------
  168|  6.14k|                    parameter_combination_unsupported, "Invalid custom allocator");
  169|       |
  170|  6.14k|    ddict = (ZSTD_DDict*) ZSTD_customMalloc(sizeof(ZSTD_DDict), customMem);
  171|  6.14k|    RETURN_ERROR_IF(ddict == NULL, memory_allocation, "");
  ------------------
  |  |  114|  6.14k|    do {                                                                       \
  |  |  115|  6.14k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 6.14k]
  |  |  ------------------
  |  |  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.14k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 6.14k]
  |  |  ------------------
  ------------------
  172|  6.14k|    ddict->cMem = customMem;
  173|  6.14k|    {   size_t const initResult = ZSTD_initDDict_internal(ddict,
  174|  6.14k|                                        dict, dictSize,
  175|  6.14k|                                        dictLoadMethod, dictContentType);
  176|  6.14k|        if (ZSTD_isError(initResult)) {
  ------------------
  |  |   44|  6.14k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (176:13): [True: 392, False: 5.75k]
  ------------------
  177|    392|            ZSTD_freeDDict(ddict);
  178|    392|            return initResult;
  179|    392|    }   }
  180|  5.75k|    *ddictPtr = ddict;
  181|  5.75k|    return 0;
  182|  6.14k|}
ZSTD_createDDict_advanced:
  188|  6.14k|{
  189|  6.14k|    ZSTD_DDict* ddict;
  190|  6.14k|    size_t const err = ZSTD_createDDict_advanced_internal(&ddict,
  191|  6.14k|                            dict, dictSize, dictLoadMethod, dictContentType, customMem);
  192|  6.14k|    if (ZSTD_isError(err)) return NULL;
  ------------------
  |  |   44|  6.14k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (192:9): [True: 392, False: 5.75k]
  ------------------
  193|  5.75k|    return ddict;
  194|  6.14k|}
ZSTD_createDDict:
  201|  6.14k|{
  202|  6.14k|    ZSTD_customMem const allocator = { NULL, NULL, NULL };
  203|  6.14k|    return ZSTD_createDDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, allocator);
  204|  6.14k|}
ZSTD_freeDDict:
  242|  11.4k|{
  243|  11.4k|    if (ddict==NULL) return 0;   /* support free on NULL */
  ------------------
  |  Branch (243:9): [True: 5.27k, False: 6.14k]
  ------------------
  244|  6.14k|    {   ZSTD_customMem const cMem = ddict->cMem;
  245|  6.14k|        ZSTD_customFree(ddict->dictBuffer, cMem);
  246|  6.14k|        ZSTD_customFree(ddict, cMem);
  247|  6.14k|        return 0;
  248|  11.4k|    }
  249|  11.4k|}
ZSTD_sizeof_DDict:
  263|  3.24k|{
  264|  3.24k|    if (ddict==NULL) return 0;   /* support sizeof on NULL */
  ------------------
  |  Branch (264:9): [True: 3.24k, False: 0]
  ------------------
  265|      0|    return sizeof(*ddict) + (ddict->dictBuffer ? ddict->dictSize : 0) ;
  ------------------
  |  Branch (265:30): [True: 0, False: 0]
  ------------------
  266|  3.24k|}
zstd_ddict.c:ZSTD_initDDict_internal:
  136|  6.14k|{
  137|       |    /* An empty dictionary has no referenced storage, even in by-copy mode. */
  138|  6.14k|    if (dictSize == 0) dict = NULL;
  ------------------
  |  Branch (138:9): [True: 0, False: 6.14k]
  ------------------
  139|  6.14k|    if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dict) || (!dictSize)) {
  ------------------
  |  Branch (139:9): [True: 0, False: 6.14k]
  |  Branch (139:47): [True: 0, False: 6.14k]
  |  Branch (139:58): [True: 0, False: 6.14k]
  ------------------
  140|      0|        ddict->dictBuffer = NULL;
  141|      0|        ddict->dictContent = dict;
  142|      0|        if (!dict) dictSize = 0;
  ------------------
  |  Branch (142:13): [True: 0, False: 0]
  ------------------
  143|  6.14k|    } else {
  144|  6.14k|        void* const internalBuffer = ZSTD_customMalloc(dictSize, ddict->cMem);
  145|  6.14k|        ddict->dictBuffer = internalBuffer;
  146|  6.14k|        ddict->dictContent = internalBuffer;
  147|  6.14k|        if (!internalBuffer) return ERROR(memory_allocation);
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (147:13): [True: 0, False: 6.14k]
  ------------------
  148|  6.14k|        ZSTD_memcpy(internalBuffer, dict, dictSize);
  ------------------
  |  |   44|  6.14k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  149|  6.14k|    }
  150|  6.14k|    ddict->dictSize = dictSize;
  151|  6.14k|    ddict->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001);  /* cover both little and big endian */
  ------------------
  |  |   78|  6.14k|#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
  ------------------
  152|       |
  153|       |    /* parse dictionary content */
  154|  6.14k|    FORWARD_IF_ERROR( ZSTD_loadEntropy_intoDDict(ddict, dictContentType) , "");
  ------------------
  |  |  146|  6.14k|    do {                                                                           \
  |  |  147|  6.14k|        size_t const err_code = (err);                                             \
  |  |  148|  6.14k|        if (ERR_isError(err_code)) {                                               \
  |  |  ------------------
  |  |  |  Branch (148:13): [True: 392, False: 5.75k]
  |  |  ------------------
  |  |  149|    392|            RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s",                 \
  |  |  ------------------
  |  |  |  |  103|    392|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  150|    392|                  __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
  |  |  151|    392|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                                 \
  |  |  ------------------
  |  |  |  |   98|    392|    do {                                           \
  |  |  |  |   99|    392|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    392|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|    392|            RAWLOG(3, ": " __VA_ARGS__);                                           \
  |  |  ------------------
  |  |  |  |  103|    392|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|    392|            RAWLOG(3, "\n");                                                       \
  |  |  ------------------
  |  |  |  |  103|    392|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|    392|            return err_code;                                                       \
  |  |  155|    392|        }                                                                          \
  |  |  156|  6.14k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (156:13): [Folded, False: 5.75k]
  |  |  ------------------
  ------------------
  155|       |
  156|  5.75k|    return 0;
  157|  6.14k|}
zstd_ddict.c:ZSTD_loadEntropy_intoDDict:
  100|  6.14k|{
  101|  6.14k|    ddict->dictID = 0;
  102|  6.14k|    ddict->dictHeaderSize = 0;
  103|  6.14k|    ddict->entropyPresent = 0;
  104|  6.14k|    if (dictContentType == ZSTD_dct_rawContent) return 0;
  ------------------
  |  Branch (104:9): [True: 0, False: 6.14k]
  ------------------
  105|       |
  106|  6.14k|    if (ddict->dictSize < 8) {
  ------------------
  |  Branch (106:9): [True: 2.62k, False: 3.51k]
  ------------------
  107|  2.62k|        if (dictContentType == ZSTD_dct_fullDict)
  ------------------
  |  Branch (107:13): [True: 0, False: 2.62k]
  ------------------
  108|      0|            return ERROR(dictionary_corrupted);   /* only accept specified dictionaries */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  109|  2.62k|        return 0;   /* pure content mode */
  110|  2.62k|    }
  111|  3.51k|    {   U32 const magic = MEM_readLE32(ddict->dictContent);
  112|  3.51k|        if (magic != ZSTD_MAGIC_DICTIONARY) {
  ------------------
  |  |  143|  3.51k|#define ZSTD_MAGIC_DICTIONARY       0xEC30A437    /* valid since v0.7.0 */
  ------------------
  |  Branch (112:13): [True: 3.12k, False: 394]
  ------------------
  113|  3.12k|            if (dictContentType == ZSTD_dct_fullDict)
  ------------------
  |  Branch (113:17): [True: 0, False: 3.12k]
  ------------------
  114|      0|                return ERROR(dictionary_corrupted);   /* only accept specified dictionaries */
  ------------------
  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  ------------------
  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  115|  3.12k|            return 0;   /* pure content mode */
  116|  3.12k|        }
  117|  3.51k|    }
  118|    394|    ddict->dictID = MEM_readLE32((const char*)ddict->dictContent + ZSTD_FRAMEIDSIZE);
  ------------------
  |  |   82|    394|#define ZSTD_FRAMEIDSIZE 4   /* magic number size */
  ------------------
  119|       |
  120|       |    /* load entropy tables */
  121|    394|    {   size_t const headerSize = ZSTD_loadDEntropy(
  122|    394|                &ddict->entropy, ddict->dictContent, ddict->dictSize);
  123|    394|        RETURN_ERROR_IF(ZSTD_isError(headerSize), dictionary_corrupted, "");
  ------------------
  |  |  114|    394|    do {                                                                       \
  |  |  115|    394|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 392, False: 2]
  |  |  ------------------
  |  |  116|    392|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    392|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    392|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    392|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    392|    do {                                           \
  |  |  |  |   99|    392|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    392|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    392|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    392|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    392|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    392|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    392|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    392|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    392|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    392|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    392|        }                                                                      \
  |  |  123|    394|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
  124|      2|        assert(headerSize <= ddict->dictSize);
  ------------------
  |  |   70|      2|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  125|      2|        ddict->dictHeaderSize = headerSize;
  126|      2|    }
  127|      0|    ddict->entropyPresent = 1;
  128|      2|    return 0;
  129|    394|}

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

ZSTD_getcBlockSize:
   65|  5.29k|{
   66|  5.29k|    RETURN_ERROR_IF(srcSize < ZSTD_blockHeaderSize, srcSize_wrong, "");
  ------------------
  |  |  114|  5.29k|    do {                                                                       \
  |  |  115|  5.29k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 4, False: 5.29k]
  |  |  ------------------
  |  |  116|      4|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      4|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      4|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      4|    do {                                           \
  |  |  |  |   99|      4|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      4|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      4|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      4|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      4|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      4|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      4|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      4|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      4|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      4|        }                                                                      \
  |  |  123|  5.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 5.29k]
  |  |  ------------------
  ------------------
   67|       |
   68|  5.29k|    {   U32 const cBlockHeader = MEM_readLE24(src);
   69|  5.29k|        U32 const cSize = cBlockHeader >> 3;
   70|  5.29k|        bpPtr->lastBlock = cBlockHeader & 1;
   71|  5.29k|        bpPtr->blockType = (blockType_e)((cBlockHeader >> 1) & 3);
   72|  5.29k|        bpPtr->origSize = cSize;   /* only useful for RLE */
   73|  5.29k|        if (bpPtr->blockType == bt_rle) return 1;
  ------------------
  |  Branch (73:13): [True: 515, False: 4.77k]
  ------------------
   74|  4.77k|        RETURN_ERROR_IF(bpPtr->blockType == bt_reserved, corruption_detected, "");
  ------------------
  |  |  114|  4.77k|    do {                                                                       \
  |  |  115|  4.77k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 14, False: 4.76k]
  |  |  ------------------
  |  |  116|     14|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     14|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     14|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     14|    do {                                           \
  |  |  |  |   99|     14|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     14|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     14|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     14|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     14|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     14|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     14|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     14|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     14|        }                                                                      \
  |  |  123|  4.77k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 4.76k]
  |  |  ------------------
  ------------------
   75|  4.76k|        return cSize;
   76|  4.77k|    }
   77|  4.77k|}
ZSTD_buildFSETable:
  656|  3.33k|{
  657|  3.33k|    if (ZSTD_USE_BMI2(bmi2)) {
  ------------------
  |  |   36|  3.33k|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 2.77k, False: 556]
  |  |  ------------------
  ------------------
  658|  2.77k|        ZSTD_buildFSETable_body_bmi2(dt, normalizedCounter, maxSymbolValue,
  659|  2.77k|                baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  660|  2.77k|        return;
  661|  2.77k|    }
  662|    556|    (void)bmi2;
  663|    556|    ZSTD_buildFSETable_body_default(dt, normalizedCounter, maxSymbolValue,
  664|    556|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  665|    556|}
ZSTD_decodeSeqHeaders:
  721|  2.47k|{
  722|  2.47k|    const BYTE* const istart = (const BYTE*)src;
  723|  2.47k|    const BYTE* const iend = istart + srcSize;
  724|  2.47k|    const BYTE* ip = istart;
  725|  2.47k|    int nbSeq;
  726|  2.47k|    DEBUGLOG(5, "ZSTD_decodeSeqHeaders");
  ------------------
  |  |  104|  2.47k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.47k]
  |  |  ------------------
  ------------------
  727|       |
  728|       |    /* check */
  729|  2.47k|    RETURN_ERROR_IF(srcSize < MIN_SEQUENCES_SIZE, srcSize_wrong, "");
  ------------------
  |  |  114|  2.47k|    do {                                                                       \
  |  |  115|  2.47k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 15, False: 2.46k]
  |  |  ------------------
  |  |  116|     15|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     15|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     15|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     15|    do {                                           \
  |  |  |  |   99|     15|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     15|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     15|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     15|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     15|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     15|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     15|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     15|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     15|        }                                                                      \
  |  |  123|  2.47k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.46k]
  |  |  ------------------
  ------------------
  730|       |
  731|       |    /* SeqHead */
  732|  2.46k|    nbSeq = *ip++;
  733|  2.46k|    if (nbSeq > 0x7F) {
  ------------------
  |  Branch (733:9): [True: 1.67k, False: 781]
  ------------------
  734|  1.67k|        if (nbSeq == 0xFF) {
  ------------------
  |  Branch (734:13): [True: 49, False: 1.63k]
  ------------------
  735|     49|            RETURN_ERROR_IF(ip+2 > iend, srcSize_wrong, "");
  ------------------
  |  |  114|     49|    do {                                                                       \
  |  |  115|     49|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 48]
  |  |  ------------------
  |  |  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|     49|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  736|     48|            nbSeq = MEM_readLE16(ip) + LONGNBSEQ;
  ------------------
  |  |   96|     48|#define LONGNBSEQ 0x7F00
  ------------------
  737|     48|            ip+=2;
  738|  1.63k|        } else {
  739|  1.63k|            RETURN_ERROR_IF(ip >= iend, srcSize_wrong, "");
  ------------------
  |  |  114|  1.63k|    do {                                                                       \
  |  |  115|  1.63k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 1.62k]
  |  |  ------------------
  |  |  116|      2|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      2|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      2|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      2|    do {                                           \
  |  |  |  |   99|      2|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      2|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      2|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      2|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      2|        }                                                                      \
  |  |  123|  1.63k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.62k]
  |  |  ------------------
  ------------------
  740|  1.62k|            nbSeq = ((nbSeq-0x80)<<8) + *ip++;
  741|  1.62k|        }
  742|  1.67k|    }
  743|  2.45k|    *nbSeqPtr = nbSeq;
  744|       |
  745|  2.45k|    if (nbSeq == 0) {
  ------------------
  |  Branch (745:9): [True: 192, False: 2.26k]
  ------------------
  746|       |        /* No sequence : section ends immediately */
  747|    192|        RETURN_ERROR_IF(ip != iend, corruption_detected,
  ------------------
  |  |  114|    192|    do {                                                                       \
  |  |  115|    192|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 17, False: 175]
  |  |  ------------------
  |  |  116|     17|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     17|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     17|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     17|    do {                                           \
  |  |  |  |   99|     17|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     17|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     17|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     17|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     17|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     17|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     17|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     17|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     17|        }                                                                      \
  |  |  123|    192|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 175]
  |  |  ------------------
  ------------------
  748|    192|            "extraneous data present in the Sequences section");
  749|    175|        return (size_t)(ip - istart);
  750|    192|    }
  751|       |
  752|       |    /* FSE table descriptors */
  753|  2.26k|    RETURN_ERROR_IF(ip+1 > iend, srcSize_wrong, ""); /* minimum possible size: 1 byte for symbol encoding types */
  ------------------
  |  |  114|  2.26k|    do {                                                                       \
  |  |  115|  2.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 2.26k]
  |  |  ------------------
  |  |  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|  2.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.26k]
  |  |  ------------------
  ------------------
  754|  2.26k|    RETURN_ERROR_IF(*ip & 3, corruption_detected, ""); /* The last field, Reserved, must be all-zeroes. */
  ------------------
  |  |  114|  2.26k|    do {                                                                       \
  |  |  115|  2.26k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 21, False: 2.24k]
  |  |  ------------------
  |  |  116|     21|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     21|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     21|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     21|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     21|    do {                                           \
  |  |  |  |   99|     21|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     21|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     21|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     21|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     21|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     21|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 21]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     21|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     21|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     21|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     21|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     21|        }                                                                      \
  |  |  123|  2.26k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.24k]
  |  |  ------------------
  ------------------
  755|  2.24k|    {   SymbolEncodingType_e const LLtype = (SymbolEncodingType_e)(*ip >> 6);
  756|  2.24k|        SymbolEncodingType_e const OFtype = (SymbolEncodingType_e)((*ip >> 4) & 3);
  757|  2.24k|        SymbolEncodingType_e const MLtype = (SymbolEncodingType_e)((*ip >> 2) & 3);
  758|  2.24k|        ip++;
  759|       |
  760|       |        /* Build DTables */
  761|  2.24k|        assert(ip <= iend);
  ------------------
  |  |   70|  2.24k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  762|  2.24k|        {   size_t const llhSize = ZSTD_buildSeqTable(dctx->entropy.LLTable, &dctx->LLTptr,
  763|  2.24k|                                                      LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  104|  2.24k|#define MaxLL   35
  ------------------
                                                                    LLtype, MaxLL, LLFSELog,
  ------------------
  |  |  109|  2.24k|#define LLFSELog    9
  ------------------
  764|  2.24k|                                                      ip, (size_t)(iend-ip),
  765|  2.24k|                                                      LL_base, LL_bits,
  766|  2.24k|                                                      LL_defaultDTable, dctx->fseEntropy,
  767|  2.24k|                                                      dctx->ddictIsCold, nbSeq,
  768|  2.24k|                                                      dctx->workspace, sizeof(dctx->workspace),
  769|  2.24k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  770|  2.24k|            RETURN_ERROR_IF(ZSTD_isError(llhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  2.24k|    do {                                                                       \
  |  |  115|  2.24k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 15, False: 2.22k]
  |  |  ------------------
  |  |  116|     15|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     15|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     15|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     15|    do {                                           \
  |  |  |  |   99|     15|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     15|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     15|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     15|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     15|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 15]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     15|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     15|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     15|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     15|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     15|        }                                                                      \
  |  |  123|  2.24k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.22k]
  |  |  ------------------
  ------------------
  771|  2.22k|            ip += llhSize;
  772|  2.22k|        }
  773|       |
  774|  2.22k|        assert(ip <= iend);
  ------------------
  |  |   70|  2.22k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  775|  2.22k|        {   size_t const ofhSize = ZSTD_buildSeqTable(dctx->entropy.OFTable, &dctx->OFTptr,
  776|  2.22k|                                                      OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  106|  2.22k|#define MaxOff  31
  ------------------
                                                                    OFtype, MaxOff, OffFSELog,
  ------------------
  |  |  110|  2.22k|#define OffFSELog   8
  ------------------
  777|  2.22k|                                                      ip, (size_t)(iend-ip),
  778|  2.22k|                                                      OF_base, OF_bits,
  779|  2.22k|                                                      OF_defaultDTable, dctx->fseEntropy,
  780|  2.22k|                                                      dctx->ddictIsCold, nbSeq,
  781|  2.22k|                                                      dctx->workspace, sizeof(dctx->workspace),
  782|  2.22k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  783|  2.22k|            RETURN_ERROR_IF(ZSTD_isError(ofhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  2.22k|    do {                                                                       \
  |  |  115|  2.22k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 13, False: 2.21k]
  |  |  ------------------
  |  |  116|     13|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     13|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     13|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     13|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     13|    do {                                           \
  |  |  |  |   99|     13|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     13|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     13|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     13|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     13|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     13|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     13|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     13|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     13|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     13|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     13|        }                                                                      \
  |  |  123|  2.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.21k]
  |  |  ------------------
  ------------------
  784|  2.21k|            ip += ofhSize;
  785|  2.21k|        }
  786|       |
  787|  2.21k|        assert(ip <= iend);
  ------------------
  |  |   70|  2.21k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  788|  2.21k|        {   size_t const mlhSize = ZSTD_buildSeqTable(dctx->entropy.MLTable, &dctx->MLTptr,
  789|  2.21k|                                                      MLtype, MaxML, MLFSELog,
  ------------------
  |  |  103|  2.21k|#define MaxML   52
  ------------------
                                                                    MLtype, MaxML, MLFSELog,
  ------------------
  |  |  108|  2.21k|#define MLFSELog    9
  ------------------
  790|  2.21k|                                                      ip, (size_t)(iend-ip),
  791|  2.21k|                                                      ML_base, ML_bits,
  792|  2.21k|                                                      ML_defaultDTable, dctx->fseEntropy,
  793|  2.21k|                                                      dctx->ddictIsCold, nbSeq,
  794|  2.21k|                                                      dctx->workspace, sizeof(dctx->workspace),
  795|  2.21k|                                                      ZSTD_DCtx_get_bmi2(dctx));
  796|  2.21k|            RETURN_ERROR_IF(ZSTD_isError(mlhSize), corruption_detected, "ZSTD_buildSeqTable failed");
  ------------------
  |  |  114|  2.21k|    do {                                                                       \
  |  |  115|  2.21k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 13, False: 2.20k]
  |  |  ------------------
  |  |  116|     13|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     13|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     13|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     13|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     13|    do {                                           \
  |  |  |  |   99|     13|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     13|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     13|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     13|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     13|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     13|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 13]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     13|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     13|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     13|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     13|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     13|        }                                                                      \
  |  |  123|  2.21k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.20k]
  |  |  ------------------
  ------------------
  797|  2.20k|            ip += mlhSize;
  798|  2.20k|        }
  799|  2.20k|    }
  800|       |
  801|      0|    return (size_t)(ip-istart);
  802|  2.21k|}
ZSTD_decompressBlock_internal:
 2194|  3.29k|{   /* blockType == blockCompressed */
 2195|  3.29k|    const BYTE* ip = (const BYTE*)src;
 2196|  3.29k|    DEBUGLOG(5, "ZSTD_decompressBlock_internal (cSize : %u)", (unsigned)srcSize);
  ------------------
  |  |  104|  3.29k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.29k]
  |  |  ------------------
  ------------------
 2197|       |
 2198|       |    /* Note : the wording of the specification
 2199|       |     * allows compressed block to be sized exactly ZSTD_blockSizeMax(dctx).
 2200|       |     * This generally does not happen, as it makes little sense,
 2201|       |     * since an uncompressed block would feature same size and have no decompression cost.
 2202|       |     * Also, note that decoder from reference libzstd before < v1.5.4
 2203|       |     * would consider this edge case as an error.
 2204|       |     * As a consequence, avoid generating compressed blocks of size ZSTD_blockSizeMax(dctx)
 2205|       |     * for broader compatibility with the deployed ecosystem of zstd decoders */
 2206|  3.29k|    RETURN_ERROR_IF(srcSize > ZSTD_blockSizeMax(dctx), srcSize_wrong, "");
  ------------------
  |  |  114|  3.29k|    do {                                                                       \
  |  |  115|  3.29k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 8, False: 3.28k]
  |  |  ------------------
  |  |  116|      8|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      8|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      8|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      8|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      8|    do {                                           \
  |  |  |  |   99|      8|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      8|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      8|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      8|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      8|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      8|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      8|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      8|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      8|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      8|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      8|        }                                                                      \
  |  |  123|  3.29k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.28k]
  |  |  ------------------
  ------------------
 2207|       |
 2208|       |    /* Decode literals section */
 2209|  3.28k|    {   size_t const litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize, dst, dstCapacity, streaming);
 2210|  3.28k|        DEBUGLOG(5, "ZSTD_decodeLiteralsBlock : cSize=%u, nbLiterals=%zu", (U32)litCSize, dctx->litSize);
  ------------------
  |  |  104|  3.28k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.28k]
  |  |  ------------------
  ------------------
 2211|  3.28k|        if (ZSTD_isError(litCSize)) return litCSize;
  ------------------
  |  |   44|  3.28k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2211:13): [True: 808, False: 2.47k]
  ------------------
 2212|  2.47k|        ip += litCSize;
 2213|  2.47k|        srcSize -= litCSize;
 2214|  2.47k|    }
 2215|       |
 2216|       |    /* Build Decoding Tables */
 2217|      0|    {
 2218|       |        /* Compute the maximum block size, which must also work when !frame and fParams are unset.
 2219|       |         * Additionally, take the min with dstCapacity to ensure that the totalHistorySize fits in a size_t.
 2220|       |         */
 2221|  2.47k|        size_t const blockSizeMax = MIN(dstCapacity, ZSTD_blockSizeMax(dctx));
  ------------------
  |  |   54|  2.47k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 259, False: 2.21k]
  |  |  ------------------
  ------------------
 2222|  2.47k|        size_t const totalHistorySize = ZSTD_totalHistorySize(ZSTD_maybeNullPtrAdd(dst, (ptrdiff_t)blockSizeMax), (BYTE const*)dctx->virtualStart);
 2223|       |        /* isLongOffset must be true if there are long offsets.
 2224|       |         * Offsets are long if they are larger than ZSTD_maxShortOffset().
 2225|       |         * We don't expect that to be the case in 64-bit mode.
 2226|       |         *
 2227|       |         * We check here to see if our history is large enough to allow long offsets.
 2228|       |         * If it isn't, then we can't possible have (valid) long offsets. If the offset
 2229|       |         * is invalid, then it is okay to read it incorrectly.
 2230|       |         *
 2231|       |         * If isLongOffsets is true, then we will later check our decoding table to see
 2232|       |         * if it is even possible to generate long offsets.
 2233|       |         */
 2234|  2.47k|        ZSTD_longOffset_e isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (totalHistorySize > ZSTD_maxShortOffset()));
  ------------------
  |  Branch (2234:62): [True: 0, False: 2.47k]
  |  Branch (2234:78): [True: 0, False: 0]
  ------------------
 2235|       |        /* These macros control at build-time which decompressor implementation
 2236|       |         * we use. If neither is defined, we do some inspection and dispatch at
 2237|       |         * runtime.
 2238|       |         */
 2239|  2.47k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2240|  2.47k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2241|  2.47k|        int usePrefetchDecoder = dctx->ddictIsCold;
 2242|       |#else
 2243|       |        /* Set to 1 to avoid computing offset info if we don't need to.
 2244|       |         * Otherwise this value is ignored.
 2245|       |         */
 2246|       |        int usePrefetchDecoder = 1;
 2247|       |#endif
 2248|  2.47k|        int nbSeq;
 2249|  2.47k|        size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize);
 2250|  2.47k|        if (ZSTD_isError(seqHSize)) return seqHSize;
  ------------------
  |  |   44|  2.47k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (2250:13): [True: 100, False: 2.37k]
  ------------------
 2251|  2.37k|        ip += seqHSize;
 2252|  2.37k|        srcSize -= seqHSize;
 2253|       |
 2254|  2.37k|        RETURN_ERROR_IF((dst == NULL || dstCapacity == 0) && nbSeq > 0, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  2.37k|    do {                                                                       \
  |  |  115|  9.50k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 2.37k]
  |  |  |  Branch (115:13): [True: 2, False: 2.37k]
  |  |  |  Branch (115:13): [True: 1, False: 1]
  |  |  ------------------
  |  |  116|      1|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      1|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      1|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      1|    do {                                           \
  |  |  |  |   99|      1|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      1|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      1|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      1|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      1|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      1|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      1|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      1|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      1|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      1|        }                                                                      \
  |  |  123|  2.37k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.37k]
  |  |  ------------------
  ------------------
 2255|  2.37k|        RETURN_ERROR_IF(MEM_64bits() && sizeof(size_t) == sizeof(void*) && (size_t)(-1) - (size_t)dst < (size_t)(1 << 20), dstSize_tooSmall,
  ------------------
  |  |  114|  2.37k|    do {                                                                       \
  |  |  115|  11.8k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2.37k, False: 0]
  |  |  |  Branch (115:13): [True: 0, Folded]
  |  |  |  Branch (115:13): [True: 0, False: 2.37k]
  |  |  ------------------
  |  |  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.37k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.37k]
  |  |  ------------------
  ------------------
 2256|  2.37k|                "invalid dst");
 2257|       |
 2258|       |        /* If we could potentially have long offsets, or we might want to use the prefetch decoder,
 2259|       |         * compute information about the share of long offsets, and the maximum nbAdditionalBits.
 2260|       |         * NOTE: could probably use a larger nbSeq limit
 2261|       |         */
 2262|  2.37k|        if (isLongOffset || (!usePrefetchDecoder && (totalHistorySize > (1u << 24)) && (nbSeq > 8))) {
  ------------------
  |  Branch (2262:13): [True: 0, False: 2.37k]
  |  Branch (2262:30): [True: 1.42k, False: 953]
  |  Branch (2262:53): [True: 0, False: 1.42k]
  |  Branch (2262:88): [True: 0, False: 0]
  ------------------
 2263|      0|            ZSTD_OffsetInfo const info = ZSTD_getOffsetInfo(dctx->OFTptr, nbSeq);
 2264|      0|            if (isLongOffset && info.maxNbAdditionalBits <= STREAM_ACCUMULATOR_MIN) {
  ------------------
  |  |   45|      0|#define STREAM_ACCUMULATOR_MIN    ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |               #define STREAM_ACCUMULATOR_MIN    ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
  |  |  ------------------
  |  |  |  |   44|      0|#define STREAM_ACCUMULATOR_MIN_64  57
  |  |  ------------------
  |  |  |  Branch (45:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (2264:17): [True: 0, False: 0]
  |  Branch (2264:33): [True: 0, False: 0]
  ------------------
 2265|       |                /* If isLongOffset, but the maximum number of additional bits that we see in our table is small
 2266|       |                 * enough, then we know it is impossible to have too long an offset in this block, so we can
 2267|       |                 * use the regular offset decoder.
 2268|       |                 */
 2269|      0|                isLongOffset = ZSTD_lo_isRegularOffset;
 2270|      0|            }
 2271|      0|            if (!usePrefetchDecoder) {
  ------------------
  |  Branch (2271:17): [True: 0, False: 0]
  ------------------
 2272|      0|                U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */
  ------------------
  |  Branch (2272:38): [True: 0, False: 0]
  ------------------
 2273|      0|                usePrefetchDecoder = (info.longOffsetShare >= minShare);
 2274|      0|            }
 2275|      0|        }
 2276|       |
 2277|  2.37k|        dctx->ddictIsCold = 0;
 2278|       |
 2279|  2.37k|#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \
 2280|  2.37k|    !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG)
 2281|  2.37k|        if (usePrefetchDecoder) {
  ------------------
  |  Branch (2281:13): [True: 953, False: 1.42k]
  ------------------
 2282|       |#else
 2283|       |        (void)usePrefetchDecoder;
 2284|       |        {
 2285|       |#endif
 2286|    953|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
 2287|    953|            return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2288|    953|#endif
 2289|    953|        }
 2290|       |
 2291|  1.42k|#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG
 2292|       |        /* else */
 2293|  1.42k|        if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (2293:13): [True: 611, False: 810]
  ------------------
 2294|    611|            return ZSTD_decompressSequencesSplitLitBuffer(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2295|    810|        else
 2296|    810|            return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset);
 2297|  1.42k|#endif
 2298|  1.42k|    }
 2299|  1.42k|}
ZSTD_checkContinuity:
 2304|  3.49k|{
 2305|  3.49k|    if (dst != dctx->previousDstEnd && dstSize > 0) {   /* not contiguous */
  ------------------
  |  Branch (2305:9): [True: 3.49k, False: 0]
  |  Branch (2305:40): [True: 3.49k, False: 1]
  ------------------
 2306|  3.49k|        dctx->dictEnd = dctx->previousDstEnd;
 2307|  3.49k|        dctx->virtualStart = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->prefixStart));
 2308|  3.49k|        dctx->prefixStart = dst;
 2309|  3.49k|        dctx->previousDstEnd = dst;
 2310|  3.49k|    }
 2311|       |    /* The external dictionary and current prefix share the frame window.
 2312|       |     * As the prefix grows after a wrap, retaining a full external window
 2313|       |     * could let corrupt offsets alias the destination and expose stale literals.
 2314|       |     * decodedSize > 0 ensures the frame header has initialized windowSize.
 2315|       |     * Only kicks in after decoding windowSize bytes because the entire dictionary is
 2316|       |     * valid as long as a single byte of the dictionary is in the window.
 2317|       |     */
 2318|  3.49k|    if (dstSize > 0 && dctx->isFrameDecompression && dctx->decodedSize > 0 && dctx->decodedSize >= dctx->fParams.windowSize) {
  ------------------
  |  Branch (2318:9): [True: 3.49k, False: 1]
  |  Branch (2318:24): [True: 3.49k, False: 0]
  |  Branch (2318:54): [True: 0, False: 3.49k]
  |  Branch (2318:79): [True: 0, False: 0]
  ------------------
 2319|      0|        size_t const prefixSize = (size_t)((const char*)dctx->previousDstEnd - (const char*)dctx->prefixStart);
 2320|      0|        size_t const extDictSize = (size_t)((const char*)dctx->prefixStart - (const char*)dctx->virtualStart);
 2321|      0|        U64 const maxExtDictSize = prefixSize < dctx->fParams.windowSize ? dctx->fParams.windowSize - prefixSize : 0;
  ------------------
  |  Branch (2321:36): [True: 0, False: 0]
  ------------------
 2322|      0|        dctx->virtualStart = (const char*)dctx->prefixStart - (size_t)MIN((U64)extDictSize, maxExtDictSize);
  ------------------
  |  |   54|      0|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2323|      0|    }
 2324|  3.49k|}
zstd_decompress_block.c:ZSTD_decodeLiteralsBlock:
  156|  3.28k|{
  157|  3.28k|    DEBUGLOG(5, "ZSTD_decodeLiteralsBlock");
  ------------------
  |  |  104|  3.28k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 3.28k]
  |  |  ------------------
  ------------------
  158|  3.28k|    RETURN_ERROR_IF(srcSize < MIN_CBLOCK_SIZE, corruption_detected, "");
  ------------------
  |  |  114|  3.28k|    do {                                                                       \
  |  |  115|  3.28k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 3.28k]
  |  |  ------------------
  |  |  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.28k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 3.28k]
  |  |  ------------------
  ------------------
  159|       |
  160|  3.28k|    {   const BYTE* const istart = (const BYTE*) src;
  161|  3.28k|        SymbolEncodingType_e const litEncType = (SymbolEncodingType_e)(istart[0] & 3);
  162|  3.28k|        size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
  163|       |
  164|  3.28k|        switch(litEncType)
  165|  3.28k|        {
  166|     41|        case set_repeat:
  ------------------
  |  Branch (166:9): [True: 41, False: 3.24k]
  ------------------
  167|     41|            DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block");
  ------------------
  |  |  104|     41|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 41]
  |  |  ------------------
  ------------------
  168|     41|            RETURN_ERROR_IF(dctx->litEntropy==0, dictionary_corrupted, "");
  ------------------
  |  |  114|     41|    do {                                                                       \
  |  |  115|     41|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 40]
  |  |  ------------------
  |  |  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|     41|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 40]
  |  |  ------------------
  ------------------
  169|     40|            ZSTD_FALLTHROUGH;
  ------------------
  |  |  288|     40|#  define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
  ------------------
  170|       |
  171|    829|        case set_compressed:
  ------------------
  |  Branch (171:9): [True: 789, False: 2.49k]
  ------------------
  172|    829|            RETURN_ERROR_IF(srcSize < 5, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need up to 5 for case 3");
  ------------------
  |  |  114|    829|    do {                                                                       \
  |  |  115|    829|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 827]
  |  |  ------------------
  |  |  116|      2|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      2|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      2|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      2|    do {                                           \
  |  |  |  |   99|      2|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      2|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      2|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      2|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      2|        }                                                                      \
  |  |  123|    829|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 827]
  |  |  ------------------
  ------------------
  173|    827|            {   size_t lhSize, litSize, litCSize;
  174|    827|                U32 singleStream=0;
  175|    827|                U32 const lhlCode = (istart[0] >> 2) & 3;
  176|    827|                U32 const lhc = MEM_readLE32(istart);
  177|    827|                size_t hufSuccess;
  178|    827|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|    827|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 541, False: 286]
  |  |  ------------------
  ------------------
  179|    827|                int const flags = 0
  180|    827|                    | (ZSTD_DCtx_get_bmi2(dctx) ? HUF_flags_bmi2 : 0)
  ------------------
  |  Branch (180:24): [True: 827, False: 0]
  ------------------
  181|    827|                    | (dctx->disableHufAsm ? HUF_flags_disableAsm : 0);
  ------------------
  |  Branch (181:24): [True: 0, False: 827]
  ------------------
  182|    827|                switch(lhlCode)
  183|    827|                {
  184|    238|                case 0: case 1: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (184:17): [True: 116, False: 711]
  |  Branch (184:25): [True: 122, False: 705]
  |  Branch (184:33): [True: 0, False: 827]
  ------------------
  185|       |                    /* 2 - 2 - 10 - 10 */
  186|    238|                    singleStream = !lhlCode;
  187|    238|                    lhSize = 3;
  188|    238|                    litSize  = (lhc >> 4) & 0x3FF;
  189|    238|                    litCSize = (lhc >> 14) & 0x3FF;
  190|    238|                    break;
  191|    568|                case 2:
  ------------------
  |  Branch (191:17): [True: 568, False: 259]
  ------------------
  192|       |                    /* 2 - 2 - 14 - 14 */
  193|    568|                    lhSize = 4;
  194|    568|                    litSize  = (lhc >> 4) & 0x3FFF;
  195|    568|                    litCSize = lhc >> 18;
  196|    568|                    break;
  197|     21|                case 3:
  ------------------
  |  Branch (197:17): [True: 21, False: 806]
  ------------------
  198|       |                    /* 2 - 2 - 18 - 18 */
  199|     21|                    lhSize = 5;
  200|     21|                    litSize  = (lhc >> 4) & 0x3FFFF;
  201|     21|                    litCSize = (lhc >> 22) + ((size_t)istart[4] << 10);
  202|     21|                    break;
  203|    827|                }
  204|    827|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|    827|    do {                                                                       \
  |  |  115|  2.47k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 817, False: 10]
  |  |  |  Branch (115:13): [True: 0, False: 817]
  |  |  ------------------
  |  |  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|    827|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 827]
  |  |  ------------------
  ------------------
  205|    827|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|    827|    do {                                                                       \
  |  |  115|    827|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 2, False: 825]
  |  |  ------------------
  |  |  116|      2|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      2|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      2|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      2|    do {                                           \
  |  |  |  |   99|      2|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      2|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      2|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      2|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      2|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      2|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      2|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      2|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      2|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      2|        }                                                                      \
  |  |  123|    827|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 825]
  |  |  ------------------
  ------------------
  206|    825|                if (!singleStream)
  ------------------
  |  Branch (206:21): [True: 709, False: 116]
  ------------------
  207|    709|                    RETURN_ERROR_IF(litSize < MIN_LITERALS_FOR_4_STREAMS, literals_headerWrong,
  ------------------
  |  |  114|    709|    do {                                                                       \
  |  |  115|    709|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 708]
  |  |  ------------------
  |  |  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|    709|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 708]
  |  |  ------------------
  ------------------
  208|    825|                        "Not enough literals (%zu) for the 4-streams mode (min %u)",
  209|    825|                        litSize, MIN_LITERALS_FOR_4_STREAMS);
  210|    824|                RETURN_ERROR_IF(litCSize + lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|    824|    do {                                                                       \
  |  |  115|    824|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 7, False: 817]
  |  |  ------------------
  |  |  116|      7|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      7|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      7|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      7|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      7|    do {                                           \
  |  |  |  |   99|      7|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      7|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      7|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      7|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      7|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      7|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      7|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      7|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      7|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      7|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      7|        }                                                                      \
  |  |  123|    824|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 817]
  |  |  ------------------
  ------------------
  211|    817|                RETURN_ERROR_IF(expectedWriteSize < litSize , dstSize_tooSmall, "");
  ------------------
  |  |  114|    817|    do {                                                                       \
  |  |  115|    817|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 816]
  |  |  ------------------
  |  |  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|    817|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 816]
  |  |  ------------------
  ------------------
  212|    816|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 0);
  213|       |
  214|       |                /* prefetch huffman table if cold */
  215|    816|                if (dctx->ddictIsCold && (litSize > 768 /* heuristic */)) {
  ------------------
  |  Branch (215:21): [True: 60, False: 756]
  |  Branch (215:42): [True: 35, False: 25]
  ------------------
  216|     35|                    PREFETCH_AREA(dctx->HUFptr, sizeof(dctx->entropy.hufTable));
  ------------------
  |  |  167|     35|    do {                                                 \
  |  |  168|     35|        const char* const _ptr = (const char*)(p);       \
  |  |  169|     35|        size_t const _size = (size_t)(s);                \
  |  |  170|     35|        size_t _pos;                                     \
  |  |  171|  9.03k|        for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
  |  |  ------------------
  |  |  |  |  164|  8.99k|#define CACHELINE_SIZE 64
  |  |  ------------------
  |  |  |  Branch (171:22): [True: 8.99k, False: 35]
  |  |  ------------------
  |  |  172|  8.99k|            PREFETCH_L2(_ptr + _pos);                    \
  |  |  ------------------
  |  |  |  |  150|  8.99k|#    define PREFETCH_L2(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
  |  |  ------------------
  |  |  173|  8.99k|        }                                                \
  |  |  174|     35|    } while (0)
  |  |  ------------------
  |  |  |  Branch (174:14): [Folded, False: 35]
  |  |  ------------------
  ------------------
  217|     35|                }
  218|       |
  219|    816|                if (litEncType==set_repeat) {
  ------------------
  |  Branch (219:21): [True: 39, False: 777]
  ------------------
  220|     39|                    if (singleStream) {
  ------------------
  |  Branch (220:25): [True: 36, False: 3]
  ------------------
  221|     36|                        hufSuccess = HUF_decompress1X_usingDTable(
  222|     36|                            dctx->litBuffer, litSize, istart+lhSize, litCSize,
  223|     36|                            dctx->HUFptr, flags);
  224|     36|                    } else {
  225|      3|                        assert(litSize >= MIN_LITERALS_FOR_4_STREAMS);
  ------------------
  |  |   70|      3|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  226|      3|                        hufSuccess = HUF_decompress4X_usingDTable(
  227|      3|                            dctx->litBuffer, litSize, istart+lhSize, litCSize,
  228|      3|                            dctx->HUFptr, flags);
  229|      3|                    }
  230|    777|                } else {
  231|    777|                    if (singleStream) {
  ------------------
  |  Branch (231:25): [True: 78, False: 699]
  ------------------
  232|       |                        /* Compressed literals must use the table-reading variant;
  233|       |                         * the generic decoder also accepts raw/RLE data. */
  234|       |#if defined(HUF_FORCE_DECOMPRESS_X2)
  235|       |                        hufSuccess = HUF_decompress1X2_DCtx_wksp(
  236|       |                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  237|       |                            istart+lhSize, litCSize, dctx->workspace,
  238|       |                            sizeof(dctx->workspace), flags);
  239|       |#else
  240|     78|                        hufSuccess = HUF_decompress1X1_DCtx_wksp(
  241|     78|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  242|     78|                            istart+lhSize, litCSize, dctx->workspace,
  243|     78|                            sizeof(dctx->workspace), flags);
  244|     78|#endif
  245|    699|                    } else {
  246|    699|                        hufSuccess = HUF_decompress4X_hufOnly_wksp(
  247|    699|                            dctx->entropy.hufTable, dctx->litBuffer, litSize,
  248|    699|                            istart+lhSize, litCSize, dctx->workspace,
  249|    699|                            sizeof(dctx->workspace), flags);
  250|    699|                    }
  251|    777|                }
  252|    816|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (252:21): [True: 6, False: 810]
  ------------------
  253|      6|                {
  254|      6|                    assert(litSize > ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   70|      6|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  255|      6|                    ZSTD_memcpy(dctx->litExtraBuffer, dctx->litBufferEnd - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|     36|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [True: 6, Folded]
  |  |  |  Branch (44:51): [Folded, False: 6]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 6, Folded]
  |  |  |  Branch (44:55): [Folded, False: 6]
  |  |  ------------------
  ------------------
  256|      6|                    ZSTD_memmove(dctx->litBuffer + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH, dctx->litBuffer, litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   45|     36|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (45:49): [True: 0, Folded]
  |  |  |  Branch (45:49): [True: 6, Folded]
  |  |  |  Branch (45:49): [Folded, False: 6]
  |  |  |  Branch (45:57): [True: 0, Folded]
  |  |  |  Branch (45:57): [True: 6, Folded]
  |  |  |  Branch (45:57): [Folded, False: 6]
  |  |  ------------------
  ------------------
  257|      6|                    dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  118|      6|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|      6|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|     12|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 6]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 6, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                                  dctx->litBuffer += ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|      6|#define WILDCOPY_OVERLENGTH 32
  ------------------
  258|      6|                    dctx->litBufferEnd -= WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|      6|#define WILDCOPY_OVERLENGTH 32
  ------------------
  259|      6|                    assert(dctx->litBufferEnd <= (BYTE*)dst + blockSizeMax);
  ------------------
  |  |   70|      6|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  260|      6|                }
  261|       |
  262|    816|                RETURN_ERROR_IF(HUF_isError(hufSuccess), corruption_detected, "");
  ------------------
  |  |  114|    816|    do {                                                                       \
  |  |  115|    816|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 703, False: 113]
  |  |  ------------------
  |  |  116|    703|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    703|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 703]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    703|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    703|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    703|    do {                                           \
  |  |  |  |   99|    703|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 703]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    703|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 703]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    703|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    703|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 703]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    703|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    703|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 703]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    703|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    703|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    703|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    703|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    703|        }                                                                      \
  |  |  123|    816|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 113]
  |  |  ------------------
  ------------------
  263|       |
  264|    113|                ZSTD_zeroLiteralsBufferPadding(dctx, litSize);
  265|    113|                dctx->litPtr = dctx->litBuffer;
  266|    113|                dctx->litSize = litSize;
  267|    113|                dctx->litEntropy = 1;
  268|    113|                if (litEncType==set_compressed) dctx->HUFptr = dctx->entropy.hufTable;
  ------------------
  |  Branch (268:21): [True: 110, False: 3]
  ------------------
  269|    113|                return litCSize + lhSize;
  270|    816|            }
  271|       |
  272|    570|        case set_basic:
  ------------------
  |  Branch (272:9): [True: 570, False: 2.71k]
  ------------------
  273|    570|            {   size_t litSize, lhSize;
  274|    570|                U32 const lhlCode = ((istart[0]) >> 2) & 3;
  275|    570|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|    570|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 428, False: 142]
  |  |  ------------------
  ------------------
  276|    570|                switch(lhlCode)
  277|    570|                {
  278|    213|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (278:17): [True: 186, False: 384]
  |  Branch (278:25): [True: 27, False: 543]
  |  Branch (278:33): [True: 0, False: 570]
  ------------------
  279|    213|                    lhSize = 1;
  280|    213|                    litSize = istart[0] >> 3;
  281|    213|                    break;
  282|    308|                case 1:
  ------------------
  |  Branch (282:17): [True: 308, False: 262]
  ------------------
  283|    308|                    lhSize = 2;
  284|    308|                    litSize = MEM_readLE16(istart) >> 4;
  285|    308|                    break;
  286|     49|                case 3:
  ------------------
  |  Branch (286:17): [True: 49, False: 521]
  ------------------
  287|     49|                    lhSize = 3;
  288|     49|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize = 3");
  ------------------
  |  |  114|     49|    do {                                                                       \
  |  |  115|     49|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 48]
  |  |  ------------------
  |  |  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|     49|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 48]
  |  |  ------------------
  ------------------
  289|     48|                    litSize = MEM_readLE24(istart) >> 4;
  290|     48|                    break;
  291|    570|                }
  292|       |
  293|    569|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|    569|    do {                                                                       \
  |  |  115|  1.62k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 485, False: 84]
  |  |  |  Branch (115:13): [True: 0, False: 485]
  |  |  ------------------
  |  |  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|    569|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 569]
  |  |  ------------------
  ------------------
  294|    569|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|    569|    do {                                                                       \
  |  |  115|    569|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 19, False: 550]
  |  |  ------------------
  |  |  116|     19|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     19|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     19|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     19|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     19|    do {                                           \
  |  |  |  |   99|     19|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     19|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     19|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     19|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     19|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     19|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     19|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     19|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     19|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     19|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     19|        }                                                                      \
  |  |  123|    569|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 550]
  |  |  ------------------
  ------------------
  295|    550|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  114|    550|    do {                                                                       \
  |  |  115|    550|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 547]
  |  |  ------------------
  |  |  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|    550|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 547]
  |  |  ------------------
  ------------------
  296|    547|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  297|    547|                if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) {  /* risk reading beyond src buffer with wildcopy */
  ------------------
  |  |  201|    547|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (297:21): [True: 233, False: 314]
  ------------------
  298|    233|                    RETURN_ERROR_IF(litSize+lhSize > srcSize, corruption_detected, "");
  ------------------
  |  |  114|    233|    do {                                                                       \
  |  |  115|    233|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 42, False: 191]
  |  |  ------------------
  |  |  116|     42|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     42|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     42|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     42|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     42|    do {                                           \
  |  |  |  |   99|     42|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     42|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     42|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     42|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     42|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     42|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 42]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     42|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     42|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     42|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     42|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     42|        }                                                                      \
  |  |  123|    233|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 191]
  |  |  ------------------
  ------------------
  299|    191|                    if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (299:25): [True: 0, False: 191]
  ------------------
  300|      0|                    {
  301|      0|                        ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
  302|      0|                        ZSTD_memcpy(dctx->litExtraBuffer, istart + lhSize + litSize - ZSTD_LITBUFFEREXTRASIZE, ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   44|      0|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  |  |  ------------------
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [True: 0, Folded]
  |  |  |  Branch (44:51): [Folded, False: 0]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [True: 0, Folded]
  |  |  |  Branch (44:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
  303|      0|                    }
  304|    191|                    else
  305|    191|                    {
  306|    191|                        ZSTD_memcpy(dctx->litBuffer, istart + lhSize, litSize);
  ------------------
  |  |   44|    191|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  307|    191|                    }
  308|    191|                    ZSTD_zeroLiteralsBufferPadding(dctx, litSize);
  309|    191|                    dctx->litPtr = dctx->litBuffer;
  310|    191|                    dctx->litSize = litSize;
  311|    191|                    return lhSize+litSize;
  312|    233|                }
  313|       |                /* direct reference into compressed stream */
  314|    314|                dctx->litPtr = istart+lhSize;
  315|    314|                dctx->litSize = litSize;
  316|    314|                dctx->litBufferEnd = dctx->litPtr + litSize;
  317|    314|                dctx->litBufferLocation = ZSTD_not_in_dst;
  318|    314|                return lhSize+litSize;
  319|    547|            }
  320|       |
  321|  1.88k|        case set_rle:
  ------------------
  |  Branch (321:9): [True: 1.88k, False: 1.40k]
  ------------------
  322|  1.88k|            {   U32 const lhlCode = ((istart[0]) >> 2) & 3;
  323|  1.88k|                size_t litSize, lhSize;
  324|  1.88k|                size_t expectedWriteSize = MIN(blockSizeMax, dstCapacity);
  ------------------
  |  |   54|  1.88k|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 1.79k, False: 85]
  |  |  ------------------
  ------------------
  325|  1.88k|                switch(lhlCode)
  326|  1.88k|                {
  327|      9|                case 0: case 2: default:   /* note : default is impossible, since lhlCode into [0..3] */
  ------------------
  |  Branch (327:17): [True: 8, False: 1.87k]
  |  Branch (327:25): [True: 1, False: 1.88k]
  |  Branch (327:33): [True: 0, False: 1.88k]
  ------------------
  328|      9|                    lhSize = 1;
  329|      9|                    litSize = istart[0] >> 3;
  330|      9|                    break;
  331|     45|                case 1:
  ------------------
  |  Branch (331:17): [True: 45, False: 1.83k]
  ------------------
  332|     45|                    lhSize = 2;
  333|     45|                    RETURN_ERROR_IF(srcSize<3, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 3");
  ------------------
  |  |  114|     45|    do {                                                                       \
  |  |  115|     45|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 44]
  |  |  ------------------
  |  |  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|     45|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 44]
  |  |  ------------------
  ------------------
  334|     44|                    litSize = MEM_readLE16(istart) >> 4;
  335|     44|                    break;
  336|  1.82k|                case 3:
  ------------------
  |  Branch (336:17): [True: 1.82k, False: 54]
  ------------------
  337|  1.82k|                    lhSize = 3;
  338|  1.82k|                    RETURN_ERROR_IF(srcSize<4, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 2; here we need lhSize+1 = 4");
  ------------------
  |  |  114|  1.82k|    do {                                                                       \
  |  |  115|  1.82k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1, False: 1.82k]
  |  |  ------------------
  |  |  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.82k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.82k]
  |  |  ------------------
  ------------------
  339|  1.82k|                    litSize = MEM_readLE24(istart) >> 4;
  340|  1.82k|                    break;
  341|  1.88k|                }
  342|  1.88k|                RETURN_ERROR_IF(litSize > 0 && dst == NULL, dstSize_tooSmall, "NULL not handled");
  ------------------
  |  |  114|  1.88k|    do {                                                                       \
  |  |  115|  5.63k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 1.87k, False: 4]
  |  |  |  Branch (115:13): [True: 0, False: 1.87k]
  |  |  ------------------
  |  |  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.88k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.88k]
  |  |  ------------------
  ------------------
  343|  1.88k|                RETURN_ERROR_IF(litSize > blockSizeMax, corruption_detected, "");
  ------------------
  |  |  114|  1.88k|    do {                                                                       \
  |  |  115|  1.88k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 20, False: 1.86k]
  |  |  ------------------
  |  |  116|     20|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     20|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     20|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     20|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     20|    do {                                           \
  |  |  |  |   99|     20|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     20|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     20|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     20|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     20|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     20|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     20|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     20|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     20|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     20|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     20|        }                                                                      \
  |  |  123|  1.88k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.86k]
  |  |  ------------------
  ------------------
  344|  1.86k|                RETURN_ERROR_IF(expectedWriteSize < litSize, dstSize_tooSmall, "");
  ------------------
  |  |  114|  1.86k|    do {                                                                       \
  |  |  115|  1.86k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 1.85k]
  |  |  ------------------
  |  |  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|  1.86k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.85k]
  |  |  ------------------
  ------------------
  345|  1.85k|                ZSTD_allocateLiteralsBuffer(dctx, dst, dstCapacity, litSize, streaming, expectedWriteSize, 1);
  346|  1.85k|                if (dctx->litBufferLocation == ZSTD_split)
  ------------------
  |  Branch (346:21): [True: 1.40k, False: 450]
  ------------------
  347|  1.40k|                {
  348|  1.40k|                    ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize - ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   46|  8.44k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [True: 1.40k, Folded]
  |  |  |  Branch (46:55): [Folded, False: 1.40k]
  |  |  ------------------
  ------------------
  349|  1.40k|                    ZSTD_memset(dctx->litExtraBuffer, istart[lhSize], ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   46|  8.44k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:55): [True: 0, Folded]
  |  |  |  Branch (46:55): [True: 1.40k, Folded]
  |  |  |  Branch (46:55): [Folded, False: 1.40k]
  |  |  ------------------
  ------------------
  350|  1.40k|                }
  351|    450|                else
  352|    450|                {
  353|    450|                    ZSTD_memset(dctx->litBuffer, istart[lhSize], litSize);
  ------------------
  |  |   46|    450|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  354|    450|                }
  355|  1.85k|                ZSTD_zeroLiteralsBufferPadding(dctx, litSize);
  356|  1.85k|                dctx->litPtr = dctx->litBuffer;
  357|  1.85k|                dctx->litSize = litSize;
  358|  1.85k|                return lhSize+1;
  359|  1.86k|            }
  360|      0|        default:
  ------------------
  |  Branch (360:9): [True: 0, False: 3.28k]
  ------------------
  361|      0|            RETURN_ERROR(corruption_detected, "impossible");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  362|  3.28k|        }
  363|  3.28k|    }
  364|  3.28k|}
zstd_decompress_block.c:ZSTD_allocateLiteralsBuffer:
   82|  3.22k|{
   83|  3.22k|    size_t const blockSizeMax = ZSTD_blockSizeMax(dctx);
   84|  3.22k|    assert(litSize <= blockSizeMax);
  ------------------
  |  |   70|  3.22k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   85|  3.22k|    assert(dctx->isFrameDecompression || streaming == not_streaming);
  ------------------
  |  |   70|  3.22k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   86|  3.22k|    assert(expectedWriteSize <= blockSizeMax);
  ------------------
  |  |   70|  3.22k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   87|  3.22k|    if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  201|  3.22k|#define WILDCOPY_OVERLENGTH 32
  ------------------
                  if (streaming == not_streaming && dstCapacity > blockSizeMax + WILDCOPY_OVERLENGTH + litSize + WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  201|  3.22k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (87:9): [True: 3.22k, False: 0]
  |  Branch (87:39): [True: 1.28k, False: 1.93k]
  ------------------
   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|  1.28k|        dctx->litBuffer = (BYTE*)dst + blockSizeMax + WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|  1.28k|#define WILDCOPY_OVERLENGTH 32
  ------------------
   94|  1.28k|        dctx->litBufferEnd = dctx->litBuffer + litSize;
   95|  1.28k|        dctx->litBufferLocation = ZSTD_in_dst;
   96|  1.93k|    } else if (litSize <= ZSTD_LITBUFFEREXTRASIZE) {
  ------------------
  |  |  118|  1.93k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.93k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  3.86k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.93k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.93k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (96:16): [True: 502, False: 1.42k]
  ------------------
   97|       |        /* Literals fit entirely within the extra buffer, put them there to avoid
   98|       |         * having to split the literals.
   99|       |         */
  100|    502|        dctx->litBuffer = dctx->litExtraBuffer;
  101|    502|        dctx->litBufferEnd = dctx->litBuffer + litSize;
  102|    502|        dctx->litBufferLocation = ZSTD_not_in_dst;
  103|  1.42k|    } else {
  104|  1.42k|        assert(blockSizeMax > ZSTD_LITBUFFEREXTRASIZE);
  ------------------
  |  |   70|  1.42k|#    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|  1.42k|        if (splitImmediately) {
  ------------------
  |  Branch (112:13): [True: 1.42k, False: 6]
  ------------------
  113|       |            /* won't fit in litExtraBuffer, so it will be split between end of dst and extra buffer */
  114|  1.42k|            dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  118|  1.42k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.42k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  2.84k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.42k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.42k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize + ZSTD_LITBUFFEREXTRASIZE - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|  1.42k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  115|  1.42k|            dctx->litBufferEnd = dctx->litBuffer + litSize - ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|  1.42k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.42k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  2.84k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.42k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.42k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  116|  1.42k|        } else {
  117|       |            /* initially this will be stored entirely in dst during huffman decoding, it will partially be shifted to litExtraBuffer after */
  118|      6|            dctx->litBuffer = (BYTE*)dst + expectedWriteSize - litSize;
  119|      6|            dctx->litBufferEnd = (BYTE*)dst + expectedWriteSize;
  120|      6|        }
  121|  1.42k|        dctx->litBufferLocation = ZSTD_split;
  122|  1.42k|        assert(dctx->litBufferEnd <= (BYTE*)dst + expectedWriteSize);
  ------------------
  |  |   70|  1.42k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  123|  1.42k|    }
  124|  3.22k|}
zstd_decompress_block.c:ZSTD_zeroLiteralsBufferPadding:
  132|  2.16k|{
  133|  2.16k|    if (dctx->litBufferLocation == ZSTD_split) {
  ------------------
  |  Branch (133:9): [True: 1.40k, False: 754]
  ------------------
  134|  1.40k|        BYTE* const litBufferEnd = dctx->litBuffer + litSize - ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|  1.40k|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|  1.40k|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|  2.81k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 1.40k]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 1.40k, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  135|  1.40k|        assert(litBufferEnd == dctx->litBufferEnd);
  ------------------
  |  |   70|  1.40k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  136|  1.40k|        ZSTD_memset(litBufferEnd, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |   46|  1.40k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  137|  1.40k|        ZSTD_memset(dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |   46|  8.44k|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  |  |  ------------------
  |  |  |  Branch (46:47): [True: 0, Folded]
  |  |  |  Branch (46:47): [True: 1.40k, Folded]
  |  |  |  Branch (46:47): [Folded, False: 1.40k]
  |  |  ------------------
  ------------------
  138|  1.40k|    } else {
  139|    754|        BYTE* const litBufferEnd = dctx->litBuffer + litSize;
  140|    754|        assert(litBufferEnd == dctx->litBufferEnd);
  ------------------
  |  |   70|    754|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  141|    754|        ZSTD_memset(litBufferEnd, 0, WILDCOPY_OVERLENGTH);
  ------------------
  |  |   46|    754|# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
  ------------------
  142|    754|    }
  143|  2.16k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body_bmi2:
  644|  2.77k|{
  645|  2.77k|    ZSTD_buildFSETable_body(dt, normalizedCounter, maxSymbolValue,
  646|  2.77k|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  647|  2.77k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body:
  513|  3.33k|{
  514|  3.33k|    ZSTD_seqSymbol* const tableDecode = dt+1;
  515|  3.33k|    U32 const maxSV1 = maxSymbolValue + 1;
  516|  3.33k|    U32 const tableSize = 1 << tableLog;
  517|       |
  518|  3.33k|    U16* symbolNext = (U16*)wksp;
  519|  3.33k|    BYTE* spread = (BYTE*)(symbolNext + MaxSeq + 1);
  ------------------
  |  |  107|  3.33k|#define MaxSeq MAX(MaxLL, MaxML)   /* Assumption : MaxOff < MaxLL,MaxML */
  |  |  ------------------
  |  |  |  |   55|  3.33k|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (55:19): [Folded, False: 3.33k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  520|  3.33k|    U32 highThreshold = tableSize - 1;
  521|       |
  522|       |
  523|       |    /* Sanity Checks */
  524|  3.33k|    assert(maxSymbolValue <= MaxSeq);
  ------------------
  |  |   70|  3.33k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  525|  3.33k|    assert(tableLog <= MaxFSELog);
  ------------------
  |  |   70|  3.33k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  526|  3.33k|    assert(wkspSize >= ZSTD_BUILD_FSE_TABLE_WKSP_SIZE);
  ------------------
  |  |   70|  3.33k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  527|  3.33k|    (void)wkspSize;
  528|       |    /* Init, lay down lowprob symbols */
  529|  3.33k|    {   ZSTD_seqSymbol_header DTableH;
  530|  3.33k|        DTableH.tableLog = tableLog;
  531|  3.33k|        DTableH.fastMode = 1;
  532|  3.33k|        {   S16 const largeLimit= (S16)(1 << (tableLog-1));
  533|  3.33k|            U32 s;
  534|  60.9k|            for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (534:23): [True: 57.6k, False: 3.33k]
  ------------------
  535|  57.6k|                if (normalizedCounter[s]==-1) {
  ------------------
  |  Branch (535:21): [True: 13.2k, False: 44.4k]
  ------------------
  536|  13.2k|                    tableDecode[highThreshold--].baseValue = s;
  537|  13.2k|                    symbolNext[s] = 1;
  538|  44.4k|                } else {
  539|  44.4k|                    if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
  ------------------
  |  Branch (539:25): [True: 2.14k, False: 42.2k]
  ------------------
  540|  44.4k|                    assert(normalizedCounter[s]>=0);
  ------------------
  |  |   70|  44.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  541|  44.4k|                    symbolNext[s] = (U16)normalizedCounter[s];
  542|  44.4k|        }   }   }
  543|  3.33k|        ZSTD_memcpy(dt, &DTableH, sizeof(DTableH));
  ------------------
  |  |   44|  3.33k|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
  544|  3.33k|    }
  545|       |
  546|       |    /* Spread symbols */
  547|  3.33k|    assert(tableSize <= 512);
  ------------------
  |  |   70|  3.33k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  548|       |    /* Specialized symbol spreading for the case when there are
  549|       |     * no low probability (-1 count) symbols. When compressing
  550|       |     * small blocks we avoid low probability symbols to hit this
  551|       |     * case, since header decoding speed matters more.
  552|       |     */
  553|  3.33k|    if (highThreshold == tableSize - 1) {
  ------------------
  |  Branch (553:9): [True: 1.24k, False: 2.09k]
  ------------------
  554|  1.24k|        size_t const tableMask = tableSize-1;
  555|  1.24k|        size_t const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|  1.24k|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  556|       |        /* First lay down the symbols in order.
  557|       |         * We use a uint64_t to lay down 8 bytes at a time. This reduces branch
  558|       |         * misses since small blocks generally have small table logs, so nearly
  559|       |         * all symbols have counts <= 8. We ensure we have 8 bytes at the end of
  560|       |         * our buffer to handle the over-write.
  561|       |         */
  562|  1.24k|        {
  563|  1.24k|            U64 const add = 0x0101010101010101ull;
  564|  1.24k|            size_t pos = 0;
  565|  1.24k|            U64 sv = 0;
  566|  1.24k|            U32 s;
  567|  28.1k|            for (s=0; s<maxSV1; ++s, sv += add) {
  ------------------
  |  Branch (567:23): [True: 26.8k, False: 1.24k]
  ------------------
  568|  26.8k|                int i;
  569|  26.8k|                int const n = normalizedCounter[s];
  570|  26.8k|                MEM_write64(spread + pos, sv);
  571|  41.5k|                for (i = 8; i < n; i += 8) {
  ------------------
  |  Branch (571:29): [True: 14.6k, False: 26.8k]
  ------------------
  572|  14.6k|                    MEM_write64(spread + pos + i, sv);
  573|  14.6k|                }
  574|  26.8k|                assert(n>=0);
  ------------------
  |  |   70|  26.8k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  575|  26.8k|                pos += (size_t)n;
  576|  26.8k|            }
  577|  1.24k|        }
  578|       |        /* Now we spread those positions across the table.
  579|       |         * The benefit of doing it in two stages is that we avoid the
  580|       |         * variable size inner loop, which caused lots of branch misses.
  581|       |         * Now we can run through all the positions without any branch misses.
  582|       |         * We unroll the loop twice, since that is what empirically worked best.
  583|       |         */
  584|  1.24k|        {
  585|  1.24k|            size_t position = 0;
  586|  1.24k|            size_t s;
  587|  1.24k|            size_t const unroll = 2;
  588|  1.24k|            assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
  ------------------
  |  |   70|  1.24k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  589|  67.2k|            for (s = 0; s < (size_t)tableSize; s += unroll) {
  ------------------
  |  Branch (589:25): [True: 65.9k, False: 1.24k]
  ------------------
  590|  65.9k|                size_t u;
  591|   197k|                for (u = 0; u < unroll; ++u) {
  ------------------
  |  Branch (591:29): [True: 131k, False: 65.9k]
  ------------------
  592|   131k|                    size_t const uPosition = (position + (u * step)) & tableMask;
  593|   131k|                    tableDecode[uPosition].baseValue = spread[s + u];
  594|   131k|                }
  595|  65.9k|                position = (position + (unroll * step)) & tableMask;
  596|  65.9k|            }
  597|  1.24k|            assert(position == 0);
  ------------------
  |  |   70|  1.24k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  598|  1.24k|        }
  599|  2.09k|    } else {
  600|  2.09k|        U32 const tableMask = tableSize-1;
  601|  2.09k|        U32 const step = FSE_TABLESTEP(tableSize);
  ------------------
  |  |  623|  2.09k|#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
  ------------------
  602|  2.09k|        U32 s, position = 0;
  603|  32.8k|        for (s=0; s<maxSV1; s++) {
  ------------------
  |  Branch (603:19): [True: 30.7k, False: 2.09k]
  ------------------
  604|  30.7k|            int i;
  605|  30.7k|            int const n = normalizedCounter[s];
  606|   235k|            for (i=0; i<n; i++) {
  ------------------
  |  Branch (606:23): [True: 205k, False: 30.7k]
  ------------------
  607|   205k|                tableDecode[position].baseValue = s;
  608|   205k|                position = (position + step) & tableMask;
  609|   218k|                while (UNLIKELY(position > highThreshold)) position = (position + step) & tableMask;   /* lowprob area */
  ------------------
  |  |  196|   218k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 13.1k, False: 205k]
  |  |  ------------------
  ------------------
  610|   205k|        }   }
  611|  2.09k|        assert(position == 0); /* position must reach all cells once, otherwise normalizedCounter is incorrect */
  ------------------
  |  |   70|  2.09k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  612|  2.09k|    }
  613|       |
  614|       |    /* Build Decoding table */
  615|  3.33k|    {
  616|  3.33k|        U32 u;
  617|   353k|        for (u=0; u<tableSize; u++) {
  ------------------
  |  Branch (617:19): [True: 350k, False: 3.33k]
  ------------------
  618|   350k|            U32 const symbol = tableDecode[u].baseValue;
  619|   350k|            U32 const nextState = symbolNext[symbol]++;
  620|   350k|            tableDecode[u].nbBits = (BYTE) (tableLog - ZSTD_highbit32(nextState) );
  621|   350k|            tableDecode[u].nextState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
  622|   350k|            assert(nbAdditionalBits[symbol] < 255);
  ------------------
  |  |   70|   350k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  623|   350k|            tableDecode[u].nbAdditionalBits = nbAdditionalBits[symbol];
  624|   350k|            tableDecode[u].baseValue = baseValue[symbol];
  625|   350k|        }
  626|  3.33k|    }
  627|  3.33k|}
zstd_decompress_block.c:ZSTD_buildFSETable_body_default:
  634|    556|{
  635|    556|    ZSTD_buildFSETable_body(dt, normalizedCounter, maxSymbolValue,
  636|    556|            baseValue, nbAdditionalBits, tableLog, wksp, wkspSize);
  637|    556|}
zstd_decompress_block.c:ZSTD_buildSeqTable:
  678|  6.68k|{
  679|  6.68k|    switch(type)
  680|  6.68k|    {
  681|    340|    case set_rle :
  ------------------
  |  Branch (681:5): [True: 340, False: 6.34k]
  ------------------
  682|    340|        RETURN_ERROR_IF(!srcSize, srcSize_wrong, "");
  ------------------
  |  |  114|    340|    do {                                                                       \
  |  |  115|    340|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 3, False: 337]
  |  |  ------------------
  |  |  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|    340|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 337]
  |  |  ------------------
  ------------------
  683|    337|        RETURN_ERROR_IF((*(const BYTE*)src) > max, corruption_detected, "");
  ------------------
  |  |  114|    337|    do {                                                                       \
  |  |  115|    337|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 9, False: 328]
  |  |  ------------------
  |  |  116|      9|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      9|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      9|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      9|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      9|    do {                                           \
  |  |  |  |   99|      9|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      9|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      9|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      9|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      9|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      9|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 9]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      9|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      9|        }                                                                      \
  |  |  123|    337|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 328]
  |  |  ------------------
  ------------------
  684|    328|        {   U32 const symbol = *(const BYTE*)src;
  685|    328|            U32 const baseline = baseValue[symbol];
  686|    328|            U8 const nbBits = nbAdditionalBits[symbol];
  687|    328|            ZSTD_buildSeqTable_rle(DTableSpace, baseline, nbBits);
  688|    328|        }
  689|    328|        *DTablePtr = DTableSpace;
  690|    328|        return 1;
  691|  3.41k|    case set_basic :
  ------------------
  |  Branch (691:5): [True: 3.41k, False: 3.26k]
  ------------------
  692|  3.41k|        *DTablePtr = defaultTable;
  693|  3.41k|        return 0;
  694|    118|    case set_repeat:
  ------------------
  |  Branch (694:5): [True: 118, False: 6.56k]
  ------------------
  695|    118|        RETURN_ERROR_IF(!flagRepeatTable, corruption_detected, "");
  ------------------
  |  |  114|    118|    do {                                                                       \
  |  |  115|    118|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 5, False: 113]
  |  |  ------------------
  |  |  116|      5|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      5|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      5|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      5|    do {                                           \
  |  |  |  |   99|      5|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      5|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      5|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      5|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      5|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      5|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      5|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      5|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      5|        }                                                                      \
  |  |  123|    118|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 113]
  |  |  ------------------
  ------------------
  696|       |        /* prefetch FSE table if used */
  697|    113|        if (ddictIsCold && (nbSeq > 24 /* heuristic */)) {
  ------------------
  |  Branch (697:13): [True: 0, False: 113]
  |  Branch (697:28): [True: 0, False: 0]
  ------------------
  698|      0|            const void* const pStart = *DTablePtr;
  699|      0|            size_t const pSize = sizeof(ZSTD_seqSymbol) * (SEQSYMBOL_TABLE_SIZE(maxLog));
  ------------------
  |  |   74|      0| #define SEQSYMBOL_TABLE_SIZE(log)   (1 + (1 << (log)))
  ------------------
  700|      0|            PREFETCH_AREA(pStart, pSize);
  ------------------
  |  |  167|      0|    do {                                                 \
  |  |  168|      0|        const char* const _ptr = (const char*)(p);       \
  |  |  169|      0|        size_t const _size = (size_t)(s);                \
  |  |  170|      0|        size_t _pos;                                     \
  |  |  171|      0|        for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
  |  |  ------------------
  |  |  |  |  164|      0|#define CACHELINE_SIZE 64
  |  |  ------------------
  |  |  |  Branch (171:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  172|      0|            PREFETCH_L2(_ptr + _pos);                    \
  |  |  ------------------
  |  |  |  |  150|      0|#    define PREFETCH_L2(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
  |  |  ------------------
  |  |  173|      0|        }                                                \
  |  |  174|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (174:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  701|      0|        }
  702|    113|        return 0;
  703|  2.80k|    case set_compressed :
  ------------------
  |  Branch (703:5): [True: 2.80k, False: 3.87k]
  ------------------
  704|  2.80k|        {   unsigned tableLog;
  705|  2.80k|            S16 norm[MaxSeq+1];
  706|  2.80k|            size_t const headerSize = FSE_readNCount(norm, &max, &tableLog, src, srcSize);
  707|  2.80k|            RETURN_ERROR_IF(FSE_isError(headerSize), corruption_detected, "");
  ------------------
  |  |  114|  2.80k|    do {                                                                       \
  |  |  115|  2.80k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 2.79k]
  |  |  ------------------
  |  |  116|     12|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     12|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     12|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     12|    do {                                           \
  |  |  |  |   99|     12|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     12|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     12|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     12|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     12|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     12|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     12|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     12|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     12|        }                                                                      \
  |  |  123|  2.80k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.79k]
  |  |  ------------------
  ------------------
  708|  2.79k|            RETURN_ERROR_IF(tableLog > maxLog, corruption_detected, "");
  ------------------
  |  |  114|  2.79k|    do {                                                                       \
  |  |  115|  2.79k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 2.77k]
  |  |  ------------------
  |  |  116|     12|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     12|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     12|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     12|    do {                                           \
  |  |  |  |   99|     12|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     12|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     12|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     12|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     12|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     12|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     12|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     12|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     12|        }                                                                      \
  |  |  123|  2.79k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2.77k]
  |  |  ------------------
  ------------------
  709|  2.77k|            ZSTD_buildFSETable(DTableSpace, norm, max, baseValue, nbAdditionalBits, tableLog, wksp, wkspSize, bmi2);
  710|  2.77k|            *DTablePtr = DTableSpace;
  711|  2.77k|            return headerSize;
  712|  2.79k|        }
  713|      0|    default :
  ------------------
  |  Branch (713:5): [True: 0, False: 6.68k]
  ------------------
  714|      0|        assert(0);
  ------------------
  |  |   70|      0|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  715|      0|        RETURN_ERROR(GENERIC, "impossible");
  ------------------
  |  |  131|      0|    do {                                                                     \
  |  |  132|      0|        RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  133|      0|              __FILE__, __LINE__, ERR_QUOTE(ERROR(err)));                    \
  |  |  134|      0|        _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                               \
  |  |  ------------------
  |  |  |  |   98|      0|    do {                                           \
  |  |  |  |   99|      0|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  135|      0|        RAWLOG(3, ": " __VA_ARGS__);                                         \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  136|      0|        RAWLOG(3, "\n");                                                     \
  |  |  ------------------
  |  |  |  |  103|      0|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  137|      0|        return ERROR(err);                                                   \
  |  |  ------------------
  |  |  |  |   49|      0|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      0|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (138:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  716|  6.68k|    }
  717|  6.68k|}
zstd_decompress_block.c:ZSTD_buildSeqTable_rle:
  488|    328|{
  489|    328|    void* ptr = dt;
  490|    328|    ZSTD_seqSymbol_header* const DTableH = (ZSTD_seqSymbol_header*)ptr;
  491|    328|    ZSTD_seqSymbol* const cell = dt + 1;
  492|       |
  493|    328|    DTableH->tableLog = 0;
  494|    328|    DTableH->fastMode = 0;
  495|       |
  496|    328|    cell->nbBits = 0;
  497|    328|    cell->nextState = 0;
  498|    328|    assert(nbAddBits < 255);
  ------------------
  |  |   70|    328|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  499|    328|    cell->nbAdditionalBits = nbAddBits;
  500|    328|    cell->baseValue = baseValue;
  501|    328|}
zstd_decompress_block.c:ZSTD_blockSizeMax:
   55|  14.4k|{
   56|  14.4k|    size_t const blockSizeMax = dctx->isFrameDecompression ? dctx->fParams.blockSizeMax : ZSTD_BLOCKSIZE_MAX;
  ------------------
  |  |  148|  14.4k|#define ZSTD_BLOCKSIZE_MAX     (1<<ZSTD_BLOCKSIZELOG_MAX)
  |  |  ------------------
  |  |  |  |  147|      0|#define ZSTD_BLOCKSIZELOG_MAX  17
  |  |  ------------------
  ------------------
  |  Branch (56:33): [True: 14.4k, False: 0]
  ------------------
   57|  14.4k|    assert(blockSizeMax <= ZSTD_BLOCKSIZE_MAX);
  ------------------
  |  |   70|  14.4k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
   58|  14.4k|    return blockSizeMax;
   59|  14.4k|}
zstd_decompress_block.c:ZSTD_totalHistorySize:
 2122|  2.47k|{
 2123|  2.47k|    return (size_t)ZSTD_wrappedPtrDiff((const BYTE*)curPtr, (const BYTE*)virtualStart);
 2124|  2.47k|}
zstd_decompress_block.c:ZSTD_decompressSequencesLong:
 2106|    953|{
 2107|    953|    DEBUGLOG(5, "ZSTD_decompressSequencesLong");
  ------------------
  |  |  104|    953|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 953]
  |  |  ------------------
  ------------------
 2108|    953|    if (ZSTD_USE_BMI2(ZSTD_DCtx_get_bmi2(dctx))) {
  ------------------
  |  |   36|    953|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 953, False: 0]
  |  |  ------------------
  ------------------
 2109|    953|        return ZSTD_decompressSequencesLong_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2110|    953|    }
 2111|      0|  return ZSTD_decompressSequencesLong_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2112|    953|}
zstd_decompress_block.c:ZSTD_decompressSequencesLong_bmi2:
 2052|    953|{
 2053|    953|    return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2054|    953|}
zstd_decompress_block.c:ZSTD_decompressSequencesLong_body:
 1857|    953|{
 1858|    953|    BYTE* const ostart = (BYTE*)dst;
 1859|    953|    BYTE* const oend = (dctx->litBufferLocation == ZSTD_in_dst) ?
  ------------------
  |  Branch (1859:24): [True: 99, False: 854]
  ------------------
 1860|     99|                        dctx->litBuffer :
 1861|    953|                        (BYTE*)ZSTD_maybeNullPtrAdd(ostart, (ptrdiff_t)maxDstSize);
 1862|    953|    BYTE* op = ostart;
 1863|    953|    const BYTE* litPtr = dctx->litPtr;
 1864|    953|    const BYTE* litBufferEnd = dctx->litBufferEnd;
 1865|    953|    const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart);
 1866|    953|    const BYTE* const dictStart = (const BYTE*) (dctx->virtualStart);
 1867|    953|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 1868|       |
 1869|       |    /* Regen sequences */
 1870|    953|    if (nbSeq) {
  ------------------
  |  Branch (1870:9): [True: 944, False: 9]
  ------------------
 1871|    944|#define STORED_SEQS 8
 1872|    944|#define STORED_SEQS_MASK (STORED_SEQS-1)
 1873|    944|#define ADVANCED_SEQS STORED_SEQS
 1874|    944|        seq_t sequences[STORED_SEQS];
 1875|    944|        int const seqAdvance = MIN(nbSeq, ADVANCED_SEQS);
  ------------------
  |  |   54|    944|#define MIN(a,b) ((a)<(b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (54:19): [True: 23, False: 921]
  |  |  ------------------
  ------------------
 1876|    944|        seqState_t seqState;
 1877|    944|        int seqNb;
 1878|    944|        size_t prefetchPos = (size_t)(op-prefixStart); /* track position relative to prefixStart */
 1879|       |
 1880|    944|        dctx->fseEntropy = 1;
 1881|  3.77k|        { int i; for (i=0; i<ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  3.77k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1881:28): [True: 2.83k, False: 944]
  ------------------
 1882|    944|        assert(dst != NULL);
  ------------------
  |  |   70|    944|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1883|    944|        RETURN_ERROR_IF(
  ------------------
  |  |  114|    944|    do {                                                                       \
  |  |  115|    944|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 44, False: 900]
  |  |  ------------------
  |  |  116|     44|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     44|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 44]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     44|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     44|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     44|    do {                                           \
  |  |  |  |   99|     44|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 44]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     44|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 44]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     44|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     44|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 44]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     44|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     44|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 44]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     44|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   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
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     44|        }                                                                      \
  |  |  123|    944|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 900]
  |  |  ------------------
  ------------------
 1884|    944|            ERR_isError(BIT_initDStream(&seqState.DStream, seqStart, seqSize)),
 1885|    944|            corruption_detected, "");
 1886|    900|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1887|    900|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1888|    900|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1889|       |
 1890|       |        /* prepare in advance */
 1891|  8.02k|        for (seqNb=0; seqNb<seqAdvance; seqNb++) {
  ------------------
  |  Branch (1891:23): [True: 7.12k, False: 900]
  ------------------
 1892|  7.12k|            seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, seqNb == nbSeq-1);
 1893|  7.12k|            prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
 1894|  7.12k|            sequences[seqNb] = sequence;
 1895|  7.12k|        }
 1896|       |
 1897|       |        /* decompress without stomping litBuffer */
 1898|  1.06M|        for (; seqNb < nbSeq; seqNb++) {
  ------------------
  |  Branch (1898:16): [True: 1.06M, False: 335]
  ------------------
 1899|  1.06M|            seq_t sequence = ZSTD_decodeSequence(&seqState, isLongOffset, seqNb == nbSeq-1);
 1900|       |
 1901|  1.06M|            if (dctx->litBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) {
  ------------------
  |  | 1873|   436k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1871|   436k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                          if (dctx->litBufferLocation == ZSTD_split && litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength > dctx->litBufferEnd) {
  ------------------
  |  | 1872|   436k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1871|   436k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
  |  Branch (1901:17): [True: 436k, False: 631k]
  |  Branch (1901:58): [True: 344, False: 435k]
  ------------------
 1902|       |                /* lit buffer is reaching split point, empty out the first buffer and transition to litExtraBuffer */
 1903|    344|                const size_t leftoverLit = (size_t)(dctx->litBufferEnd - litPtr);
 1904|    344|                assert(dctx->litBufferEnd >= litPtr);
  ------------------
  |  |   70|    344|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1905|    344|                if (leftoverLit) {
  ------------------
  |  Branch (1905:21): [True: 339, False: 5]
  ------------------
 1906|    339|                    RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer");
  ------------------
  |  |  114|    339|    do {                                                                       \
  |  |  115|    339|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 339]
  |  |  ------------------
  |  |  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|    339|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 339]
  |  |  ------------------
  ------------------
 1907|    339|                    ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit);
 1908|    339|                    sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength -= leftoverLit;
  ------------------
  |  | 1873|    339|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1871|    339|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                                  sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength -= leftoverLit;
  ------------------
  |  | 1872|    339|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1871|    339|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1909|    339|                    op += leftoverLit;
 1910|    339|                }
 1911|    344|                litPtr = dctx->litExtraBuffer;
 1912|    344|                litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|    344|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|    344|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    688|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 344]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 344, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1913|    344|                dctx->litBufferLocation = ZSTD_not_in_dst;
 1914|    344|                {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1873|    344|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1871|    344|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                              {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1872|    344|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1871|    344|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1915|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1916|       |                    assert(!ZSTD_isError(oneSeqSize));
 1917|       |                    ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart);
 1918|       |#endif
 1919|    344|                    if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|    344|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1919:25): [True: 52, False: 292]
  ------------------
 1920|       |
 1921|    292|                    prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
 1922|    292|                    sequences[seqNb & STORED_SEQS_MASK] = sequence;
  ------------------
  |  | 1872|    292|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1871|    292|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1923|    292|                    op += oneSeqSize;
 1924|    292|            }   }
 1925|  1.06M|            else
 1926|  1.06M|            {
 1927|       |                /* lit buffer is either wholly contained in first or second split, or not split at all*/
 1928|  1.06M|                size_t const oneSeqSize = dctx->litBufferLocation == ZSTD_split ?
  ------------------
  |  Branch (1928:43): [True: 435k, False: 631k]
  ------------------
 1929|   435k|                    ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength - WILDCOPY_OVERLENGTH, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) :
  ------------------
  |  | 1873|   435k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1871|   435k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                                  ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength - WILDCOPY_OVERLENGTH, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) :
  ------------------
  |  | 1872|   435k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1871|   435k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                                  ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength - WILDCOPY_OVERLENGTH, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) :
  ------------------
  |  |  201|   435k|#define WILDCOPY_OVERLENGTH 32
  ------------------
                                  ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength - WILDCOPY_OVERLENGTH, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) :
  ------------------
  |  | 1873|   435k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1871|   435k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                                  ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK].litLength - WILDCOPY_OVERLENGTH, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) :
  ------------------
  |  | 1872|   435k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1871|   435k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1930|  1.06M|                    ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1873|   631k|#define ADVANCED_SEQS STORED_SEQS
  |  |  ------------------
  |  |  |  | 1871|   631k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
                                  ZSTD_execSequence(op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
  ------------------
  |  | 1872|   631k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1871|   631k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1931|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1932|       |                assert(!ZSTD_isError(oneSeqSize));
 1933|       |                ZSTD_assertValidSequence(dctx, op, oend, sequences[(seqNb - ADVANCED_SEQS) & STORED_SEQS_MASK], prefixStart, dictStart);
 1934|       |#endif
 1935|  1.06M|                if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|  1.06M|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1935:21): [True: 513, False: 1.06M]
  ------------------
 1936|       |
 1937|  1.06M|                prefetchPos = ZSTD_prefetchMatch(prefetchPos, sequence, prefixStart, dictEnd);
 1938|  1.06M|                sequences[seqNb & STORED_SEQS_MASK] = sequence;
  ------------------
  |  | 1872|  1.06M|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1871|  1.06M|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1939|  1.06M|                op += oneSeqSize;
 1940|  1.06M|            }
 1941|  1.06M|        }
 1942|    335|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|    335|    do {                                                                       \
  |  |  115|    335|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 26, False: 309]
  |  |  ------------------
  |  |  116|     26|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     26|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     26|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     26|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     26|    do {                                           \
  |  |  |  |   99|     26|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     26|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     26|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     26|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     26|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     26|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 26]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     26|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     26|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     26|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     26|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     26|        }                                                                      \
  |  |  123|    335|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 309]
  |  |  ------------------
  ------------------
 1943|       |
 1944|       |        /* finish queue */
 1945|    309|        seqNb -= seqAdvance;
 1946|  2.10k|        for ( ; seqNb<nbSeq ; seqNb++) {
  ------------------
  |  Branch (1946:17): [True: 1.94k, False: 168]
  ------------------
 1947|  1.94k|            seq_t *sequence = &(sequences[seqNb&STORED_SEQS_MASK]);
  ------------------
  |  | 1872|  1.94k|#define STORED_SEQS_MASK (STORED_SEQS-1)
  |  |  ------------------
  |  |  |  | 1871|  1.94k|#define STORED_SEQS 8
  |  |  ------------------
  ------------------
 1948|  1.94k|            if (dctx->litBufferLocation == ZSTD_split && litPtr + sequence->litLength > dctx->litBufferEnd) {
  ------------------
  |  Branch (1948:17): [True: 864, False: 1.07k]
  |  Branch (1948:58): [True: 126, False: 738]
  ------------------
 1949|    126|                const size_t leftoverLit = (size_t)(dctx->litBufferEnd - litPtr);
 1950|    126|                assert(dctx->litBufferEnd >= litPtr);
  ------------------
  |  |   70|    126|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1951|    126|                if (leftoverLit) {
  ------------------
  |  Branch (1951:21): [True: 125, False: 1]
  ------------------
 1952|    125|                    RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer");
  ------------------
  |  |  114|    125|    do {                                                                       \
  |  |  115|    125|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 125]
  |  |  ------------------
  |  |  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|    125|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 125]
  |  |  ------------------
  ------------------
 1953|    125|                    ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit);
 1954|    125|                    sequence->litLength -= leftoverLit;
 1955|    125|                    op += leftoverLit;
 1956|    125|                }
 1957|    126|                litPtr = dctx->litExtraBuffer;
 1958|    126|                litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|    126|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|    126|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    252|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 126]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 126, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1959|    126|                dctx->litBufferLocation = ZSTD_not_in_dst;
 1960|    126|                {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
 1961|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1962|       |                    assert(!ZSTD_isError(oneSeqSize));
 1963|       |                    ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart);
 1964|       |#endif
 1965|    126|                    if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|    126|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1965:25): [True: 25, False: 101]
  ------------------
 1966|    101|                    op += oneSeqSize;
 1967|    101|                }
 1968|    101|            }
 1969|  1.81k|            else
 1970|  1.81k|            {
 1971|  1.81k|                size_t const oneSeqSize = dctx->litBufferLocation == ZSTD_split ?
  ------------------
  |  Branch (1971:43): [True: 738, False: 1.07k]
  ------------------
 1972|    738|                    ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence->litLength - WILDCOPY_OVERLENGTH, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd) :
  ------------------
  |  |  201|    738|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1973|  1.81k|                    ZSTD_execSequence(op, oend, *sequence, &litPtr, litBufferEnd, prefixStart, dictStart, dictEnd);
 1974|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1975|       |                assert(!ZSTD_isError(oneSeqSize));
 1976|       |                ZSTD_assertValidSequence(dctx, op, oend, sequences[seqNb&STORED_SEQS_MASK], prefixStart, dictStart);
 1977|       |#endif
 1978|  1.81k|                if (ZSTD_isError(oneSeqSize)) return oneSeqSize;
  ------------------
  |  |   44|  1.81k|#define ZSTD_isError ERR_isError   /* for inlining */
  ------------------
  |  Branch (1978:21): [True: 116, False: 1.69k]
  ------------------
 1979|  1.69k|                op += oneSeqSize;
 1980|  1.69k|            }
 1981|  1.94k|        }
 1982|       |
 1983|       |        /* save reps for next block */
 1984|    672|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|    672|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1984:28): [True: 504, False: 168]
  ------------------
 1985|    168|    }
 1986|       |
 1987|       |    /* last literal segment */
 1988|    177|    if (dctx->litBufferLocation == ZSTD_split) { /* first deplete literal buffer in dst, then copy litExtraBuffer */
  ------------------
  |  Branch (1988:9): [True: 33, False: 144]
  ------------------
 1989|     33|        size_t const lastLLSize = (size_t)(litBufferEnd - litPtr);
 1990|     33|        assert(litBufferEnd >= litPtr);
  ------------------
  |  |   70|     33|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1991|     33|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, "");
  ------------------
  |  |  114|     33|    do {                                                                       \
  |  |  115|     33|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 33]
  |  |  ------------------
  |  |  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|     33|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 33]
  |  |  ------------------
  ------------------
 1992|     33|        if (op != NULL) {
  ------------------
  |  Branch (1992:13): [True: 33, False: 0]
  ------------------
 1993|     33|            ZSTD_memmove(op, litPtr, lastLLSize);
  ------------------
  |  |   45|     33|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1994|     33|            op += lastLLSize;
 1995|     33|        }
 1996|     33|        litPtr = dctx->litExtraBuffer;
 1997|     33|        litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|     33|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|     33|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|     66|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 33]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 33, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1998|     33|    }
 1999|    177|    {   size_t const lastLLSize = (size_t)(litBufferEnd - litPtr);
 2000|    177|        assert(litBufferEnd >= litPtr);
  ------------------
  |  |   70|    177|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 2001|    177|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|    177|    do {                                                                       \
  |  |  115|    177|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 16, False: 161]
  |  |  ------------------
  |  |  116|     16|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     16|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     16|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     16|    do {                                           \
  |  |  |  |   99|     16|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     16|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     16|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     16|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     16|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     16|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     16|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     16|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     16|        }                                                                      \
  |  |  123|    177|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 161]
  |  |  ------------------
  ------------------
 2002|    161|        if (op != NULL) {
  ------------------
  |  Branch (2002:13): [True: 161, False: 0]
  ------------------
 2003|    161|            ZSTD_memmove(op, litPtr, lastLLSize);
  ------------------
  |  |   45|    161|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 2004|    161|            op += lastLLSize;
 2005|    161|        }
 2006|    161|    }
 2007|       |
 2008|      0|    return (size_t)(op - ostart);
 2009|    177|}
zstd_decompress_block.c:ZSTD_initFseState:
 1231|  6.15k|{
 1232|  6.15k|    const void* ptr = dt;
 1233|  6.15k|    const ZSTD_seqSymbol_header* const DTableH = (const ZSTD_seqSymbol_header*)ptr;
 1234|  6.15k|    DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog);
 1235|  6.15k|    DEBUGLOG(6, "ZSTD_initFseState : val=%u using %u bits",
  ------------------
  |  |  104|  6.15k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 6.15k]
  |  |  ------------------
  ------------------
 1236|  6.15k|                (U32)DStatePtr->state, DTableH->tableLog);
 1237|  6.15k|    BIT_reloadDStream(bitD);
 1238|  6.15k|    DStatePtr->table = dt + 1;
 1239|  6.15k|}
zstd_decompress_block.c:ZSTD_decodeSequence:
 1268|  2.49M|{
 1269|  2.49M|    seq_t seq;
 1270|       |#if defined(__aarch64__)
 1271|       |    size_t prevOffset0 = seqState->prevOffset[0];
 1272|       |    size_t prevOffset1 = seqState->prevOffset[1];
 1273|       |    size_t prevOffset2 = seqState->prevOffset[2];
 1274|       |    /*
 1275|       |     * ZSTD_seqSymbol is a 64 bits wide structure.
 1276|       |     * It can be loaded in one operation
 1277|       |     * and its fields extracted by simply shifting or bit-extracting on aarch64.
 1278|       |     * GCC doesn't recognize this and generates more unnecessary ldr/ldrb/ldrh
 1279|       |     * operations that cause performance drop. This can be avoided by using this
 1280|       |     * ZSTD_memcpy hack.
 1281|       |     */
 1282|       |#  if defined(__GNUC__) && !defined(__clang__)
 1283|       |    ZSTD_seqSymbol llDInfoS, mlDInfoS, ofDInfoS;
 1284|       |    ZSTD_seqSymbol* const llDInfo = &llDInfoS;
 1285|       |    ZSTD_seqSymbol* const mlDInfo = &mlDInfoS;
 1286|       |    ZSTD_seqSymbol* const ofDInfo = &ofDInfoS;
 1287|       |    ZSTD_memcpy(llDInfo, seqState->stateLL.table + seqState->stateLL.state, sizeof(ZSTD_seqSymbol));
 1288|       |    ZSTD_memcpy(mlDInfo, seqState->stateML.table + seqState->stateML.state, sizeof(ZSTD_seqSymbol));
 1289|       |    ZSTD_memcpy(ofDInfo, seqState->stateOffb.table + seqState->stateOffb.state, sizeof(ZSTD_seqSymbol));
 1290|       |#  else
 1291|       |    const ZSTD_seqSymbol* const llDInfo = seqState->stateLL.table + seqState->stateLL.state;
 1292|       |    const ZSTD_seqSymbol* const mlDInfo = seqState->stateML.table + seqState->stateML.state;
 1293|       |    const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state;
 1294|       |#  endif
 1295|       |    (void)longOffsets;
 1296|       |    seq.matchLength = mlDInfo->baseValue;
 1297|       |    seq.litLength = llDInfo->baseValue;
 1298|       |    {   U32 const ofBase = ofDInfo->baseValue;
 1299|       |        BYTE const llBits = llDInfo->nbAdditionalBits;
 1300|       |        BYTE const mlBits = mlDInfo->nbAdditionalBits;
 1301|       |        BYTE const ofBits = ofDInfo->nbAdditionalBits;
 1302|       |        BYTE const totalBits = llBits+mlBits+ofBits;
 1303|       |
 1304|       |        U16 const llNext = llDInfo->nextState;
 1305|       |        U16 const mlNext = mlDInfo->nextState;
 1306|       |        U16 const ofNext = ofDInfo->nextState;
 1307|       |        U32 const llnbBits = llDInfo->nbBits;
 1308|       |        U32 const mlnbBits = mlDInfo->nbBits;
 1309|       |        U32 const ofnbBits = ofDInfo->nbBits;
 1310|       |
 1311|       |        assert(llBits <= MaxLLBits);
 1312|       |        assert(mlBits <= MaxMLBits);
 1313|       |        assert(ofBits <= MaxOff);
 1314|       |        /* sequence */
 1315|       |        {   size_t offset;
 1316|       |            if (ofBits > 1) {
 1317|       |                ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
 1318|       |                ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
 1319|       |                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32);
 1320|       |                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 - LONG_OFFSETS_MAX_EXTRA_BITS_32 >= MaxMLBits);
 1321|       |                offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/);   /* <=  (ZSTD_WINDOWLOG_MAX-1) bits */
 1322|       |                prevOffset2 = prevOffset1;
 1323|       |                prevOffset1 = prevOffset0;
 1324|       |                prevOffset0 = offset;
 1325|       |            } else {
 1326|       |                U32 const ll0 = (llDInfo->baseValue == 0);
 1327|       |                if (LIKELY((ofBits == 0))) {
 1328|       |                    if (ll0) {
 1329|       |                        offset = prevOffset1;
 1330|       |                        prevOffset1 = prevOffset0;
 1331|       |                        prevOffset0 = offset;
 1332|       |                    } else {
 1333|       |                        offset = prevOffset0;
 1334|       |                    }
 1335|       |                } else {
 1336|       |                    offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1);
 1337|       |                    {   size_t temp = (offset == 1)   ? prevOffset1
 1338|       |                                      : (offset == 3) ? prevOffset0 - 1
 1339|       |                                      : (offset >= 2) ? prevOffset2
 1340|       |                                      : prevOffset0;
 1341|       |                        /* 0 is not valid: input corrupted => force offset to -1 =>
 1342|       |                         * corruption detected at execSequence.
 1343|       |                         */
 1344|       |                        temp -= !temp;
 1345|       |                        prevOffset2 = (offset == 1) ? prevOffset2 : prevOffset1;
 1346|       |                        prevOffset1 = prevOffset0;
 1347|       |                        prevOffset0 = offset = temp;
 1348|       |            }   }   }
 1349|       |            seq.offset = offset;
 1350|       |        }
 1351|       |
 1352|       |        if (mlBits > 0)
 1353|       |            seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/);
 1354|       |
 1355|       |        if (UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
 1356|       |            BIT_reloadDStream(&seqState->DStream);
 1357|       |
 1358|       |        /* Ensure there are enough bits to read the rest of data in 64-bit mode. */
 1359|       |        ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
 1360|       |
 1361|       |        if (llBits > 0)
 1362|       |            seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/);
 1363|       |
 1364|       |        DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
 1365|       |                    (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
 1366|       |
 1367|       |        if (!isLastSeq) {
 1368|       |            /* Don't update FSE state for last sequence. */
 1369|       |            ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream, llNext, llnbBits);    /* <=  9 bits */
 1370|       |            ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream, mlNext, mlnbBits);    /* <=  9 bits */
 1371|       |            ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream, ofNext, ofnbBits);  /* <=  8 bits */
 1372|       |            BIT_reloadDStream(&seqState->DStream);
 1373|       |        }
 1374|       |    }
 1375|       |    seqState->prevOffset[0] = prevOffset0;
 1376|       |    seqState->prevOffset[1] = prevOffset1;
 1377|       |    seqState->prevOffset[2] = prevOffset2;
 1378|       |#else   /* !defined(__aarch64__) */
 1379|  2.49M|    const ZSTD_seqSymbol* const llDInfo = seqState->stateLL.table + seqState->stateLL.state;
 1380|  2.49M|    const ZSTD_seqSymbol* const mlDInfo = seqState->stateML.table + seqState->stateML.state;
 1381|  2.49M|    const ZSTD_seqSymbol* const ofDInfo = seqState->stateOffb.table + seqState->stateOffb.state;
 1382|  2.49M|    seq.matchLength = mlDInfo->baseValue;
 1383|  2.49M|    seq.litLength = llDInfo->baseValue;
 1384|  2.49M|    {   U32 const ofBase = ofDInfo->baseValue;
 1385|  2.49M|        BYTE const llBits = llDInfo->nbAdditionalBits;
 1386|  2.49M|        BYTE const mlBits = mlDInfo->nbAdditionalBits;
 1387|  2.49M|        BYTE const ofBits = ofDInfo->nbAdditionalBits;
 1388|  2.49M|        BYTE const totalBits = llBits+mlBits+ofBits;
 1389|       |
 1390|  2.49M|        assert(llBits <= MaxLLBits);
  ------------------
  |  |   70|  2.49M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1391|  2.49M|        assert(mlBits <= MaxMLBits);
  ------------------
  |  |   70|  2.49M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1392|  2.49M|        assert(ofBits <= MaxOff);
  ------------------
  |  |   70|  2.49M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1393|       |        /* sequence */
 1394|  2.49M|        {   size_t offset;
 1395|  2.49M|            if (ofBits > 1) {
  ------------------
  |  Branch (1395:17): [True: 795k, False: 1.70M]
  ------------------
 1396|   795k|                ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
  ------------------
  |  |   43|   795k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   795k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1397|   795k|                ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
  ------------------
  |  |   43|   795k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   795k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1398|   795k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32);
  ------------------
  |  |   43|   795k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   795k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1399|   795k|                ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 - LONG_OFFSETS_MAX_EXTRA_BITS_32 >= MaxMLBits);
  ------------------
  |  |   43|   795k|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|   795k|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1400|   795k|                if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) {
  ------------------
  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  ------------------
  |  Branch (1400:21): [True: 0, False: 795k]
  |  Branch (1400:37): [True: 0, False: 0]
  |  Branch (1400:52): [True: 0, False: 0]
  ------------------
 1401|       |                    /* Always read extra bits, this keeps the logic simple,
 1402|       |                     * avoids branches, and avoids accidentally reading 0 bits.
 1403|       |                     */
 1404|      0|                    U32 const extraBits = LONG_OFFSETS_MAX_EXTRA_BITS_32;
  ------------------
  |  | 1254|      0|    (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                   (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |  |  Branch (1254:6): [True: 0, Folded]
  |  |  ------------------
  |  | 1255|      0|        ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                       ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  | 1256|      0|        : 0)
  ------------------
 1405|      0|                    offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits);
 1406|      0|                    BIT_reloadDStream(&seqState->DStream);
 1407|      0|                    offset += BIT_readBitsFast(&seqState->DStream, extraBits);
 1408|   795k|                } else {
 1409|   795k|                    offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/);   /* <=  (ZSTD_WINDOWLOG_MAX-1) bits */
 1410|   795k|                    if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);
  ------------------
  |  Branch (1410:25): [True: 0, False: 795k]
  ------------------
 1411|   795k|                }
 1412|   795k|                seqState->prevOffset[2] = seqState->prevOffset[1];
 1413|   795k|                seqState->prevOffset[1] = seqState->prevOffset[0];
 1414|   795k|                seqState->prevOffset[0] = offset;
 1415|  1.70M|            } else {
 1416|  1.70M|                U32 const ll0 = (llDInfo->baseValue == 0);
 1417|  1.70M|                if (LIKELY((ofBits == 0))) {
  ------------------
  |  |  195|  1.70M|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (195:19): [True: 1.46M, False: 234k]
  |  |  ------------------
  ------------------
 1418|  1.46M|                    offset = seqState->prevOffset[ll0];
 1419|  1.46M|                    seqState->prevOffset[1] = seqState->prevOffset[!ll0];
 1420|  1.46M|                    seqState->prevOffset[0] = offset;
 1421|  1.46M|                } else {
 1422|   234k|                    offset = ofBase + ll0 + BIT_readBitsFast(&seqState->DStream, 1);
 1423|   234k|                    {   size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset];
  ------------------
  |  Branch (1423:39): [True: 14.7k, False: 220k]
  ------------------
 1424|   234k|                        temp -= !temp; /* 0 is not valid: input corrupted => force offset to -1 => corruption detected at execSequence */
 1425|   234k|                        if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1];
  ------------------
  |  Branch (1425:29): [True: 116k, False: 118k]
  ------------------
 1426|   234k|                        seqState->prevOffset[1] = seqState->prevOffset[0];
 1427|   234k|                        seqState->prevOffset[0] = offset = temp;
 1428|   234k|            }   }   }
 1429|  2.49M|            seq.offset = offset;
 1430|  2.49M|        }
 1431|       |
 1432|  2.49M|        if (mlBits > 0)
  ------------------
  |  Branch (1432:13): [True: 136k, False: 2.35M]
  ------------------
 1433|   136k|            seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/);
 1434|       |
 1435|  2.49M|        if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
  ------------------
  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  ------------------
                      if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
  ------------------
  |  | 1254|      0|    (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                   (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32       \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  |  |  Branch (1254:6): [True: 0, Folded]
  |  |  ------------------
  |  | 1255|      0|        ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  | 1363|      0|#define ZSTD_WINDOWLOG_MAX_32    30
  |  |  ------------------
  |  |                       ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32  \
  |  |  ------------------
  |  |  |  |   43|      0|#define STREAM_ACCUMULATOR_MIN_32  25
  |  |  ------------------
  |  | 1256|      0|        : 0)
  ------------------
  |  Branch (1435:13): [True: 0, False: 2.49M]
  |  Branch (1435:29): [True: 0, False: 0]
  ------------------
 1436|      0|            BIT_reloadDStream(&seqState->DStream);
 1437|  2.49M|        if (MEM_64bits() && UNLIKELY(totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog)))
  ------------------
  |  |  196|  2.49M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 1.58k, False: 2.49M]
  |  |  ------------------
  ------------------
  |  Branch (1437:13): [True: 2.49M, False: 0]
  ------------------
 1438|  1.58k|            BIT_reloadDStream(&seqState->DStream);
 1439|       |        /* Ensure there are enough bits to read the rest of data in 64-bit mode. */
 1440|  2.49M|        ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
  ------------------
  |  |   43|  2.49M|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|  2.49M|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1441|       |
 1442|  2.49M|        if (llBits > 0)
  ------------------
  |  Branch (1442:13): [True: 212k, False: 2.28M]
  ------------------
 1443|   212k|            seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/);
 1444|       |
 1445|  2.49M|        if (MEM_32bits())
  ------------------
  |  Branch (1445:13): [True: 0, False: 2.49M]
  ------------------
 1446|      0|            BIT_reloadDStream(&seqState->DStream);
 1447|       |
 1448|  2.49M|        DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u",
  ------------------
  |  |  104|  2.49M|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 2.49M]
  |  |  ------------------
  ------------------
 1449|  2.49M|                    (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset);
 1450|       |
 1451|  2.49M|        if (!isLastSeq) {
  ------------------
  |  Branch (1451:13): [True: 2.49M, False: 683]
  ------------------
 1452|       |            /* Don't update FSE state for last sequence. */
 1453|  2.49M|            ZSTD_updateFseStateWithDInfo(&seqState->stateLL, &seqState->DStream,
 1454|  2.49M|                                         llDInfo->nextState, llDInfo->nbBits);    /* <=  9 bits */
 1455|  2.49M|            ZSTD_updateFseStateWithDInfo(&seqState->stateML, &seqState->DStream,
 1456|  2.49M|                                         mlDInfo->nextState, mlDInfo->nbBits);    /* <=  9 bits */
 1457|  2.49M|            if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream);    /* <= 18 bits */
  ------------------
  |  Branch (1457:17): [True: 0, False: 2.49M]
  ------------------
 1458|  2.49M|            ZSTD_updateFseStateWithDInfo(&seqState->stateOffb, &seqState->DStream,
 1459|  2.49M|                                         ofDInfo->nextState, ofDInfo->nbBits);    /* <=  8 bits */
 1460|  2.49M|            BIT_reloadDStream(&seqState->DStream);
 1461|  2.49M|        }
 1462|  2.49M|    }
 1463|  2.49M|#endif  /* defined(__aarch64__) */
 1464|       |
 1465|  2.49M|    return seq;
 1466|  2.49M|}
zstd_decompress_block.c:ZSTD_updateFseStateWithDInfo:
 1243|  7.48M|{
 1244|  7.48M|    size_t const lowBits = BIT_readBits(bitD, nbBits);
 1245|  7.48M|    DStatePtr->state = nextState + lowBits;
 1246|  7.48M|}
zstd_decompress_block.c:ZSTD_prefetchMatch:
 1836|  1.07M|{
 1837|  1.07M|    prefetchPos += sequence.litLength;
 1838|  1.07M|    {   const BYTE* const matchBase = (sequence.offset > prefetchPos) ? dictEnd : prefixStart;
  ------------------
  |  Branch (1838:39): [True: 2.65k, False: 1.07M]
  ------------------
 1839|       |        /* note : this operation can overflow when seq.offset is really too large, which can only happen when input is corrupted.
 1840|       |         * No consequence though : memory address is only used for prefetching, not for dereferencing */
 1841|  1.07M|        const BYTE* const match = (const BYTE*)ZSTD_wrappedPtrSub(ZSTD_wrappedPtrAdd(matchBase, (ptrdiff_t)prefetchPos), (ptrdiff_t)sequence.offset);
 1842|  1.07M|        PREFETCH_L1(match); PREFETCH_L1(ZSTD_wrappedPtrAdd(match, CACHELINE_SIZE));   /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
  ------------------
  |  |  149|  1.07M|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
                      PREFETCH_L1(match); PREFETCH_L1(ZSTD_wrappedPtrAdd(match, CACHELINE_SIZE));   /* note : it's safe to invoke PREFETCH() on any memory address, including invalid ones */
  ------------------
  |  |  149|  1.07M|#    define PREFETCH_L1(ptr)  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
  ------------------
 1843|  1.07M|    }
 1844|  1.07M|    return prefetchPos + sequence.matchLength;
 1845|  1.07M|}
zstd_decompress_block.c:ZSTD_safecopyDstBeforeSrc:
  909|  1.58k|{
  910|  1.58k|    ptrdiff_t const diff = op - ip;
  911|  1.58k|    BYTE* const oend = op + length;
  912|       |
  913|  1.58k|    if (length < 8 || diff > -8) {
  ------------------
  |  Branch (913:9): [True: 441, False: 1.14k]
  |  Branch (913:23): [True: 97, False: 1.04k]
  ------------------
  914|       |        /* Handle short lengths, close overlaps, and dst not before src. */
  915|   415k|        while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (915:16): [True: 414k, False: 538]
  ------------------
  916|    538|        return;
  917|    538|    }
  918|       |
  919|       |    /* ZSTD_wildcopy() may write up to WILDCOPY_OVERLENGTH-1 bytes past its length.
  920|       |     * Those bytes must not land on source bytes the leftover loop has yet to read,
  921|       |     * so src must be at least WILDCOPY_OVERLENGTH bytes ahead of dst. */
  922|  1.04k|    if (op <= oend - WILDCOPY_OVERLENGTH && diff <= -WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  201|  2.09k|#define WILDCOPY_OVERLENGTH 32
  ------------------
                  if (op <= oend - WILDCOPY_OVERLENGTH && diff <= -WILDCOPY_OVERLENGTH) {
  ------------------
  |  |  201|    779|#define WILDCOPY_OVERLENGTH 32
  ------------------
  |  Branch (922:9): [True: 779, False: 270]
  |  Branch (922:45): [True: 646, False: 133]
  ------------------
  923|    646|        ZSTD_wildcopy(op, ip, (size_t)(oend - WILDCOPY_OVERLENGTH - op), ZSTD_no_overlap);
  ------------------
  |  |  201|    646|#define WILDCOPY_OVERLENGTH 32
  ------------------
  924|    646|        ip += oend - WILDCOPY_OVERLENGTH - op;
  ------------------
  |  |  201|    646|#define WILDCOPY_OVERLENGTH 32
  ------------------
  925|    646|        op += oend - WILDCOPY_OVERLENGTH - op;
  ------------------
  |  |  201|    646|#define WILDCOPY_OVERLENGTH 32
  ------------------
  926|    646|    }
  927|       |
  928|       |    /* Handle the leftovers. */
  929|   819k|    while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (929:12): [True: 818k, False: 1.04k]
  ------------------
  930|  1.04k|}
zstd_decompress_block.c:ZSTD_execSequence:
 1043|  1.72M|{
 1044|  1.72M|    BYTE* const oLitEnd = op + sequence.litLength;
 1045|  1.72M|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 1046|  1.72M|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 1047|  1.72M|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;   /* risk : address space underflow on oend=NULL */
  ------------------
  |  |  201|  1.72M|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1048|  1.72M|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 1049|  1.72M|    const BYTE* match = oLitEnd - sequence.offset;
 1050|       |
 1051|  1.72M|    assert(op != NULL /* Precondition */);
  ------------------
  |  |   70|  1.72M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1052|  1.72M|    assert(oend_w < oend /* No underflow */);
  ------------------
  |  |   70|  1.72M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1053|       |
 1054|       |#if defined(__aarch64__)
 1055|       |    /* prefetch sequence starting from match that will be used for copy later */
 1056|       |    PREFETCH_L1(match);
 1057|       |#endif
 1058|       |    /* Handle edge cases in a slow path:
 1059|       |     *   - Read beyond end of literals
 1060|       |     *   - Match end is within WILDCOPY_OVERLIMIT of oend
 1061|       |     *   - 32-bit mode and the match length overflows
 1062|       |     */
 1063|  1.72M|    if (UNLIKELY(
  ------------------
  |  |  196|  8.60M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 1.53k, False: 1.71M]
  |  |  |  Branch (196:40): [True: 227, False: 1.72M]
  |  |  |  Branch (196:40): [True: 1.30k, False: 1.71M]
  |  |  |  Branch (196:40): [True: 0, False: 1.71M]
  |  |  |  Branch (196:40): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1064|  1.72M|        iLitEnd > litLimit ||
 1065|  1.72M|        oMatchEnd > oend_w ||
 1066|  1.72M|        (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH)))
 1067|  1.53k|        return ZSTD_execSequenceEnd(op, oend, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd);
 1068|       |
 1069|       |    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */
 1070|  1.71M|    assert(op <= oLitEnd /* No overflow */);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1071|  1.71M|    assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1072|  1.71M|    assert(oMatchEnd <= oend /* No underflow */);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1073|  1.71M|    assert(iLitEnd <= litLimit /* Literal length is in bounds */);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1074|  1.71M|    assert(oLitEnd <= oend_w /* Can wildcopy literals */);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1075|  1.71M|    assert(oMatchEnd <= oend_w /* Can wildcopy matches */);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1076|       |
 1077|       |    /* Copy Literals:
 1078|       |     * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9.
 1079|       |     * We likely don't need the full 32-byte wildcopy.
 1080|       |     */
 1081|  1.71M|    assert(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1082|  1.71M|    ZSTD_copy16(op, (*litPtr));
 1083|  1.71M|    if (UNLIKELY(sequence.litLength > 16)) {
  ------------------
  |  |  196|  1.71M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 88.0k, False: 1.63M]
  |  |  ------------------
  ------------------
 1084|  88.0k|        ZSTD_wildcopy(op + 16, (*litPtr) + 16, sequence.litLength - 16, ZSTD_no_overlap);
 1085|  88.0k|    }
 1086|  1.71M|    op = oLitEnd;
 1087|  1.71M|    *litPtr = iLitEnd;   /* update for next sequence */
 1088|       |
 1089|       |    /* Copy Match */
 1090|  1.71M|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (1090:9): [True: 1.06k, False: 1.71M]
  ------------------
 1091|       |        /* offset beyond prefix -> go into extDict */
 1092|  1.06k|        RETURN_ERROR_IF(UNLIKELY(sequence.offset > (size_t)(oLitEnd - virtualStart)), corruption_detected, "");
  ------------------
  |  |  114|  1.06k|    do {                                                                       \
  |  |  115|  1.06k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 416, False: 651]
  |  |  ------------------
  |  |  116|    416|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    416|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 416]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    416|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    416|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    416|    do {                                           \
  |  |  |  |   99|    416|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 416]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    416|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 416]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    416|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    416|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 416]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    416|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    416|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 416]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    416|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    416|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    416|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    416|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    416|        }                                                                      \
  |  |  123|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 651]
  |  |  ------------------
  ------------------
 1093|    651|        match = dictEnd + (match - prefixStart);
 1094|    651|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (1094:13): [True: 552, False: 99]
  ------------------
 1095|    552|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|    552|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1096|    552|            return sequenceLength;
 1097|    552|        }
 1098|       |        /* span extDict & currentPrefixSegment */
 1099|     99|        {   size_t const length1 = (size_t)(dictEnd - match);
 1100|     99|            ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|     99|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1101|     99|            op = oLitEnd + length1;
 1102|     99|            sequence.matchLength -= length1;
 1103|     99|            match = prefixStart;
 1104|     99|        }
 1105|     99|    }
 1106|       |    /* Match within prefix of 1 or more bytes */
 1107|  1.71M|    assert(op <= oMatchEnd);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1108|  1.71M|    assert(oMatchEnd <= oend_w);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1109|  1.71M|    assert(match >= prefixStart);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1110|  1.71M|    assert(sequence.matchLength >= 1);
  ------------------
  |  |   70|  1.71M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1111|       |
 1112|       |    /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy
 1113|       |     * without overlap checking.
 1114|       |     */
 1115|  1.71M|    if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) {
  ------------------
  |  |  195|  1.71M|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (195:19): [True: 767k, False: 950k]
  |  |  ------------------
  ------------------
 1116|       |        /* We bet on a full wildcopy for matches, since we expect matches to be
 1117|       |         * longer than literals (in general). In silesia, ~10% of matches are longer
 1118|       |         * than 16 bytes.
 1119|       |         */
 1120|   767k|        ZSTD_wildcopy(op, match, sequence.matchLength, ZSTD_no_overlap);
 1121|   767k|        return sequenceLength;
 1122|   767k|    }
 1123|   950k|    assert(sequence.offset < WILDCOPY_VECLEN);
  ------------------
  |  |   70|   950k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1124|       |
 1125|       |    /* Copy 8 bytes and spread the offset to be >= 8. */
 1126|   950k|    ZSTD_overlapCopy8(&op, &match, sequence.offset);
 1127|       |
 1128|       |    /* If the match length is > 8 bytes, then continue with the wildcopy. */
 1129|   950k|    if (sequence.matchLength > 8) {
  ------------------
  |  Branch (1129:9): [True: 206k, False: 744k]
  ------------------
 1130|   206k|        assert(op < oMatchEnd);
  ------------------
  |  |   70|   206k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1131|   206k|        ZSTD_wildcopy(op, match, sequence.matchLength - 8, ZSTD_overlap_src_before_dst);
 1132|   206k|    }
 1133|   950k|    return sequenceLength;
 1134|  1.71M|}
zstd_decompress_block.c:ZSTD_execSequenceEnd:
  946|  1.53k|{
  947|  1.53k|    BYTE* const oLitEnd = op + sequence.litLength;
  948|  1.53k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
  949|  1.53k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
  950|  1.53k|    const BYTE* match = oLitEnd - sequence.offset;
  951|  1.53k|    BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;
  ------------------
  |  |  201|  1.53k|#define WILDCOPY_OVERLENGTH 32
  ------------------
  952|       |
  953|       |    /* bounds checks : careful of address space overflow in 32-bit mode */
  954|  1.53k|    RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer");
  ------------------
  |  |  114|  1.53k|    do {                                                                       \
  |  |  115|  1.53k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 494, False: 1.04k]
  |  |  ------------------
  |  |  116|    494|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    494|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 494]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    494|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    494|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    494|    do {                                           \
  |  |  |  |   99|    494|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 494]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    494|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 494]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    494|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    494|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 494]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    494|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    494|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 494]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    494|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    494|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    494|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    494|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    494|        }                                                                      \
  |  |  123|  1.53k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 1.04k]
  |  |  ------------------
  ------------------
  955|  1.04k|    RETURN_ERROR_IF(sequence.litLength > (size_t)(litLimit - *litPtr), corruption_detected, "try to read beyond literal buffer");
  ------------------
  |  |  114|  1.04k|    do {                                                                       \
  |  |  115|  1.04k|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 169, False: 871]
  |  |  ------------------
  |  |  116|    169|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    169|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    169|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    169|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    169|    do {                                           \
  |  |  |  |   99|    169|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 169]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    169|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    169|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    169|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    169|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    169|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    169|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    169|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    169|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    169|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    169|        }                                                                      \
  |  |  123|  1.04k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 871]
  |  |  ------------------
  ------------------
  956|    871|    assert(op < op + sequenceLength);
  ------------------
  |  |   70|    871|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  957|    871|    assert(oLitEnd < op + sequenceLength);
  ------------------
  |  |   70|    871|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  958|       |
  959|       |    /* copy literals */
  960|    871|    ZSTD_safecopy(op, oend_w, *litPtr, sequence.litLength, ZSTD_no_overlap);
  961|    871|    op = oLitEnd;
  962|    871|    *litPtr = iLitEnd;
  963|       |
  964|       |    /* copy Match */
  965|    871|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (965:9): [True: 95, False: 776]
  ------------------
  966|       |        /* offset beyond prefix */
  967|     95|        RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, "");
  ------------------
  |  |  114|     95|    do {                                                                       \
  |  |  115|     95|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 48, False: 47]
  |  |  ------------------
  |  |  116|     48|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     48|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 48]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     48|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     48|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     48|    do {                                           \
  |  |  |  |   99|     48|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 48]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     48|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 48]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     48|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     48|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 48]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     48|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     48|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 48]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     48|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     48|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     48|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     48|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     48|        }                                                                      \
  |  |  123|     95|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 47]
  |  |  ------------------
  ------------------
  968|     47|        match = dictEnd - (prefixStart - match);
  969|     47|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (969:13): [True: 32, False: 15]
  ------------------
  970|     32|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|     32|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  971|     32|            return sequenceLength;
  972|     32|        }
  973|       |        /* span extDict & currentPrefixSegment */
  974|     15|        {   size_t const length1 = (size_t)(dictEnd - match);
  975|     15|            ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|     15|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
  976|     15|            op = oLitEnd + length1;
  977|     15|            sequence.matchLength -= length1;
  978|     15|            match = prefixStart;
  979|     15|        }
  980|     15|    }
  981|    791|    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst);
  982|    791|    return sequenceLength;
  983|    871|}
zstd_decompress_block.c:ZSTD_safecopy:
  867|  2.39k|{
  868|  2.39k|    ptrdiff_t const diff = op - ip;
  869|  2.39k|    BYTE* const oend = op + length;
  870|       |
  871|  2.39k|    assert((ovtype == ZSTD_no_overlap && (diff <= -8 || diff >= 8 || op >= oend_w)) ||
  ------------------
  |  |   70|  2.39k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  872|  2.39k|           (ovtype == ZSTD_overlap_src_before_dst && diff >= 0));
  873|       |
  874|  2.39k|    if (length < 8) {
  ------------------
  |  Branch (874:9): [True: 1.71k, False: 677]
  ------------------
  875|       |        /* Handle short lengths. */
  876|  6.43k|        while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (876:16): [True: 4.72k, False: 1.71k]
  ------------------
  877|  1.71k|        return;
  878|  1.71k|    }
  879|    677|    if (ovtype == ZSTD_overlap_src_before_dst) {
  ------------------
  |  Branch (879:9): [True: 501, False: 176]
  ------------------
  880|       |        /* Copy 8 bytes and ensure the offset >= 8 when there can be overlap. */
  881|    501|        assert(length >= 8);
  ------------------
  |  |   70|    501|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  882|    501|        assert(diff > 0);
  ------------------
  |  |   70|    501|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  883|    501|        ZSTD_overlapCopy8(&op, &ip, (size_t)diff);
  884|    501|        length -= 8;
  885|    501|        assert(op - ip >= 8);
  ------------------
  |  |   70|    501|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  886|    501|        assert(op <= oend);
  ------------------
  |  |   70|    501|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  887|    501|    }
  888|       |
  889|    677|    if (oend <= oend_w) {
  ------------------
  |  Branch (889:9): [True: 68, False: 609]
  ------------------
  890|       |        /* No risk of overwrite. */
  891|     68|        ZSTD_wildcopy(op, ip, length, ovtype);
  892|     68|        return;
  893|     68|    }
  894|    609|    if (op <= oend_w) {
  ------------------
  |  Branch (894:9): [True: 369, False: 240]
  ------------------
  895|       |        /* Wildcopy until we get close to the end. */
  896|    369|        assert(oend > oend_w);
  ------------------
  |  |   70|    369|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  897|    369|        ZSTD_wildcopy(op, ip, (size_t)(oend_w - op), ovtype);
  898|    369|        ip += oend_w - op;
  899|    369|        op += oend_w - op;
  900|    369|    }
  901|       |    /* Handle the leftovers. */
  902|  8.51k|    while (op < oend) *op++ = *ip++;
  ------------------
  |  Branch (902:12): [True: 7.90k, False: 609]
  ------------------
  903|    609|}
zstd_decompress_block.c:ZSTD_overlapCopy8:
  832|  1.44M|{
  833|  1.44M|    assert(*ip <= *op);
  ------------------
  |  |   70|  1.44M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  834|  1.44M|    if (offset < 8) {
  ------------------
  |  Branch (834:9): [True: 1.28M, False: 164k]
  ------------------
  835|       |        /* close range match, overlap */
  836|  1.28M|        static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 };   /* added */
  837|  1.28M|        static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 };   /* subtracted */
  838|  1.28M|        int const sub2 = dec64table[offset];
  839|  1.28M|        (*op)[0] = (*ip)[0];
  840|  1.28M|        (*op)[1] = (*ip)[1];
  841|  1.28M|        (*op)[2] = (*ip)[2];
  842|  1.28M|        (*op)[3] = (*ip)[3];
  843|  1.28M|        *ip += dec32table[offset];
  844|  1.28M|        ZSTD_copy4(*op+4, *ip);
  845|  1.28M|        *ip -= sub2;
  846|  1.28M|    } else {
  847|   164k|        ZSTD_copy8(*op, *ip);
  848|   164k|    }
  849|  1.44M|    *ip += 8;
  850|  1.44M|    *op += 8;
  851|  1.44M|    assert(*op - *ip >= 8);
  ------------------
  |  |   70|  1.44M|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
  852|  1.44M|}
zstd_decompress_block.c:ZSTD_copy4:
   47|  1.28M|static void ZSTD_copy4(void* dst, const void* src) { ZSTD_memcpy(dst, src, 4); }
  ------------------
  |  |   44|  1.28M|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
zstd_decompress_block.c:ZSTD_execSequenceSplitLitBuffer:
 1142|   769k|{
 1143|   769k|    BYTE* const oLitEnd = op + sequence.litLength;
 1144|   769k|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
 1145|   769k|    BYTE* const oMatchEnd = op + sequenceLength;   /* risk : address space overflow (32-bits) */
 1146|   769k|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
 1147|   769k|    const BYTE* match = oLitEnd - sequence.offset;
 1148|       |
 1149|   769k|    assert(op != NULL /* Precondition */);
  ------------------
  |  |   70|   769k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1150|   769k|    assert(oend_w < oend /* No underflow */);
  ------------------
  |  |   70|   769k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1151|       |    /* Handle edge cases in a slow path:
 1152|       |     *   - Read beyond end of literals
 1153|       |     *   - Match end is within WILDCOPY_OVERLIMIT of oend
 1154|       |     *   - 32-bit mode and the match length overflows
 1155|       |     */
 1156|   769k|    if (UNLIKELY(
  ------------------
  |  |  196|  3.84M|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 896, False: 768k]
  |  |  |  Branch (196:40): [True: 0, False: 769k]
  |  |  |  Branch (196:40): [True: 896, False: 768k]
  |  |  |  Branch (196:40): [True: 0, False: 768k]
  |  |  |  Branch (196:40): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1157|   769k|            iLitEnd > litLimit ||
 1158|   769k|            oMatchEnd > oend_w ||
 1159|   769k|            (MEM_32bits() && (size_t)(oend - op) < sequenceLength + WILDCOPY_OVERLENGTH)))
 1160|    896|        return ZSTD_execSequenceEndSplitLitBuffer(op, oend, oend_w, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd);
 1161|       |
 1162|       |    /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */
 1163|   768k|    assert(op <= oLitEnd /* No overflow */);
  ------------------
  |  |   70|   768k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1164|   768k|    assert(oLitEnd < oMatchEnd /* Non-zero match & no overflow */);
  ------------------
  |  |   70|   768k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1165|   768k|    assert(oMatchEnd <= oend /* No underflow */);
  ------------------
  |  |   70|   768k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1166|   768k|    assert(iLitEnd <= litLimit /* Literal length is in bounds */);
  ------------------
  |  |   70|   768k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1167|   768k|    assert(oLitEnd <= oend_w /* Can wildcopy literals */);
  ------------------
  |  |   70|   768k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1168|   768k|    assert(oMatchEnd <= oend_w /* Can wildcopy matches */);
  ------------------
  |  |   70|   768k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1169|       |
 1170|       |    /* Copy Literals:
 1171|       |     * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9.
 1172|       |     * We likely don't need the full 32-byte wildcopy.
 1173|       |     */
 1174|   768k|    assert(WILDCOPY_OVERLENGTH >= 16);
  ------------------
  |  |   70|   768k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1175|   768k|    ZSTD_copy16(op, (*litPtr));
 1176|   768k|    if (UNLIKELY(sequence.litLength > 16)) {
  ------------------
  |  |  196|   768k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 42.5k, False: 725k]
  |  |  ------------------
  ------------------
 1177|  42.5k|        ZSTD_wildcopy(op+16, (*litPtr)+16, sequence.litLength-16, ZSTD_no_overlap);
 1178|  42.5k|    }
 1179|   768k|    op = oLitEnd;
 1180|   768k|    *litPtr = iLitEnd;   /* update for next sequence */
 1181|       |
 1182|       |    /* Copy Match */
 1183|   768k|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (1183:9): [True: 834, False: 767k]
  ------------------
 1184|       |        /* offset beyond prefix -> go into extDict */
 1185|    834|        RETURN_ERROR_IF(UNLIKELY(sequence.offset > (size_t)(oLitEnd - virtualStart)), corruption_detected, "");
  ------------------
  |  |  114|    834|    do {                                                                       \
  |  |  115|    834|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 220, False: 614]
  |  |  ------------------
  |  |  116|    220|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    220|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 220]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    220|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    220|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    220|    do {                                           \
  |  |  |  |   99|    220|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 220]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    220|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 220]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    220|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    220|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 220]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    220|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    220|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 220]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    220|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    220|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    220|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    220|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    220|        }                                                                      \
  |  |  123|    834|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 614]
  |  |  ------------------
  ------------------
 1186|    614|        match = dictEnd + (match - prefixStart);
 1187|    614|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (1187:13): [True: 484, False: 130]
  ------------------
 1188|    484|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|    484|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1189|    484|            return sequenceLength;
 1190|    484|        }
 1191|       |        /* span extDict & currentPrefixSegment */
 1192|    130|        {   size_t const length1 = (size_t)(dictEnd - match);
 1193|    130|            ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|    130|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1194|    130|            op = oLitEnd + length1;
 1195|    130|            sequence.matchLength -= length1;
 1196|    130|            match = prefixStart;
 1197|    130|    }   }
 1198|       |    /* Match within prefix of 1 or more bytes */
 1199|   767k|    assert(op <= oMatchEnd);
  ------------------
  |  |   70|   767k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1200|   767k|    assert(oMatchEnd <= oend_w);
  ------------------
  |  |   70|   767k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1201|   767k|    assert(match >= prefixStart);
  ------------------
  |  |   70|   767k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1202|   767k|    assert(sequence.matchLength >= 1);
  ------------------
  |  |   70|   767k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1203|       |
 1204|       |    /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy
 1205|       |     * without overlap checking.
 1206|       |     */
 1207|   767k|    if (LIKELY(sequence.offset >= WILDCOPY_VECLEN)) {
  ------------------
  |  |  195|   767k|#define LIKELY(x) (__builtin_expect((x), 1))
  |  |  ------------------
  |  |  |  Branch (195:19): [True: 269k, False: 498k]
  |  |  ------------------
  ------------------
 1208|       |        /* We bet on a full wildcopy for matches, since we expect matches to be
 1209|       |         * longer than literals (in general). In silesia, ~10% of matches are longer
 1210|       |         * than 16 bytes.
 1211|       |         */
 1212|   269k|        ZSTD_wildcopy(op, match, sequence.matchLength, ZSTD_no_overlap);
 1213|   269k|        return sequenceLength;
 1214|   269k|    }
 1215|   498k|    assert(sequence.offset < WILDCOPY_VECLEN);
  ------------------
  |  |   70|   498k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1216|       |
 1217|       |    /* Copy 8 bytes and spread the offset to be >= 8. */
 1218|   498k|    ZSTD_overlapCopy8(&op, &match, sequence.offset);
 1219|       |
 1220|       |    /* If the match length is > 8 bytes, then continue with the wildcopy. */
 1221|   498k|    if (sequence.matchLength > 8) {
  ------------------
  |  Branch (1221:9): [True: 103k, False: 395k]
  ------------------
 1222|   103k|        assert(op < oMatchEnd);
  ------------------
  |  |   70|   103k|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1223|   103k|        ZSTD_wildcopy(op, match, sequence.matchLength-8, ZSTD_overlap_src_before_dst);
 1224|   103k|    }
 1225|   498k|    return sequenceLength;
 1226|   767k|}
zstd_decompress_block.c:ZSTD_execSequenceEndSplitLitBuffer:
  994|    896|{
  995|    896|    BYTE* const oLitEnd = op + sequence.litLength;
  996|    896|    size_t const sequenceLength = sequence.litLength + sequence.matchLength;
  997|    896|    const BYTE* const iLitEnd = *litPtr + sequence.litLength;
  998|    896|    const BYTE* match = oLitEnd - sequence.offset;
  999|       |
 1000|       |
 1001|       |    /* bounds checks : careful of address space overflow in 32-bit mode */
 1002|    896|    RETURN_ERROR_IF(sequenceLength > (size_t)(oend - op), dstSize_tooSmall, "last match must fit within dstBuffer");
  ------------------
  |  |  114|    896|    do {                                                                       \
  |  |  115|    896|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 14, False: 882]
  |  |  ------------------
  |  |  116|     14|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     14|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     14|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     14|    do {                                           \
  |  |  |  |   99|     14|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     14|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     14|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     14|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     14|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     14|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     14|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     14|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     14|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     14|        }                                                                      \
  |  |  123|    896|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 882]
  |  |  ------------------
  ------------------
 1003|    882|    RETURN_ERROR_IF(sequence.litLength > (size_t)(litLimit - *litPtr), corruption_detected, "try to read beyond literal buffer");
  ------------------
  |  |  114|    882|    do {                                                                       \
  |  |  115|    882|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 882]
  |  |  ------------------
  |  |  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|    882|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 882]
  |  |  ------------------
  ------------------
 1004|    882|    assert(op < op + sequenceLength);
  ------------------
  |  |   70|    882|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1005|    882|    assert(oLitEnd < op + sequenceLength);
  ------------------
  |  |   70|    882|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1006|       |
 1007|       |    /* The literals still to be read live in dst at [*litPtr, litLimit).
 1008|       |     * The output of this sequence must not run past the literals it consumes. */
 1009|    882|    RETURN_ERROR_IF(op + sequenceLength > iLitEnd, dstSize_tooSmall, "output should not catch up to and overwrite literal buffer");
  ------------------
  |  |  114|    882|    do {                                                                       \
  |  |  115|    882|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 135, False: 747]
  |  |  ------------------
  |  |  116|    135|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|    135|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 135]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|    135|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|    135|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|    135|    do {                                           \
  |  |  |  |   99|    135|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 135]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|    135|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 135]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|    135|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|    135|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 135]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|    135|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|    135|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 135]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|    135|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|    135|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|    135|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    135|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|    135|        }                                                                      \
  |  |  123|    882|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 747]
  |  |  ------------------
  ------------------
 1010|       |
 1011|       |    /* copy literals */
 1012|    747|    ZSTD_safecopyDstBeforeSrc(op, *litPtr, sequence.litLength);
 1013|    747|    op = oLitEnd;
 1014|    747|    *litPtr = iLitEnd;
 1015|       |
 1016|       |    /* copy Match */
 1017|    747|    if (sequence.offset > (size_t)(oLitEnd - prefixStart)) {
  ------------------
  |  Branch (1017:9): [True: 18, False: 729]
  ------------------
 1018|       |        /* offset beyond prefix */
 1019|     18|        RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected, "");
  ------------------
  |  |  114|     18|    do {                                                                       \
  |  |  115|     18|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 16, False: 2]
  |  |  ------------------
  |  |  116|     16|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     16|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     16|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     16|    do {                                           \
  |  |  |  |   99|     16|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     16|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     16|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     16|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     16|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     16|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     16|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     16|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     16|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     16|        }                                                                      \
  |  |  123|     18|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1020|      2|        match = dictEnd - (prefixStart - match);
 1021|      2|        if (match + sequence.matchLength <= dictEnd) {
  ------------------
  |  Branch (1021:13): [True: 1, False: 1]
  ------------------
 1022|      1|            ZSTD_memmove(oLitEnd, match, sequence.matchLength);
  ------------------
  |  |   45|      1|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1023|      1|            return sequenceLength;
 1024|      1|        }
 1025|       |        /* span extDict & currentPrefixSegment */
 1026|      1|        {   size_t const length1 = (size_t)(dictEnd - match);
 1027|      1|            ZSTD_memmove(oLitEnd, match, length1);
  ------------------
  |  |   45|      1|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1028|      1|            op = oLitEnd + length1;
 1029|      1|            sequence.matchLength -= length1;
 1030|      1|            match = prefixStart;
 1031|      1|        }
 1032|      1|    }
 1033|    730|    ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst);
 1034|    730|    return sequenceLength;
 1035|    747|}
zstd_decompress_block.c:ZSTD_decompressSequencesSplitLitBuffer:
 2085|    611|{
 2086|    611|    DEBUGLOG(5, "ZSTD_decompressSequencesSplitLitBuffer");
  ------------------
  |  |  104|    611|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 611]
  |  |  ------------------
  ------------------
 2087|    611|    if (ZSTD_USE_BMI2(ZSTD_DCtx_get_bmi2(dctx))) {
  ------------------
  |  |   36|    611|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 611, False: 0]
  |  |  ------------------
  ------------------
 2088|    611|        return ZSTD_decompressSequencesSplitLitBuffer_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2089|    611|    }
 2090|      0|    return ZSTD_decompressSequencesSplitLitBuffer_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2091|    611|}
zstd_decompress_block.c:ZSTD_decompressSequencesSplitLitBuffer_bmi2:
 2041|    611|{
 2042|    611|    return ZSTD_decompressSequences_bodySplitLitBuffer(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2043|    611|}
zstd_decompress_block.c:ZSTD_decompressSequences_bodySplitLitBuffer:
 1527|    611|{
 1528|    611|    BYTE* const ostart = (BYTE*)dst;
 1529|    611|    BYTE* const oend = (BYTE*)ZSTD_maybeNullPtrAdd(ostart, (ptrdiff_t)maxDstSize);
 1530|    611|    BYTE* op = ostart;
 1531|    611|    const BYTE* litPtr = dctx->litPtr;
 1532|    611|    const BYTE* litBufferEnd = dctx->litBufferEnd;
 1533|    611|    const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart);
 1534|    611|    const BYTE* const vBase = (const BYTE*) (dctx->virtualStart);
 1535|    611|    const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd);
 1536|    611|    DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer (%i seqs)", nbSeq);
  ------------------
  |  |  104|    611|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 611]
  |  |  ------------------
  ------------------
 1537|       |
 1538|       |    /* Literals are split between internal buffer & output buffer */
 1539|    611|    if (nbSeq) {
  ------------------
  |  Branch (1539:9): [True: 602, False: 9]
  ------------------
 1540|    602|        seqState_t seqState;
 1541|    602|        dctx->fseEntropy = 1;
 1542|  2.40k|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  2.40k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1542:28): [True: 1.80k, False: 602]
  ------------------
 1543|    602|        RETURN_ERROR_IF(
  ------------------
  |  |  114|    602|    do {                                                                       \
  |  |  115|    602|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 50, False: 552]
  |  |  ------------------
  |  |  116|     50|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     50|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 50]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     50|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     50|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     50|    do {                                           \
  |  |  |  |   99|     50|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 50]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     50|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 50]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     50|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     50|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 50]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     50|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     50|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 50]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     50|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     50|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     50|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     50|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     50|        }                                                                      \
  |  |  123|    602|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 552]
  |  |  ------------------
  ------------------
 1544|    602|            ERR_isError(BIT_initDStream(&seqState.DStream, seqStart, seqSize)),
 1545|    602|            corruption_detected, "");
 1546|    552|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1547|    552|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1548|    552|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1549|    552|        assert(dst != NULL);
  ------------------
  |  |   70|    552|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1550|       |
 1551|    552|        ZSTD_STATIC_ASSERT(
  ------------------
  |  |   43|    552|#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c)
  |  |  ------------------
  |  |  |  |   39|    552|#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
  |  |  ------------------
  ------------------
 1552|    552|                BIT_DStream_unfinished < BIT_DStream_completed &&
 1553|    552|                BIT_DStream_endOfBuffer < BIT_DStream_completed &&
 1554|    552|                BIT_DStream_completed < BIT_DStream_overflow);
 1555|       |
 1556|       |        /* decompress without overrunning litPtr begins */
 1557|    552|        {   seq_t sequence = {0,0,0};  /* some static analyzer believe that @sequence is not initialized (it necessarily is, since for(;;) loop as at least one iteration) */
 1558|       |            /* Align the decompression loop to 32 + 16 bytes.
 1559|       |                *
 1560|       |                * zstd compiled with gcc-9 on an Intel i9-9900k shows 10% decompression
 1561|       |                * speed swings based on the alignment of the decompression loop. This
 1562|       |                * performance swing is caused by parts of the decompression loop falling
 1563|       |                * out of the DSB. The entire decompression loop should fit in the DSB,
 1564|       |                * when it can't we get much worse performance. You can measure if you've
 1565|       |                * hit the good case or the bad case with this perf command for some
 1566|       |                * compressed file test.zst:
 1567|       |                *
 1568|       |                *   perf stat -e cycles -e instructions -e idq.all_dsb_cycles_any_uops \
 1569|       |                *             -e idq.all_mite_cycles_any_uops -- ./zstd -tq test.zst
 1570|       |                *
 1571|       |                * If you see most cycles served out of the MITE you've hit the bad case.
 1572|       |                * If you see most cycles served out of the DSB you've hit the good case.
 1573|       |                * If it is pretty even then you may be in an okay case.
 1574|       |                *
 1575|       |                * This issue has been reproduced on the following CPUs:
 1576|       |                *   - Kabylake: Macbook Pro (15-inch, 2019) 2.4 GHz Intel Core i9
 1577|       |                *               Use Instruments->Counters to get DSB/MITE cycles.
 1578|       |                *               I never got performance swings, but I was able to
 1579|       |                *               go from the good case of mostly DSB to half of the
 1580|       |                *               cycles served from MITE.
 1581|       |                *   - Coffeelake: Intel i9-9900k
 1582|       |                *   - Coffeelake: Intel i7-9700k
 1583|       |                *
 1584|       |                * I haven't been able to reproduce the instability or DSB misses on any
 1585|       |                * of the following CPUS:
 1586|       |                *   - Haswell
 1587|       |                *   - Broadwell: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GH
 1588|       |                *   - Skylake
 1589|       |                *
 1590|       |                * Alignment is done for each of the three major decompression loops:
 1591|       |                *   - ZSTD_decompressSequences_bodySplitLitBuffer - presplit section of the literal buffer
 1592|       |                *   - ZSTD_decompressSequences_bodySplitLitBuffer - postsplit section of the literal buffer
 1593|       |                *   - ZSTD_decompressSequences_body
 1594|       |                * Alignment choices are made to minimize large swings on bad cases and influence on performance
 1595|       |                * from changes external to this code, rather than to overoptimize on the current commit.
 1596|       |                *
 1597|       |                * If you are seeing performance stability this script can help test.
 1598|       |                * It tests on 4 commits in zstd where I saw performance change.
 1599|       |                *
 1600|       |                *   https://gist.github.com/terrelln/9889fc06a423fd5ca6e99351564473f4
 1601|       |                */
 1602|    552|#if defined(__GNUC__) && defined(__x86_64__)
 1603|    552|            __asm__(".p2align 6");
 1604|       |#  if __GNUC__ >= 7
 1605|       |	    /* good for gcc-7, gcc-9, and gcc-11 */
 1606|       |            __asm__("nop");
 1607|       |            __asm__(".p2align 5");
 1608|       |            __asm__("nop");
 1609|       |            __asm__(".p2align 4");
 1610|       |#    if __GNUC__ == 8 || __GNUC__ == 10
 1611|       |	    /* good for gcc-8 and gcc-10 */
 1612|       |            __asm__("nop");
 1613|       |            __asm__(".p2align 3");
 1614|       |#    endif
 1615|       |#  endif
 1616|    552|#endif
 1617|       |
 1618|       |            /* Handle the initial state where litBuffer is currently split between dst and litExtraBuffer */
 1619|   333k|            for ( ; nbSeq; nbSeq--) {
  ------------------
  |  Branch (1619:21): [True: 333k, False: 6]
  ------------------
 1620|   333k|                sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1621|   333k|                if (litPtr + sequence.litLength > dctx->litBufferEnd) break;
  ------------------
  |  Branch (1621:21): [True: 386, False: 332k]
  ------------------
 1622|   332k|                {   size_t const oneSeqSize = ZSTD_execSequenceSplitLitBuffer(op, oend, litPtr + sequence.litLength - WILDCOPY_OVERLENGTH, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd);
  ------------------
  |  |  201|   332k|#define WILDCOPY_OVERLENGTH 32
  ------------------
 1623|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1624|       |                    assert(!ZSTD_isError(oneSeqSize));
 1625|       |                    ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1626|       |#endif
 1627|   332k|                    if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  196|   332k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 160, False: 332k]
  |  |  ------------------
  ------------------
 1628|    160|                        return oneSeqSize;
 1629|   332k|                    DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|   332k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 332k]
  |  |  ------------------
  ------------------
 1630|   332k|                    op += oneSeqSize;
 1631|   332k|            }   }
 1632|    392|            DEBUGLOG(6, "reached: (litPtr + sequence.litLength > dctx->litBufferEnd)");
  ------------------
  |  |  104|    392|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 392]
  |  |  ------------------
  ------------------
 1633|       |
 1634|       |            /* If there are more sequences, they will need to read literals from litExtraBuffer; copy over the remainder from dst and update litPtr and litEnd */
 1635|    392|            if (nbSeq > 0) {
  ------------------
  |  Branch (1635:17): [True: 386, False: 6]
  ------------------
 1636|    386|                const size_t leftoverLit = (size_t)(dctx->litBufferEnd - litPtr);
 1637|    386|                assert(dctx->litBufferEnd >= litPtr);
  ------------------
  |  |   70|    386|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1638|    386|                DEBUGLOG(6, "There are %i sequences left, and %zu/%zu literals left in buffer", nbSeq, leftoverLit, sequence.litLength);
  ------------------
  |  |  104|    386|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 386]
  |  |  ------------------
  ------------------
 1639|    386|                if (leftoverLit) {
  ------------------
  |  Branch (1639:21): [True: 376, False: 10]
  ------------------
 1640|    376|                    RETURN_ERROR_IF(leftoverLit > (size_t)(oend - op), dstSize_tooSmall, "remaining lit must fit within dstBuffer");
  ------------------
  |  |  114|    376|    do {                                                                       \
  |  |  115|    376|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 376]
  |  |  ------------------
  |  |  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|    376|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 376]
  |  |  ------------------
  ------------------
 1641|    376|                    ZSTD_safecopyDstBeforeSrc(op, litPtr, leftoverLit);
 1642|    376|                    sequence.litLength -= leftoverLit;
 1643|    376|                    op += leftoverLit;
 1644|    376|                }
 1645|    386|                litPtr = dctx->litExtraBuffer;
 1646|    386|                litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|    386|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|    386|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|    772|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 386]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 386, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1647|    386|                dctx->litBufferLocation = ZSTD_not_in_dst;
 1648|    386|                {   size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd);
 1649|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1650|       |                    assert(!ZSTD_isError(oneSeqSize));
 1651|       |                    ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1652|       |#endif
 1653|    386|                    if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  196|    386|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 55, False: 331]
  |  |  ------------------
  ------------------
 1654|     55|                        return oneSeqSize;
 1655|    331|                    DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|    331|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 331]
  |  |  ------------------
  ------------------
 1656|    331|                    op += oneSeqSize;
 1657|    331|                }
 1658|      0|                nbSeq--;
 1659|    331|            }
 1660|    392|        }
 1661|       |
 1662|    337|        if (nbSeq > 0) {
  ------------------
  |  Branch (1662:13): [True: 328, False: 9]
  ------------------
 1663|       |            /* there is remaining lit from extra buffer */
 1664|       |
 1665|    328|#if defined(__GNUC__) && defined(__x86_64__)
 1666|    328|            __asm__(".p2align 6");
 1667|    328|            __asm__("nop");
 1668|    328|#  if __GNUC__ != 7
 1669|       |            /* worse for gcc-7 better for gcc-8, gcc-9, and gcc-10 and clang */
 1670|    328|            __asm__(".p2align 4");
 1671|    328|            __asm__("nop");
 1672|    328|            __asm__(".p2align 3");
 1673|       |#  elif __GNUC__ >= 11
 1674|       |            __asm__(".p2align 3");
 1675|       |#  else
 1676|       |            __asm__(".p2align 5");
 1677|       |            __asm__("nop");
 1678|       |            __asm__(".p2align 3");
 1679|       |#  endif
 1680|    328|#endif
 1681|       |
 1682|   517k|            for ( ; nbSeq ; nbSeq--) {
  ------------------
  |  Branch (1682:21): [True: 517k, False: 22]
  ------------------
 1683|   517k|                seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1684|   517k|                size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litBufferEnd, prefixStart, vBase, dictEnd);
 1685|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1686|       |                assert(!ZSTD_isError(oneSeqSize));
 1687|       |                ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1688|       |#endif
 1689|   517k|                if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  196|   517k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 306, False: 517k]
  |  |  ------------------
  ------------------
 1690|    306|                    return oneSeqSize;
 1691|   517k|                DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|   517k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 517k]
  |  |  ------------------
  ------------------
 1692|   517k|                op += oneSeqSize;
 1693|   517k|            }
 1694|    328|        }
 1695|       |
 1696|       |        /* check if reached exact end */
 1697|     31|        DEBUGLOG(5, "ZSTD_decompressSequences_bodySplitLitBuffer: after decode loop, remaining nbSeq : %i", nbSeq);
  ------------------
  |  |  104|     31|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 31]
  |  |  ------------------
  ------------------
 1698|     31|        RETURN_ERROR_IF(nbSeq, corruption_detected, "");
  ------------------
  |  |  114|     31|    do {                                                                       \
  |  |  115|     31|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 31]
  |  |  ------------------
  |  |  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|     31|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 31]
  |  |  ------------------
  ------------------
 1699|     31|        DEBUGLOG(5, "bitStream : start=%p, ptr=%p, bitsConsumed=%u", seqState.DStream.start, seqState.DStream.ptr, seqState.DStream.bitsConsumed);
  ------------------
  |  |  104|     31|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 31]
  |  |  ------------------
  ------------------
 1700|     31|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|     31|    do {                                                                       \
  |  |  115|     31|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 17, False: 14]
  |  |  ------------------
  |  |  116|     17|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     17|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     17|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     17|    do {                                           \
  |  |  |  |   99|     17|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     17|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     17|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     17|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     17|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     17|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     17|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     17|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     17|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     17|        }                                                                      \
  |  |  123|     31|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 14]
  |  |  ------------------
  ------------------
 1701|       |        /* save reps for next block */
 1702|     56|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|     56|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1702:28): [True: 42, False: 14]
  ------------------
 1703|     14|    }
 1704|       |
 1705|       |    /* last literal segment */
 1706|     23|    if (dctx->litBufferLocation == ZSTD_split) {
  ------------------
  |  Branch (1706:9): [True: 14, False: 9]
  ------------------
 1707|       |        /* split hasn't been reached yet, first get dst then copy litExtraBuffer */
 1708|     14|        size_t const lastLLSize = (size_t)(litBufferEnd - litPtr);
 1709|     14|        DEBUGLOG(6, "copy last literals from segment : %u", (U32)lastLLSize);
  ------------------
  |  |  104|     14|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 14]
  |  |  ------------------
  ------------------
 1710|     14|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend - op), dstSize_tooSmall, "");
  ------------------
  |  |  114|     14|    do {                                                                       \
  |  |  115|     14|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 0, False: 14]
  |  |  ------------------
  |  |  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|     14|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 14]
  |  |  ------------------
  ------------------
 1711|     14|        if (op != NULL) {
  ------------------
  |  Branch (1711:13): [True: 14, False: 0]
  ------------------
 1712|     14|            ZSTD_memmove(op, litPtr, lastLLSize);
  ------------------
  |  |   45|     14|# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
  ------------------
 1713|     14|            op += lastLLSize;
 1714|     14|        }
 1715|     14|        litPtr = dctx->litExtraBuffer;
 1716|     14|        litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE;
  ------------------
  |  |  118|     14|#define ZSTD_LITBUFFEREXTRASIZE  BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
  |  |  ------------------
  |  |  |  |   56|     14|#define BOUNDED(min,val,max) (MAX(min,MIN(val,max)))
  |  |  |  |  ------------------
  |  |  |  |  |  |   55|     28|#define MAX(a,b) ((a)>(b) ? (a) : (b))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (55:19): [Folded, False: 14]
  |  |  |  |  |  |  |  Branch (55:24): [True: 0, Folded]
  |  |  |  |  |  |  |  Branch (55:36): [True: 14, Folded]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1717|     14|        dctx->litBufferLocation = ZSTD_not_in_dst;
 1718|     14|    }
 1719|       |    /* copy last literals from internal buffer */
 1720|     23|    {   size_t const lastLLSize = (size_t)(litBufferEnd - litPtr);
 1721|     23|        DEBUGLOG(6, "copy last literals from internal buffer : %u", (U32)lastLLSize);
  ------------------
  |  |  104|     23|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 23]
  |  |  ------------------
  ------------------
 1722|     23|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|     23|    do {                                                                       \
  |  |  115|     23|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 8, False: 15]
  |  |  ------------------
  |  |  116|      8|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      8|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      8|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      8|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      8|    do {                                           \
  |  |  |  |   99|      8|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      8|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      8|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      8|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      8|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      8|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      8|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      8|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      8|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      8|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      8|        }                                                                      \
  |  |  123|     23|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 15]
  |  |  ------------------
  ------------------
 1723|     15|        if (op != NULL) {
  ------------------
  |  Branch (1723:13): [True: 15, False: 0]
  ------------------
 1724|     15|            ZSTD_memcpy(op, litPtr, lastLLSize);
  ------------------
  |  |   44|     15|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1725|     15|            op += lastLLSize;
 1726|     15|    }   }
 1727|       |
 1728|     15|    DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart));
  ------------------
  |  |  104|     15|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 15]
  |  |  ------------------
  ------------------
 1729|     15|    return (size_t)(op - ostart);
 1730|     23|}
zstd_decompress_block.c:ZSTD_decompressSequences:
 2074|    810|{
 2075|    810|    DEBUGLOG(5, "ZSTD_decompressSequences");
  ------------------
  |  |  104|    810|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 810]
  |  |  ------------------
  ------------------
 2076|    810|    if (ZSTD_USE_BMI2(ZSTD_DCtx_get_bmi2(dctx))) {
  ------------------
  |  |   36|    810|#  define ZSTD_USE_BMI2(bmi2) (bmi2)
  |  |  ------------------
  |  |  |  Branch (36:31): [True: 810, False: 0]
  |  |  ------------------
  ------------------
 2077|    810|        return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2078|    810|    }
 2079|      0|    return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2080|    810|}
zstd_decompress_block.c:ZSTD_decompressSequences_bmi2:
 2032|    810|{
 2033|    810|    return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset);
 2034|    810|}
zstd_decompress_block.c:ZSTD_decompressSequences_body:
 1738|    810|{
 1739|    810|    BYTE* const ostart = (BYTE*)dst;
 1740|    810|    BYTE* const oend = (dctx->litBufferLocation == ZSTD_not_in_dst) ?
  ------------------
  |  Branch (1740:24): [True: 436, False: 374]
  ------------------
 1741|    436|                        (BYTE*)ZSTD_maybeNullPtrAdd(ostart, (ptrdiff_t)maxDstSize) :
 1742|    810|                        dctx->litBuffer;
 1743|    810|    BYTE* op = ostart;
 1744|    810|    const BYTE* litPtr = dctx->litPtr;
 1745|    810|    const BYTE* const litEnd = litPtr + dctx->litSize;
 1746|    810|    const BYTE* const prefixStart = (const BYTE*)(dctx->prefixStart);
 1747|    810|    const BYTE* const vBase = (const BYTE*)(dctx->virtualStart);
 1748|    810|    const BYTE* const dictEnd = (const BYTE*)(dctx->dictEnd);
 1749|    810|    DEBUGLOG(5, "ZSTD_decompressSequences_body: nbSeq = %d", nbSeq);
  ------------------
  |  |  104|    810|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 810]
  |  |  ------------------
  ------------------
 1750|       |
 1751|       |    /* Regen sequences */
 1752|    810|    if (nbSeq) {
  ------------------
  |  Branch (1752:9): [True: 653, False: 157]
  ------------------
 1753|    653|        seqState_t seqState;
 1754|    653|        dctx->fseEntropy = 1;
 1755|  2.61k|        { U32 i; for (i = 0; i < ZSTD_REP_NUM; i++) seqState.prevOffset[i] = dctx->entropy.rep[i]; }
  ------------------
  |  |   64|  2.61k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1755:30): [True: 1.95k, False: 653]
  ------------------
 1756|    653|        RETURN_ERROR_IF(
  ------------------
  |  |  114|    653|    do {                                                                       \
  |  |  115|    653|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 55, False: 598]
  |  |  ------------------
  |  |  116|     55|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     55|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 55]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     55|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     55|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     55|    do {                                           \
  |  |  |  |   99|     55|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 55]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     55|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 55]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     55|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     55|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 55]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     55|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     55|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 55]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     55|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     55|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     55|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     55|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     55|        }                                                                      \
  |  |  123|    653|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 598]
  |  |  ------------------
  ------------------
 1757|    653|            ERR_isError(BIT_initDStream(&seqState.DStream, seqStart, seqSize)),
 1758|    653|            corruption_detected, "");
 1759|    598|        ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr);
 1760|    598|        ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr);
 1761|    598|        ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr);
 1762|    598|        assert(dst != NULL);
  ------------------
  |  |   70|    598|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1763|       |
 1764|    598|#if defined(__GNUC__) && defined(__x86_64__)
 1765|    598|            __asm__(".p2align 6");
 1766|    598|            __asm__("nop");
 1767|       |#  if __GNUC__ >= 7
 1768|       |            __asm__(".p2align 5");
 1769|       |            __asm__("nop");
 1770|       |            __asm__(".p2align 3");
 1771|       |#  else
 1772|    598|            __asm__(".p2align 4");
 1773|    598|            __asm__("nop");
 1774|    598|            __asm__(".p2align 3");
 1775|    598|#  endif
 1776|    598|#endif
 1777|       |
 1778|   570k|        for ( ; nbSeq ; nbSeq--) {
  ------------------
  |  Branch (1778:17): [True: 569k, False: 313]
  ------------------
 1779|   569k|            seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset, nbSeq==1);
 1780|   569k|            size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litEnd, prefixStart, vBase, dictEnd);
 1781|       |#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && defined(FUZZING_ASSERT_VALID_SEQUENCE)
 1782|       |            assert(!ZSTD_isError(oneSeqSize));
 1783|       |            ZSTD_assertValidSequence(dctx, op, oend, sequence, prefixStart, vBase);
 1784|       |#endif
 1785|   569k|            if (UNLIKELY(ZSTD_isError(oneSeqSize)))
  ------------------
  |  |  196|   569k|#define UNLIKELY(x) (__builtin_expect((x), 0))
  |  |  ------------------
  |  |  |  Branch (196:21): [True: 285, False: 569k]
  |  |  ------------------
  ------------------
 1786|    285|                return oneSeqSize;
 1787|   569k|            DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize);
  ------------------
  |  |  104|   569k|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 569k]
  |  |  ------------------
  ------------------
 1788|   569k|            op += oneSeqSize;
 1789|   569k|        }
 1790|       |
 1791|       |        /* check if reached exact end */
 1792|    313|        assert(nbSeq == 0);
  ------------------
  |  |   70|    313|#    define assert(condition) ((void)0)   /* disable assert (default) */
  ------------------
 1793|    313|        RETURN_ERROR_IF(!BIT_endOfDStream(&seqState.DStream), corruption_detected, "");
  ------------------
  |  |  114|    313|    do {                                                                       \
  |  |  115|    313|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 12, False: 301]
  |  |  ------------------
  |  |  116|     12|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|     12|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|     12|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|     12|    do {                                           \
  |  |  |  |   99|     12|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|     12|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|     12|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|     12|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|     12|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|     12|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|     12|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|     12|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|     12|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|     12|        }                                                                      \
  |  |  123|    313|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 301]
  |  |  ------------------
  ------------------
 1794|       |        /* save reps for next block */
 1795|  1.20k|        { U32 i; for (i=0; i<ZSTD_REP_NUM; i++) dctx->entropy.rep[i] = (U32)(seqState.prevOffset[i]); }
  ------------------
  |  |   64|  1.20k|#define ZSTD_REP_NUM      3                 /* number of repcodes */
  ------------------
  |  Branch (1795:28): [True: 903, False: 301]
  ------------------
 1796|    301|    }
 1797|       |
 1798|       |    /* last literal segment */
 1799|    458|    {   size_t const lastLLSize = (size_t)(litEnd - litPtr);
 1800|    458|        DEBUGLOG(6, "copy last literals : %u", (U32)lastLLSize);
  ------------------
  |  |  104|    458|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 458]
  |  |  ------------------
  ------------------
 1801|    458|        RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, "");
  ------------------
  |  |  114|    458|    do {                                                                       \
  |  |  115|    458|        if (cond) {                                                            \
  |  |  ------------------
  |  |  |  Branch (115:13): [True: 5, False: 453]
  |  |  ------------------
  |  |  116|      5|            RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s",          \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  117|      5|                  __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
  |  |  118|      5|            _FORCE_HAS_FORMAT_STRING(__VA_ARGS__);                             \
  |  |  ------------------
  |  |  |  |   98|      5|    do {                                           \
  |  |  |  |   99|      5|        if (0) {                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|            _force_has_format_string(__VA_ARGS__); \
  |  |  |  |  101|      0|        }                                          \
  |  |  |  |  102|      5|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (102:14): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  119|      5|            RAWLOG(3, ": " __VA_ARGS__);                                       \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  120|      5|            RAWLOG(3, "\n");                                                   \
  |  |  ------------------
  |  |  |  |  103|      5|#  define RAWLOG(l, ...)   do { } while (0)    /* disabled */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (103:42): [Folded, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  121|      5|            return ERROR(err);                                                 \
  |  |  ------------------
  |  |  |  |   49|      5|#define ERROR(name) ZSTD_ERROR(name)
  |  |  |  |  ------------------
  |  |  |  |  |  |   50|      5|#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      5|#define PREFIX(name) ZSTD_error_##name
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  122|      5|        }                                                                      \
  |  |  123|    458|    } while (0)
  |  |  ------------------
  |  |  |  Branch (123:14): [Folded, False: 453]
  |  |  ------------------
  ------------------
 1802|    453|        if (op != NULL) {
  ------------------
  |  Branch (1802:13): [True: 453, False: 0]
  ------------------
 1803|    453|            ZSTD_memcpy(op, litPtr, lastLLSize);
  ------------------
  |  |   44|    453|# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
  ------------------
 1804|    453|            op += lastLLSize;
 1805|    453|    }   }
 1806|       |
 1807|    453|    DEBUGLOG(6, "decoded block of size %u bytes", (U32)(op - ostart));
  ------------------
  |  |  104|    453|#  define DEBUGLOG(l, ...) do { } while (0)    /* disabled */
  |  |  ------------------
  |  |  |  Branch (104:42): [Folded, False: 453]
  |  |  ------------------
  ------------------
 1808|    453|    return (size_t)(op - ostart);
 1809|    458|}

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

bshuf_trans_byte_bitrow_AVX:
  131|  25.2k|                                    const size_t elem_size) {
  132|       |
  133|  25.2k|  size_t hh, ii, jj, kk, mm;
  134|  25.2k|  const char* in_b = (const char*) in;
  135|  25.2k|  char* out_b = (char*) out;
  136|       |
  137|  25.2k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  25.2k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 25.2k]
  |  |  ------------------
  ------------------
  138|       |
  139|  25.2k|  size_t nrows = 8 * elem_size;
  140|  25.2k|  size_t nbyte_row = size / 8;
  141|       |
  142|  25.2k|  if (elem_size % 4) return bshuf_trans_byte_bitrow_SSE(in, out, size,
  ------------------
  |  Branch (142:7): [True: 25.1k, False: 61]
  ------------------
  143|  25.1k|                                                        elem_size);
  144|       |
  145|     61|  __m256i ymm_0[8];
  146|     61|  __m256i ymm_1[8];
  147|     61|  __m256i ymm_storeage[8][4];
  148|       |
  149|   101k|  for (jj = 0; jj + 31 < nbyte_row; jj += 32) {
  ------------------
  |  Branch (149:16): [True: 100k, False: 61]
  ------------------
  150|  1.13M|    for (ii = 0; ii + 3 < elem_size; ii += 4) {
  ------------------
  |  Branch (150:18): [True: 1.03M, False: 100k]
  ------------------
  151|  5.16M|      for (hh = 0; hh < 4; hh ++) {
  ------------------
  |  Branch (151:20): [True: 4.13M, False: 1.03M]
  ------------------
  152|       |
  153|  37.2M|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (153:22): [True: 33.0M, False: 4.13M]
  ------------------
  154|  33.0M|          ymm_0[kk] = _mm256_loadu_si256((__m256i *) &in_b[
  155|  33.0M|              (ii * 8 + hh * 8 + kk) * nbyte_row + jj]);
  156|  33.0M|        }
  157|       |
  158|  20.6M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (158:22): [True: 16.5M, False: 4.13M]
  ------------------
  159|  16.5M|          ymm_1[kk] = _mm256_unpacklo_epi8(ymm_0[kk * 2],
  160|  16.5M|                                           ymm_0[kk * 2 + 1]);
  161|  16.5M|          ymm_1[kk + 4] = _mm256_unpackhi_epi8(ymm_0[kk * 2],
  162|  16.5M|                                               ymm_0[kk * 2 + 1]);
  163|  16.5M|        }
  164|       |
  165|  12.4M|        for (kk = 0; kk < 2; kk ++){
  ------------------
  |  Branch (165:22): [True: 8.26M, False: 4.13M]
  ------------------
  166|  24.8M|          for (mm = 0; mm < 2; mm ++){
  ------------------
  |  Branch (166:24): [True: 16.5M, False: 8.26M]
  ------------------
  167|  16.5M|            ymm_0[kk * 4 + mm] = _mm256_unpacklo_epi16(
  168|  16.5M|                ymm_1[kk * 4 + mm * 2],
  169|  16.5M|                ymm_1[kk * 4 + mm * 2 + 1]);
  170|  16.5M|            ymm_0[kk * 4 + mm + 2] = _mm256_unpackhi_epi16(
  171|  16.5M|                ymm_1[kk * 4 + mm * 2],
  172|  16.5M|                ymm_1[kk * 4 + mm * 2 + 1]);
  173|  16.5M|          }
  174|  8.26M|        }
  175|       |
  176|  20.6M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (176:22): [True: 16.5M, False: 4.13M]
  ------------------
  177|  16.5M|          ymm_1[kk * 2] = _mm256_unpacklo_epi32(ymm_0[kk * 2],
  178|  16.5M|                                                ymm_0[kk * 2 + 1]);
  179|  16.5M|          ymm_1[kk * 2 + 1] = _mm256_unpackhi_epi32(ymm_0[kk * 2],
  180|  16.5M|                                                    ymm_0[kk * 2 + 1]);
  181|  16.5M|        }
  182|       |
  183|  37.2M|        for (kk = 0; kk < 8; kk ++){
  ------------------
  |  Branch (183:22): [True: 33.0M, False: 4.13M]
  ------------------
  184|  33.0M|          ymm_storeage[kk][hh] = ymm_1[kk];
  185|  33.0M|        }
  186|  4.13M|      }
  187|       |
  188|  9.30M|      for (mm = 0; mm < 8; mm ++) {
  ------------------
  |  Branch (188:20): [True: 8.26M, False: 1.03M]
  ------------------
  189|       |
  190|  41.3M|        for (kk = 0; kk < 4; kk ++){
  ------------------
  |  Branch (190:22): [True: 33.0M, False: 8.26M]
  ------------------
  191|  33.0M|          ymm_0[kk] = ymm_storeage[mm][kk];
  192|  33.0M|        }
  193|       |
  194|  8.26M|        ymm_1[0] = _mm256_unpacklo_epi64(ymm_0[0], ymm_0[1]);
  195|  8.26M|        ymm_1[1] = _mm256_unpacklo_epi64(ymm_0[2], ymm_0[3]);
  196|  8.26M|        ymm_1[2] = _mm256_unpackhi_epi64(ymm_0[0], ymm_0[1]);
  197|  8.26M|        ymm_1[3] = _mm256_unpackhi_epi64(ymm_0[2], ymm_0[3]);
  198|       |
  199|  8.26M|        ymm_0[0] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 32);
  200|  8.26M|        ymm_0[1] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 32);
  201|  8.26M|        ymm_0[2] = _mm256_permute2x128_si256(ymm_1[0], ymm_1[1], 49);
  202|  8.26M|        ymm_0[3] = _mm256_permute2x128_si256(ymm_1[2], ymm_1[3], 49);
  203|       |
  204|  8.26M|        _mm256_storeu_si256((__m256i *) &out_b[
  205|  8.26M|            (jj + mm * 2 + 0 * 16) * nrows + ii * 8], ymm_0[0]);
  206|  8.26M|        _mm256_storeu_si256((__m256i *) &out_b[
  207|  8.26M|            (jj + mm * 2 + 0 * 16 + 1) * nrows + ii * 8], ymm_0[1]);
  208|  8.26M|        _mm256_storeu_si256((__m256i *) &out_b[
  209|  8.26M|            (jj + mm * 2 + 1 * 16) * nrows + ii * 8], ymm_0[2]);
  210|  8.26M|        _mm256_storeu_si256((__m256i *) &out_b[
  211|  8.26M|            (jj + mm * 2 + 1 * 16 + 1) * nrows + ii * 8], ymm_0[3]);
  212|  8.26M|      }
  213|  1.03M|    }
  214|   100k|  }
  215|  23.6k|  for (ii = 0; ii < nrows; ii ++ ) {
  ------------------
  |  Branch (215:16): [True: 23.6k, False: 61]
  ------------------
  216|  99.5k|    for (jj = nbyte_row - nbyte_row % 32; jj < nbyte_row; jj ++) {
  ------------------
  |  Branch (216:43): [True: 75.9k, False: 23.6k]
  ------------------
  217|  75.9k|      out_b[jj * nrows + ii] = in_b[ii * nbyte_row + jj];
  218|  75.9k|    }
  219|  23.6k|  }
  220|     61|  return size * elem_size;
  221|  25.2k|}
bshuf_shuffle_bit_eightelem_AVX:
  242|  25.2k|                                        const size_t elem_size) {
  243|       |
  244|  25.2k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  25.2k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 25.2k]
  |  |  ------------------
  ------------------
  245|       |
  246|       |  // With a bit of care, this could be written such that such that it is
  247|       |  // in_buf = out_buf safe.
  248|  25.2k|  const char* in_b = (const char*) in;
  249|  25.2k|  char* out_b = (char*) out;
  250|       |
  251|  25.2k|  size_t ii, jj, kk;
  252|  25.2k|  size_t nbyte = elem_size * size;
  253|       |
  254|  25.2k|  __m256i ymm;
  255|  25.2k|  int32_t bt;
  256|       |
  257|  25.2k|  if (elem_size <= 2) {
  ------------------
  |  Branch (257:7): [True: 0, False: 25.2k]
  ------------------
  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|  25.2k|  } else if (elem_size % 4) {
  ------------------
  |  Branch (275:14): [True: 25.1k, False: 61]
  ------------------
  276|  25.1k|    return bshuf_shuffle_bit_eightelem_SSE(in, out, size, elem_size);
  277|  25.1k|  } else {
  278|    799|    for (jj = 0; jj + 31 < 8 * elem_size; jj += 32) {
  ------------------
  |  Branch (278:18): [True: 738, False: 61]
  ------------------
  279|  33.0M|      for (ii = 0; ii + 8 * elem_size - 1 < nbyte;
  ------------------
  |  Branch (279:20): [True: 33.0M, False: 738]
  ------------------
  280|  33.0M|           ii += 8 * elem_size) {
  281|  33.0M|        ymm = _mm256_loadu_si256((__m256i *) &in_b[ii + jj]);
  282|   297M|        for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (282:22): [True: 264M, False: 33.0M]
  ------------------
  283|   264M|          bt = _mm256_movemask_epi8(ymm);
  284|   264M|          ymm = _mm256_slli_epi16(ymm, 1);
  285|   264M|          size_t ind = (ii + jj / 8 + (7 - kk) * elem_size);
  286|   264M|          * (int32_t *) &out_b[ind] = bt;
  287|   264M|        }
  288|  33.0M|      }
  289|    738|    }
  290|     61|  }
  291|     61|  return size * elem_size;
  292|  25.2k|}
bshuf_untrans_bit_elem_AVX:
  297|  53.3k|                                   const size_t elem_size, void* tmp_buf) {
  298|       |
  299|  53.3k|  int64_t count;
  300|       |
  301|  53.3k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  53.3k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 53.3k]
  |  |  ------------------
  ------------------
  302|       |
  303|  53.3k|  if (elem_size == 1) return bshuf_untrans_bit_byte_SSE(in, out, size);
  ------------------
  |  Branch (303:7): [True: 33, False: 53.3k]
  ------------------
  304|  53.3k|  if ((elem_size == 2 || elem_size == 4 || elem_size == 8 || elem_size == 16)
  ------------------
  |  Branch (304:8): [True: 55, False: 53.3k]
  |  Branch (304:26): [True: 17, False: 53.2k]
  |  Branch (304:44): [True: 28.0k, False: 25.2k]
  |  Branch (304:62): [True: 34, False: 25.2k]
  ------------------
  305|  28.1k|      && size <= INT32_MAX / elem_size) {
  ------------------
  |  Branch (305:10): [True: 28.1k, False: 0]
  ------------------
  306|   252k|    for (size_t j = 0; j < elem_size; ++j) {
  ------------------
  |  Branch (306:24): [True: 224k, False: 28.1k]
  ------------------
  307|   224k|      bshuf_untrans_bit_byte_SSE((const uint8_t*)in + j * size, (uint8_t*)tmp_buf + j * size, size);
  308|   224k|    }
  309|  28.1k|    unshuffle_avx2((int32_t)elem_size, (int32_t)(size * elem_size), tmp_buf, out);
  310|  28.1k|    return size * elem_size;
  311|  28.1k|  }
  312|  25.2k|  count = bshuf_trans_byte_bitrow_AVX(in, tmp_buf, size, elem_size);
  313|  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]
  |  |  ------------------
  ------------------
  314|  25.2k|  count =  bshuf_shuffle_bit_eightelem_AVX(tmp_buf, out, size, elem_size);
  315|       |
  316|  25.2k|  return count;
  317|  25.2k|}

bshuf_shuffle_bit_eightelem_scal:
  194|  14.0k|        const size_t size, const size_t elem_size) {
  195|       |
  196|  14.0k|  const char *in_b;
  197|  14.0k|  char *out_b;
  198|  14.0k|  uint64_t x, t;
  199|  14.0k|  size_t ii, jj, kk;
  200|  14.0k|  size_t nbyte, out_index;
  201|       |
  202|  14.0k|  uint64_t e=1;
  203|  14.0k|  const int little_endian = *(uint8_t *) &e == 1;
  204|  14.0k|  const size_t elem_skip = little_endian ? elem_size : -elem_size;
  ------------------
  |  Branch (204:28): [True: 14.0k, False: 0]
  ------------------
  205|  14.0k|  const uint64_t elem_offset = little_endian ? 0 : 7 * elem_size;
  ------------------
  |  Branch (205:32): [True: 14.0k, False: 0]
  ------------------
  206|       |
  207|  14.0k|  CHECK_MULT_EIGHT(size);
  ------------------
  |  |   35|  14.0k|#define CHECK_MULT_EIGHT(n) if (n % 8) return -80;
  |  |  ------------------
  |  |  |  Branch (35:33): [True: 0, False: 14.0k]
  |  |  ------------------
  ------------------
  208|       |
  209|  14.0k|  in_b = (const char*) in;
  210|  14.0k|  out_b = (char*) out;
  211|       |
  212|  14.0k|  nbyte = elem_size * size;
  213|       |
  214|   112k|  for (jj = 0; jj < 8 * elem_size; jj += 8) {
  ------------------
  |  Branch (214:16): [True: 98.6k, False: 14.0k]
  ------------------
  215|  29.2M|    for (ii = 0; ii + 8 * elem_size - 1 < nbyte; ii += 8 * elem_size) {
  ------------------
  |  Branch (215:18): [True: 29.1M, False: 98.6k]
  ------------------
  216|  29.1M|      x = *((uint64_t*) &in_b[ii + jj]);
  217|  29.1M|      if (little_endian) {
  ------------------
  |  Branch (217:11): [True: 29.1M, False: 0]
  ------------------
  218|  29.1M|        TRANS_BIT_8X8(x, t);
  ------------------
  |  |   54|  29.1M|#define TRANS_BIT_8X8(x, t) {                                               \
  |  |   55|  29.1M|        t = (x ^ (x >> 7)) & 0x00AA00AA00AA00AALL;                          \
  |  |   56|  29.1M|        x = x ^ t ^ (t << 7);                                               \
  |  |   57|  29.1M|        t = (x ^ (x >> 14)) & 0x0000CCCC0000CCCCLL;                         \
  |  |   58|  29.1M|        x = x ^ t ^ (t << 14);                                              \
  |  |   59|  29.1M|        t = (x ^ (x >> 28)) & 0x00000000F0F0F0F0LL;                         \
  |  |   60|  29.1M|        x = x ^ t ^ (t << 28);                                              \
  |  |   61|  29.1M|    }
  ------------------
  219|  29.1M|      } 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|   262M|      for (kk = 0; kk < 8; kk++) {
  ------------------
  |  Branch (222:20): [True: 232M, False: 29.1M]
  ------------------
  223|   232M|        out_index = ii + jj / 8 + elem_offset + kk * elem_skip;
  224|   232M|        *((uint8_t*) &out_b[out_index]) = x;
  225|   232M|        x = x >> 8;
  226|   232M|      }
  227|  29.1M|    }
  228|  98.6k|  }
  229|  14.0k|  return size * elem_size;
  230|  14.0k|}

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

blosc2.c:blosc2_checked_add_i64:
   51|     36|static inline bool blosc2_checked_add_i64(int64_t a, int64_t b, int64_t *out) {
   52|     36|  if ((b > 0 && a > INT64_MAX - b) || (b < 0 && a < INT64_MIN - b)) {
  ------------------
  |  Branch (52:8): [True: 36, False: 0]
  |  Branch (52:17): [True: 0, False: 36]
  |  Branch (52:40): [True: 0, False: 36]
  |  Branch (52:49): [True: 0, False: 0]
  ------------------
   53|      0|    return false;
   54|      0|  }
   55|     36|  if (out != NULL) {
  ------------------
  |  Branch (55:7): [True: 36, False: 0]
  ------------------
   56|     36|    *out = a + b;
   57|     36|  }
   58|       |  return true;
   59|     36|}
blosc2.c:blosc2_checked_mul_size:
   41|  69.9k|static inline bool blosc2_checked_mul_size(size_t a, size_t b, size_t *out) {
   42|  69.9k|  if (a != 0 && b > SIZE_MAX / a) {
  ------------------
  |  Branch (42:7): [True: 69.9k, False: 69]
  |  Branch (42:17): [True: 0, False: 69.9k]
  ------------------
   43|      0|    return false;
   44|      0|  }
   45|  69.9k|  if (out != NULL) {
  ------------------
  |  Branch (45:7): [True: 69.9k, False: 0]
  ------------------
   46|  69.9k|    *out = a * b;
   47|  69.9k|  }
   48|       |  return true;
   49|  69.9k|}
blosc2.c:blosc2_checked_add_size:
   31|  70.0k|static inline bool blosc2_checked_add_size(size_t a, size_t b, size_t *out) {
   32|  70.0k|  if (a > SIZE_MAX - b) {
  ------------------
  |  Branch (32:7): [True: 0, False: 70.0k]
  ------------------
   33|      0|    return false;
   34|      0|  }
   35|  70.0k|  if (out != NULL) {
  ------------------
  |  Branch (35:7): [True: 70.0k, False: 0]
  ------------------
   36|  70.0k|    *out = a + b;
   37|  70.0k|  }
   38|       |  return true;
   39|  70.0k|}

blosc2.c:is_little_endian:
   42|  50.4M|static bool is_little_endian(void) {
   43|  50.4M|  static const int i = 1;
   44|  50.4M|  char* p = (char*)&i;
   45|       |
   46|  50.4M|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 50.4M, False: 0]
  ------------------
   47|  50.4M|    return true;
   48|  50.4M|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|  50.4M|}
blosc2.c:load_lib:
  439|      4|static inline void* load_lib(char *plugin_name, char *libpath) {
  440|      4|  if (!blosc2_valid_plugin_name(plugin_name)) {
  ------------------
  |  Branch (440:7): [True: 0, False: 4]
  ------------------
  441|      0|    BLOSC_TRACE_ERROR("Invalid plugin name");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  442|      0|    return NULL;
  443|      0|  }
  444|       |    // Attempt to directly load the library by name
  445|       |#if defined(_WIN32)
  446|       |    // Windows dynamic library (DLL) format
  447|       |    snprintf(libpath, PATH_MAX, "blosc2_%s.dll", plugin_name);
  448|       |#else
  449|       |    // Unix/Linux/Mac OS dynamic library (.so) format
  450|      4|    snprintf(libpath, PATH_MAX, "libblosc2_%s.so", plugin_name);
  451|      4|#endif
  452|      4|    void* loaded_lib = dlopen(libpath, RTLD_LAZY);
  453|      4|    if (loaded_lib != NULL) {
  ------------------
  |  Branch (453:9): [True: 0, False: 4]
  ------------------
  454|      0|        BLOSC_TRACE_INFO("Successfully loaded %s directly\n", libpath);
  ------------------
  |  |   95|      0|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  455|      0|        return loaded_lib;
  456|      4|    } else {
  457|       |#if defined(_WIN32)
  458|       |        BLOSC_TRACE_INFO("Failed to load %s directly, error: %lu\n", libpath, GetLastError());
  459|       |#else
  460|      4|        BLOSC_TRACE_INFO("Failed to load %s directly, error: %s\n", libpath, dlerror());
  ------------------
  |  |   95|      4|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  461|      4|#endif
  462|      4|    }
  463|       |    // If direct loading fails, fallback to using Python to find the library path
  464|      4|    if (get_libpath(plugin_name, libpath, "") < 0 && get_libpath(plugin_name, libpath, "3") < 0) {
  ------------------
  |  Branch (464:9): [True: 4, False: 0]
  |  Branch (464:54): [True: 4, False: 0]
  ------------------
  465|      4|        BLOSC_TRACE_ERROR("Problems when running python or python3 for getting plugin path");
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  466|      4|        return NULL;
  467|      4|    }
  468|       |
  469|      0|    if (strlen(libpath) == 0) {
  ------------------
  |  Branch (469:9): [True: 0, False: 0]
  ------------------
  470|      0|        BLOSC_TRACE_ERROR("Could not find plugin libpath");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  471|      0|        return NULL;
  472|      0|    }
  473|       |
  474|       |    // Try to load the library again with the path from Python
  475|      0|    loaded_lib = dlopen(libpath, RTLD_LAZY);
  476|      0|    if (loaded_lib == NULL) {
  ------------------
  |  Branch (476:9): [True: 0, False: 0]
  ------------------
  477|      0|        BLOSC_TRACE_ERROR("Attempt to load plugin in path '%s' failed with error: %s", libpath, dlerror());
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  478|      0|    } else {
  479|      0|        BLOSC_TRACE_INFO("Successfully loaded library with Python path: %s\n", libpath);
  ------------------
  |  |   95|      0|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  480|      0|    }
  481|       |
  482|      0|    return loaded_lib;
  483|      0|}
blosc2.c:blosc2_valid_plugin_name:
  397|     12|static inline bool blosc2_valid_plugin_name(const char *plugin_name) {
  398|     12|  if (plugin_name == NULL || plugin_name[0] == '\0') {
  ------------------
  |  Branch (398:7): [True: 0, False: 12]
  |  Branch (398:30): [True: 0, False: 12]
  ------------------
  399|      0|    return false;
  400|      0|  }
  401|     78|  for (const unsigned char *p = (const unsigned char *)plugin_name; *p != '\0'; ++p) {
  ------------------
  |  Branch (401:69): [True: 66, False: 12]
  ------------------
  402|     66|    if (!isalnum(*p) && *p != '_') {
  ------------------
  |  Branch (402:9): [True: 0, False: 66]
  |  Branch (402:25): [True: 0, False: 0]
  ------------------
  403|      0|      return false;
  404|      0|    }
  405|     66|  }
  406|     12|  return true;
  407|     12|}
blosc2.c:get_libpath:
  410|      8|static inline int get_libpath(char *plugin_name, char *libpath, char *python_version) {
  411|      8|  BLOSC_TRACE_INFO("Trying to get plugin path with python%s\n", python_version);
  ------------------
  |  |   95|      8|#define BLOSC_TRACE_INFO(msg, ...) BLOSC_TRACE(info, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      8|    do {                                            \
  |  |  |  |   98|      8|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      8|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 8, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      8|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|      8|  char python_cmd[PATH_MAX] = {0};
  413|      8|  if (!blosc2_valid_plugin_name(plugin_name)) {
  ------------------
  |  Branch (413:7): [True: 0, False: 8]
  ------------------
  414|      0|    BLOSC_TRACE_ERROR("Invalid plugin name");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  415|      0|    return BLOSC2_ERROR_INVALID_PARAM;
  416|      0|  }
  417|      8|  int written = snprintf(python_cmd, sizeof(python_cmd),
  418|      8|                         "python%s -c \"import blosc2_%s; blosc2_%s.print_libpath()\"",
  419|      8|                         python_version, plugin_name, plugin_name);
  420|      8|  if (written < 0 || (size_t)written >= sizeof(python_cmd)) {
  ------------------
  |  Branch (420:7): [True: 0, False: 8]
  |  Branch (420:22): [True: 0, False: 8]
  ------------------
  421|      0|    BLOSC_TRACE_ERROR("Python command is too long");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  422|      0|    return BLOSC2_ERROR_FAILURE;
  423|      0|  }
  424|      8|  FILE *fp = popen(python_cmd, "r");
  425|      8|  if (fp == NULL) {
  ------------------
  |  Branch (425:7): [True: 0, False: 8]
  ------------------
  426|      0|    BLOSC_TRACE_ERROR("Could not run python");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|      0|    return BLOSC2_ERROR_FAILURE;
  428|      0|  }
  429|      8|  if (fgets(libpath, PATH_MAX, fp) == NULL) {
  ------------------
  |  Branch (429:7): [True: 8, False: 0]
  ------------------
  430|      8|    BLOSC_TRACE_ERROR("Could not read python output");
  ------------------
  |  |   93|      8|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      8|    do {                                            \
  |  |  |  |   98|      8|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      8|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 8, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      8|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  431|      8|    pclose(fp);
  432|      8|    return BLOSC2_ERROR_FAILURE;
  433|      8|  }
  434|      0|  pclose(fp);
  435|       |
  436|      0|  return BLOSC2_ERROR_SUCCESS;
  437|      8|}
blosc2.c:sw32_:
  216|   344k|static inline int32_t sw32_(const void* pa) {
  217|   344k|  int32_t idest;
  218|       |
  219|   344k|  bool little_endian = is_little_endian();
  220|   344k|  if (little_endian) {
  ------------------
  |  Branch (220:7): [True: 344k, False: 0]
  ------------------
  221|   344k|    memcpy(&idest, pa, sizeof(idest));
  222|   344k|  }
  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|   344k|  return idest;
  238|   344k|}
blosc2.c:filters_contain:
  131|  68.6k|static inline bool filters_contain(const uint8_t *filters, uint8_t id) {
  132|   395k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (132:19): [True: 351k, False: 43.0k]
  ------------------
  133|   351k|    if (filters[i] == id) {
  ------------------
  |  Branch (133:9): [True: 25.5k, False: 326k]
  ------------------
  134|  25.5k|      return true;
  135|  25.5k|    }
  136|   351k|  }
  137|  43.0k|  return false;
  138|  68.6k|}
frame.c:endian_handler:
   56|   631k|{
   57|   631k|  bool little_endian = is_little_endian();
   58|   631k|  if (little_endian == little) {
  ------------------
  |  Branch (58:7): [True: 0, False: 631k]
  ------------------
   59|      0|    memcpy(dest, pa, size);
   60|      0|  }
   61|   631k|  else {
   62|   631k|    uint8_t* pa_ = (uint8_t*)pa;
   63|   631k|    uint8_t pa2_[8];
   64|   631k|    switch (size) {
   65|   267k|      case 8:
  ------------------
  |  Branch (65:7): [True: 267k, False: 364k]
  ------------------
   66|   267k|        pa2_[0] = pa_[7];
   67|   267k|        pa2_[1] = pa_[6];
   68|   267k|        pa2_[2] = pa_[5];
   69|   267k|        pa2_[3] = pa_[4];
   70|   267k|        pa2_[4] = pa_[3];
   71|   267k|        pa2_[5] = pa_[2];
   72|   267k|        pa2_[6] = pa_[1];
   73|   267k|        pa2_[7] = pa_[0];
   74|   267k|        break;
   75|   353k|      case 4:
  ------------------
  |  Branch (75:7): [True: 353k, False: 278k]
  ------------------
   76|   353k|        pa2_[0] = pa_[3];
   77|   353k|        pa2_[1] = pa_[2];
   78|   353k|        pa2_[2] = pa_[1];
   79|   353k|        pa2_[3] = pa_[0];
   80|   353k|        break;
   81|  3.95k|      case 2:
  ------------------
  |  Branch (81:7): [True: 3.95k, False: 627k]
  ------------------
   82|  3.95k|        pa2_[0] = pa_[1];
   83|  3.95k|        pa2_[1] = pa_[0];
   84|  3.95k|        break;
   85|  7.18k|      case 1:
  ------------------
  |  Branch (85:7): [True: 7.18k, False: 624k]
  ------------------
   86|  7.18k|        pa2_[0] = pa_[0];
   87|  7.18k|        break;
   88|      0|      default:
  ------------------
  |  Branch (88:7): [True: 0, False: 631k]
  ------------------
   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|   631k|    }
   91|   631k|    memcpy(dest, pa2_, size);
   92|   631k|  }
   93|   631k|}
frame.c:is_little_endian:
   42|   631k|static bool is_little_endian(void) {
   43|   631k|  static const int i = 1;
   44|   631k|  char* p = (char*)&i;
   45|       |
   46|   631k|  if (p[0] == 1) {
  ------------------
  |  Branch (46:7): [True: 631k, False: 0]
  ------------------
   47|   631k|    return true;
   48|   631k|  }
   49|      0|  else {
   50|       |    return false;
   51|      0|  }
   52|   631k|}
frame.c:blosc2_nchunks_to_offsets_nbytes:
  103|   178k|static inline bool blosc2_nchunks_to_offsets_nbytes(int64_t nchunks, int32_t *off_nbytes) {
  104|   178k|  const int64_t max_nchunks = INT32_MAX / (int64_t)sizeof(int64_t);
  105|   178k|  if (nchunks < 0 || nchunks > max_nchunks) {
  ------------------
  |  Branch (105:7): [True: 0, False: 178k]
  |  Branch (105:22): [True: 1, False: 178k]
  ------------------
  106|      1|    return false;
  107|      1|  }
  108|   178k|  if (off_nbytes != NULL) {
  ------------------
  |  Branch (108:7): [True: 178k, False: 0]
  ------------------
  109|   178k|    *off_nbytes = (int32_t)(nchunks * (int64_t)sizeof(int64_t));
  110|   178k|  }
  111|       |  return true;
  112|   178k|}

blosc2_stdio_open:
  122|     40|void *blosc2_stdio_open(const char *urlpath, const char *mode, void *params) {
  123|     40|  BLOSC_UNUSED_PARAM(params);
  ------------------
  |  |   28|     40|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  124|     40|  if (urlpath == NULL || mode == NULL) {
  ------------------
  |  Branch (124:7): [True: 40, False: 0]
  |  Branch (124:26): [True: 0, False: 0]
  ------------------
  125|     40|    BLOSC_TRACE_ERROR("Invalid arguments for stdio open.");
  ------------------
  |  |   93|     40|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     40|    do {                                            \
  |  |  |  |   98|     40|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     40|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 40, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     40|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  126|     40|    return NULL;
  127|     40|  }
  128|      0|  FILE *file = fopen(urlpath, mode);
  129|      0|  if (file == NULL) {
  ------------------
  |  Branch (129:7): [True: 0, False: 0]
  ------------------
  130|      0|    BLOSC_TRACE_ERROR("Cannot open the file %s with mode %s.", urlpath, mode);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  131|      0|    return NULL;
  132|      0|  }
  133|      0|#if !defined(_WIN32)
  134|       |  /* Frames keep their handles open between calls, so do not let exec'd child
  135|       |     processes inherit them */
  136|      0|  int fd_flags = fcntl(fileno(file), F_GETFD);
  137|      0|  if (fd_flags >= 0) {
  ------------------
  |  Branch (137:7): [True: 0, False: 0]
  ------------------
  138|      0|    fcntl(fileno(file), F_SETFD, fd_flags | FD_CLOEXEC);
  139|      0|  }
  140|      0|#endif
  141|      0|  blosc2_stdio_file *my_fp = malloc(sizeof(blosc2_stdio_file));
  142|      0|  if (my_fp == NULL) {
  ------------------
  |  Branch (142:7): [True: 0, False: 0]
  ------------------
  143|      0|    BLOSC_TRACE_ERROR("Cannot allocate memory for stdio file wrapper.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  144|      0|    fclose(file);
  145|      0|    return NULL;
  146|      0|  }
  147|      0|  my_fp->file = file;
  148|      0|  return my_fp;
  149|      0|}
blosc2_stdio_destroy:
  272|  7.00k|int blosc2_stdio_destroy(void* params) {
  273|  7.00k|  BLOSC_UNUSED_PARAM(params);
  ------------------
  |  |   28|  7.00k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  274|  7.00k|  return 0;
  275|  7.00k|}

do_nothing:
  815|  2.90M|int do_nothing(const blosc2_context* context, int i, char cmode) {
  816|  2.90M|  uint8_t filter = context->filters[i];
  817|  2.90M|  if (filter == BLOSC_SHUFFLE) {
  ------------------
  |  Branch (817:7): [True: 685k, False: 2.21M]
  ------------------
  818|       |    // Shuffling single bytes is the identity, so skip it instead of copying the block
  819|   685k|    return shuffle_size(context, i) == 1;
  820|   685k|  }
  821|  2.21M|  if (cmode == 'c') {
  ------------------
  |  Branch (821:7): [True: 0, False: 2.21M]
  ------------------
  822|      0|    return (filter == BLOSC_NOFILTER);
  823|  2.21M|  } else {
  824|       |    // TRUNC_PREC do not have to be applied during decompression
  825|  2.21M|    return ((filter == BLOSC_NOFILTER) || (filter == BLOSC_TRUNC_PREC));
  ------------------
  |  Branch (825:13): [True: 1.16M, False: 1.05M]
  |  Branch (825:43): [True: 118k, False: 933k]
  ------------------
  826|  2.21M|  }
  827|  2.21M|}
next_filter:
  830|   564k|int next_filter(const blosc2_context* context, int current_filter, char cmode) {
  831|  1.11M|  for (int i = current_filter - 1; i >= 0; i--) {
  ------------------
  |  Branch (831:36): [True: 1.11M, False: 0]
  ------------------
  832|  1.11M|    if (!do_nothing(context, i, cmode)) {
  ------------------
  |  Branch (832:9): [True: 564k, False: 550k]
  ------------------
  833|   564k|      return context->filters[i];
  834|   564k|    }
  835|  1.11M|  }
  836|      0|  return BLOSC_NOFILTER;
  837|   564k|}
last_filter:
  840|   168k|int last_filter(const blosc2_context* context, char cmode) {
  841|   168k|  int last_index = -1;
  842|  1.17M|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (842:40): [True: 1.01M, False: 168k]
  ------------------
  843|  1.01M|    if (!do_nothing(context, i, cmode))  {
  ------------------
  |  Branch (843:9): [True: 536k, False: 474k]
  ------------------
  844|   536k|      last_index = i;
  845|   536k|    }
  846|  1.01M|  }
  847|   168k|  return last_index;
  848|   168k|}
read_chunk_header:
  927|  50.1M|{
  928|  50.1M|  memset(header, 0, sizeof(blosc_header));
  929|       |
  930|  50.1M|  if (srcsize < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (930:7): [True: 0, False: 50.1M]
  ------------------
  931|      0|    BLOSC_TRACE_ERROR("Not enough space to read Blosc header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  932|      0|    return BLOSC2_ERROR_READ_BUFFER;
  933|      0|  }
  934|       |
  935|  50.1M|  memcpy(header, src, BLOSC_MIN_HEADER_LENGTH);
  936|       |
  937|  50.1M|  bool little_endian = is_little_endian();
  938|       |
  939|  50.1M|  if (!little_endian) {
  ------------------
  |  Branch (939:7): [True: 0, False: 50.1M]
  ------------------
  940|      0|    header->nbytes = bswap32_(header->nbytes);
  941|      0|    header->blocksize = bswap32_(header->blocksize);
  942|      0|    header->cbytes = bswap32_(header->cbytes);
  943|      0|  }
  944|       |
  945|  50.1M|  if (header->cbytes < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (945:7): [True: 18, False: 50.1M]
  ------------------
  946|     18|    BLOSC_TRACE_ERROR("`cbytes` is too small to read min header.");
  ------------------
  |  |   93|     18|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     18|    do {                                            \
  |  |  |  |   98|     18|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     18|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 18, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     18|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  947|     18|    return BLOSC2_ERROR_INVALID_HEADER;
  948|     18|  }
  949|  50.1M|  if (header->blocksize <= 0) {
  ------------------
  |  Branch (949:7): [True: 15, False: 50.1M]
  ------------------
  950|     15|    BLOSC_TRACE_ERROR("`blocksize` is zero");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  951|     15|    return BLOSC2_ERROR_INVALID_HEADER;
  952|     15|  }
  953|  50.1M|  if (header->blocksize > BLOSC2_MAXBLOCKSIZE) {
  ------------------
  |  Branch (953:7): [True: 14, False: 50.1M]
  ------------------
  954|     14|    BLOSC_TRACE_ERROR("`blocksize` greater than maximum allowed");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  955|     14|    return BLOSC2_ERROR_INVALID_HEADER;
  956|     14|  }
  957|  50.1M|  if (header->typesize == 0) {
  ------------------
  |  Branch (957:7): [True: 1, False: 50.1M]
  ------------------
  958|      1|    BLOSC_TRACE_ERROR("`typesize` is zero.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  959|      1|    return BLOSC2_ERROR_INVALID_HEADER;
  960|      1|  }
  961|       |
  962|       |  /* Read extended header if it is wanted */
  963|  50.1M|  if ((extended_header) && (header->flags & BLOSC_DOSHUFFLE) && (header->flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (963:7): [True: 186k, False: 49.9M]
  |  Branch (963:28): [True: 185k, False: 427]
  |  Branch (963:65): [True: 185k, False: 272]
  ------------------
  964|   185k|    if (header->cbytes < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (964:9): [True: 0, False: 185k]
  ------------------
  965|      0|      BLOSC_TRACE_ERROR("`cbytes` is too small to read extended header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  966|      0|      return BLOSC2_ERROR_INVALID_HEADER;
  967|      0|    }
  968|   185k|    if (srcsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (968:9): [True: 0, False: 185k]
  ------------------
  969|      0|      BLOSC_TRACE_ERROR("Not enough space to read Blosc extended header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  970|      0|      return BLOSC2_ERROR_READ_BUFFER;
  971|      0|    }
  972|       |
  973|   185k|    memcpy((uint8_t *)header + BLOSC_MIN_HEADER_LENGTH, src + BLOSC_MIN_HEADER_LENGTH,
  974|   185k|      BLOSC_EXTENDED_HEADER_LENGTH - BLOSC_MIN_HEADER_LENGTH);
  975|       |
  976|   185k|    if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) && (header->blosc2_flags != 0)) {
  ------------------
  |  Branch (976:9): [True: 40, False: 185k]
  |  Branch (976:55): [True: 24, False: 16]
  ------------------
  977|     24|      int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  978|     24|      if (special_type != 0) {
  ------------------
  |  Branch (978:11): [True: 0, False: 24]
  ------------------
  979|      0|        BLOSC_TRACE_ERROR("VL-block chunks cannot use special chunk encodings.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  980|      0|        return BLOSC2_ERROR_INVALID_HEADER;
  981|      0|      }
  982|     24|    }
  983|       |
  984|   185k|    int32_t special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
  985|   185k|    if (special_type != 0) {
  ------------------
  |  Branch (985:9): [True: 45.3k, False: 140k]
  ------------------
  986|  45.3k|      if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (986:11): [True: 24, False: 45.3k]
  ------------------
  987|       |        // In this case, the actual type size must be derived from the cbytes
  988|     24|        int32_t typesize = header->cbytes - BLOSC_EXTENDED_HEADER_LENGTH;
  989|     24|        if (typesize <= 0) {
  ------------------
  |  Branch (989:13): [True: 0, False: 24]
  ------------------
  990|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  991|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  992|      0|        }
  993|     24|        if (typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (993:13): [True: 0, False: 24]
  ------------------
  994|      0|          BLOSC_TRACE_ERROR("`typesize` is greater than maximum allowed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  995|      0|          return BLOSC2_ERROR_INVALID_HEADER;
  996|      0|        }
  997|     24|        if (typesize > header->nbytes) {
  ------------------
  |  Branch (997:13): [True: 6, False: 18]
  ------------------
  998|      6|          BLOSC_TRACE_ERROR("`typesize` is greater than `nbytes`");
  ------------------
  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  999|      6|          return BLOSC2_ERROR_INVALID_HEADER;
 1000|      6|        }
 1001|     18|        if (header->nbytes % typesize != 0) {
  ------------------
  |  Branch (1001:13): [True: 4, False: 14]
  ------------------
 1002|      4|          BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1003|      4|          return BLOSC2_ERROR_INVALID_HEADER;
 1004|      4|        }
 1005|     18|      }
 1006|  45.3k|      else {
 1007|       |        // All-zero chunks fill with memset, which works regardless of element alignment.
 1008|  45.3k|        if (special_type != BLOSC2_SPECIAL_ZERO
  ------------------
  |  Branch (1008:13): [True: 2.31k, False: 43.0k]
  ------------------
 1009|  2.31k|            && header->nbytes % header->typesize != 0) {
  ------------------
  |  Branch (1009:16): [True: 7, False: 2.30k]
  ------------------
 1010|      7|          BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1011|      7|          return BLOSC2_ERROR_INVALID_HEADER;
 1012|      7|        }
 1013|  45.3k|      }
 1014|  45.3k|    }
 1015|       |    // The number of filters depends on the version of the header. Blosc2 alpha series
 1016|       |    // did not initialize filters to zero beyond the max supported.
 1017|   185k|    if (header->version == BLOSC2_VERSION_FORMAT_ALPHA) {
  ------------------
  |  Branch (1017:9): [True: 14.8k, False: 170k]
  ------------------
 1018|  14.8k|      header->filters[5] = 0;
 1019|  14.8k|      header->filters_meta[5] = 0;
 1020|  14.8k|    }
 1021|   185k|  }
 1022|  49.9M|  else {
 1023|  49.9M|    flags_to_filters(header->flags, header->filters);
 1024|  49.9M|  }
 1025|  50.1M|  if (header->version > BLOSC2_VERSION_FORMAT &&
  ------------------
  |  Branch (1025:7): [True: 368k, False: 49.7M]
  ------------------
 1026|   368k|      (header->blosc2_flags2 & (uint8_t)~BLOSC2_VL_BLOCKS) != 0) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 368k]
  ------------------
 1027|       |    /* Version from future with unsupported chunk features. */
 1028|      0|    return BLOSC2_ERROR_VERSION_SUPPORT;
 1029|      0|  }
 1030|  50.1M|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0 &&
  ------------------
  |  Branch (1030:7): [True: 40, False: 50.1M]
  ------------------
 1031|     40|      (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0) {
  ------------------
  |  Branch (1031:7): [True: 0, False: 40]
  ------------------
 1032|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1033|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1034|      0|  }
 1035|  50.1M|  if ((header->blosc2_flags2 & BLOSC2_VL_BLOCKS) == 0 &&
  ------------------
  |  Branch (1035:7): [True: 50.1M, False: 40]
  ------------------
 1036|  50.1M|      header->nbytes > 0 && header->blocksize > header->nbytes) {
  ------------------
  |  Branch (1036:7): [True: 50.1M, False: 658]
  |  Branch (1036:29): [True: 150k, False: 49.9M]
  ------------------
 1037|   150k|    header->blocksize = header->nbytes;
 1038|   150k|  }
 1039|  50.1M|  return 0;
 1040|  50.1M|}
fill_codec:
 1196|      4|int fill_codec(blosc2_codec *codec) {
 1197|      4|  int rc = BLOSC2_ERROR_SUCCESS;
 1198|      4|  static_lock(&g_plugin_lock);
  ------------------
  |  |  132|      4|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 1199|       |  /* Unless another thread loaded it meanwhile */
 1200|      4|  if (codec->encoder == NULL || codec->decoder == NULL) {
  ------------------
  |  Branch (1200:7): [True: 4, False: 0]
  |  Branch (1200:33): [True: 0, False: 0]
  ------------------
 1201|      4|    rc = load_codec_locked(codec);
 1202|      4|  }
 1203|      4|  static_unlock(&g_plugin_lock);
  ------------------
  |  |  133|      4|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 1204|      4|  return rc;
 1205|      4|}
pipeline_backward:
 1884|   158k|                      uint8_t* tmp2, int last_filter_index, int32_t nblock) {
 1885|   158k|  (void)tmp2;
 1886|   158k|  blosc2_context* context = thread_context->parent_context;
 1887|   158k|  int32_t typesize = context->typesize;
 1888|   158k|  uint8_t* filters = context->filters;
 1889|   158k|  uint8_t* filters_meta = context->filters_meta;
 1890|   158k|  uint8_t* _src = (next_filter(context, BLOSC2_MAX_FILTERS, 'd') == BLOSC_DELTA &&
  ------------------
  |  Branch (1890:20): [True: 41.6k, False: 116k]
  ------------------
 1891|   116k|                   context->postfilter == NULL) ? (dest + offset) : src;
  ------------------
  |  Branch (1891:20): [True: 41.6k, False: 0]
  ------------------
 1892|   158k|  uint8_t* _dest = tmp;
 1893|   158k|  int errcode = 0;
 1894|       |
 1895|   780k|  for (int i = BLOSC2_MAX_FILTERS - 1; i >= 0; i--) {
  ------------------
  |  Branch (1895:40): [True: 780k, False: 0]
  ------------------
 1896|   780k|    if (do_nothing(context, i, 'd')) {
  ------------------
  |  Branch (1896:9): [True: 312k, False: 467k]
  ------------------
 1897|   312k|      continue;
 1898|   312k|    }
 1899|   467k|    int first_index = i;
 1900|   467k|#ifdef BLOSC_USE_FUSED_SHUFFLE_BYTEDELTA
 1901|   467k|    int fused_size = fused_shuffle_bytedelta_size(context, i - 1);
 1902|   467k|    if (fused_size) {
  ------------------
  |  Branch (1902:9): [True: 36.2k, False: 431k]
  ------------------
 1903|  36.2k|      first_index = i - 1;
 1904|  36.2k|    }
 1905|   467k|#endif
 1906|       |    // Delta filter requires the whole chunk ready. A fused inverse ends at
 1907|       |    // SHUFFLE's position, so select its sink using the pair's first index.
 1908|   467k|    int last_copy_filter = (last_filter_index == first_index) || (filters[i] == BLOSC_DELTA) ||
  ------------------
  |  Branch (1908:28): [True: 158k, False: 309k]
  |  Branch (1908:66): [True: 66.1k, False: 243k]
  ------------------
 1909|   243k|                           (next_filter(context, first_index, 'd') == BLOSC_DELTA);
  ------------------
  |  Branch (1909:28): [True: 52.6k, False: 190k]
  ------------------
 1910|   467k|    if (last_copy_filter && context->postfilter == NULL &&
  ------------------
  |  Branch (1910:9): [True: 277k, False: 190k]
  |  Branch (1910:29): [True: 277k, False: 0]
  ------------------
 1911|   277k|        (filters[i] == BLOSC_DELTA || _src != dest + offset)) {
  ------------------
  |  Branch (1911:10): [True: 96.0k, False: 181k]
  |  Branch (1911:39): [True: 155k, False: 26.0k]
  ------------------
 1912|   251k|      _dest = dest + offset;
 1913|   251k|    } else {
 1914|   216k|      _dest = (_src == src) ? tmp : src;
  ------------------
  |  Branch (1914:15): [True: 114k, False: 101k]
  ------------------
 1915|   216k|    }
 1916|   467k|    int rc = BLOSC2_ERROR_SUCCESS;
 1917|   467k|#ifdef BLOSC_USE_FUSED_SHUFFLE_BYTEDELTA
 1918|   467k|    if (fused_size && shuffle_bytedelta_backward(_src, _dest, bsize, fused_size)) {
  ------------------
  |  Branch (1918:9): [True: 36.2k, False: 431k]
  |  Branch (1918:23): [True: 36.2k, False: 0]
  ------------------
 1919|  36.2k|      i--;
 1920|  36.2k|      _src = _dest;
 1921|  36.2k|      if (last_filter_index == i) {
  ------------------
  |  Branch (1921:11): [True: 7.27k, False: 28.9k]
  ------------------
 1922|  7.27k|        break;
 1923|  7.27k|      }
 1924|  28.9k|      continue;
 1925|  36.2k|    }
 1926|   431k|#endif
 1927|   431k|    if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (1927:9): [True: 348k, False: 83.4k]
  ------------------
 1928|   348k|      switch (filters[i]) {
 1929|   185k|        case BLOSC_SHUFFLE:
  ------------------
  |  Branch (1929:9): [True: 185k, False: 162k]
  ------------------
 1930|   185k|          blosc2_unshuffle(shuffle_size(context, i), bsize, _src, _dest);
 1931|   185k|          break;
 1932|  66.6k|        case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (1932:9): [True: 66.6k, False: 281k]
  ------------------
 1933|  66.6k|          if (bitunshuffle(typesize, bsize, _src, _dest, bitshuffle_scratch(thread_context, bsize),
  ------------------
  |  Branch (1933:15): [True: 0, False: 66.6k]
  ------------------
 1934|  66.6k|                           context->src[BLOSC2_CHUNK_VERSION]) < 0) {
 1935|      0|            return BLOSC2_ERROR_FILTER_PIPELINE;
 1936|      0|          }
 1937|  66.6k|          break;
 1938|  96.0k|        case BLOSC_DELTA:
  ------------------
  |  Branch (1938:9): [True: 96.0k, False: 251k]
  ------------------
 1939|  96.0k|          if (_src != _dest) {
  ------------------
  |  Branch (1939:15): [True: 4.67k, False: 91.3k]
  ------------------
 1940|  4.67k|            memcpy(_dest, _src, (size_t)bsize);
 1941|  4.67k|          }
 1942|  96.0k|          if (offset != 0 && !thread_context->serial) {
  ------------------
  |  Branch (1942:15): [True: 45.1k, False: 50.9k]
  |  Branch (1942:30): [True: 0, False: 45.1k]
  ------------------
 1943|      0|            delta_wait_dref(context);
 1944|      0|          }
 1945|  96.0k|          delta_decoder(offset == 0 ? _dest : dest, offset, bsize, typesize, _dest);
  ------------------
  |  Branch (1945:25): [True: 50.9k, False: 45.1k]
  ------------------
 1946|  96.0k|          break;
 1947|      9|        default:
  ------------------
  |  Branch (1947:9): [True: 9, False: 348k]
  ------------------
 1948|      9|          BLOSC_TRACE_ERROR("Filter %d not handled during decompression.", filters[i]);
  ------------------
  |  |   93|      9|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      9|    do {                                            \
  |  |  |  |   98|      9|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      9|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 9, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      9|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1949|      9|          errcode = -1;
 1950|   348k|      }
 1951|   348k|    } else {
 1952|       |        // Look for the filters_meta in user filters and run it
 1953|   306k|        for (uint64_t j = 0; j < g_nfilters; ++j) {
  ------------------
  |  Branch (1953:30): [True: 306k, False: 7]
  ------------------
 1954|   306k|          if (g_filters[j].id == filters[i]) {
  ------------------
  |  Branch (1954:15): [True: 83.3k, False: 222k]
  ------------------
 1955|  83.3k|            if (load_acquire_ptr(&g_filters[j].backward) == NULL) {
  ------------------
  |  |  144|  83.3k|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (1955:17): [True: 0, False: 83.3k]
  ------------------
 1956|       |              // Dynamically load filter
 1957|      0|              if (fill_filter(&g_filters[j]) < 0) {
  ------------------
  |  Branch (1957:19): [True: 0, False: 0]
  ------------------
 1958|      0|                BLOSC_TRACE_ERROR("Could not load filter %d.", g_filters[j].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1959|      0|                return BLOSC2_ERROR_FILTER_PIPELINE;
 1960|      0|              }
 1961|      0|            }
 1962|  83.3k|            if (g_filters[j].backward != NULL) {
  ------------------
  |  Branch (1962:17): [True: 83.3k, False: 0]
  ------------------
 1963|  83.3k|              blosc2_dparams dparams;
 1964|  83.3k|              blosc2_ctx_get_dparams(context, &dparams);
 1965|  83.3k|              rc = g_filters[j].backward(_src, _dest, bsize, filters_meta[i], &dparams, g_filters[j].id);
 1966|  83.3k|            } else {
 1967|      0|              BLOSC_TRACE_ERROR("Backward function is NULL");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1968|      0|              return BLOSC2_ERROR_FILTER_PIPELINE;
 1969|      0|            }
 1970|  83.3k|            if (rc != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1970:17): [True: 5, False: 83.3k]
  ------------------
 1971|      5|              BLOSC_TRACE_ERROR("User-defined filter %d failed during decompression.", filters[i]);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1972|      5|              return rc;
 1973|      5|            }
 1974|  83.3k|            goto urfiltersuccess;
 1975|  83.3k|          }
 1976|   306k|        }
 1977|      7|      BLOSC_TRACE_ERROR("User-defined filter %d not found during decompression.", filters[i]);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1978|      7|      return BLOSC2_ERROR_FILTER_PIPELINE;
 1979|  83.3k|      urfiltersuccess:;
 1980|  83.3k|    }
 1981|       |
 1982|       |    // do_nothing() skipped the filters that leave the block as it is (TRUNC_PREC is not undone);
 1983|       |    // the output of this filter is the input of the next one
 1984|   431k|    _src = _dest;
 1985|   431k|    if (last_filter_index == i) {
  ------------------
  |  Branch (1985:9): [True: 151k, False: 280k]
  ------------------
 1986|   151k|      break;
 1987|   151k|    }
 1988|   431k|  }
 1989|       |
 1990|   158k|  if (context->postfilter == NULL && _src != dest + offset) {
  ------------------
  |  Branch (1990:7): [True: 158k, False: 0]
  |  Branch (1990:38): [True: 21.3k, False: 137k]
  ------------------
 1991|  21.3k|    memcpy(dest + offset, _src, (unsigned int)bsize);
 1992|  21.3k|  }
 1993|       |
 1994|       |  /* Postfilter function */
 1995|   158k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (1995:7): [True: 0, False: 158k]
  ------------------
 1996|       |    // Create new postfilter parameters for this block (must be private for each thread)
 1997|      0|    blosc2_postfilter_params postparams;
 1998|      0|    memcpy(&postparams, context->postparams, sizeof(postparams));
 1999|      0|    postparams.input = _src;
 2000|      0|    postparams.output = dest + offset;
 2001|      0|    postparams.size = bsize;
 2002|      0|    postparams.typesize = typesize;
 2003|      0|    postparams.offset = nblock * context->blocksize;
 2004|      0|    postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (2004:25): [True: 0, False: 0]
  ------------------
 2005|      0|    postparams.nblock = nblock;
 2006|      0|    postparams.tid = thread_context->tid;
 2007|      0|    postparams.ttmp = thread_context->tmp;
 2008|      0|    postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 2009|      0|    postparams.ctx = context;
 2010|       |
 2011|      0|    if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (2011:9): [True: 0, False: 0]
  ------------------
 2012|      0|      BLOSC_TRACE_ERROR("Execution of postfilter function failed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2013|      0|      return BLOSC2_ERROR_POSTFILTER;
 2014|      0|    }
 2015|      0|  }
 2016|       |
 2017|   158k|  return errcode;
 2018|   158k|}
free_thread_context:
 2708|  6.55k|void free_thread_context(struct thread_context* thread_context) {
 2709|  6.55k|  destroy_thread_context(thread_context);
 2710|  6.55k|  my_free(thread_context);
 2711|  6.55k|}
build_filters:
 4287|  38.1k|                   const int32_t typesize, uint8_t* filters) {
 4288|       |
 4289|       |  /* Fill the end part of the filter pipeline */
 4290|  38.1k|  if ((doshuffle == BLOSC_SHUFFLE) && (typesize > 1))
  ------------------
  |  Branch (4290:7): [True: 0, False: 38.1k]
  |  Branch (4290:39): [True: 0, False: 0]
  ------------------
 4291|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
 4292|  38.1k|  if (doshuffle == BLOSC_BITSHUFFLE)
  ------------------
  |  Branch (4292:7): [True: 0, False: 38.1k]
  ------------------
 4293|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
 4294|  38.1k|  if (doshuffle == BLOSC_NOSHUFFLE)
  ------------------
  |  Branch (4294:7): [True: 0, False: 38.1k]
  ------------------
 4295|      0|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_NOSHUFFLE;
 4296|  38.1k|  if (delta)
  ------------------
  |  Branch (4296:7): [True: 0, False: 38.1k]
  ------------------
 4297|      0|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
 4298|  38.1k|}
blosc2_decompress_ctx:
 4548|   108k|                          void* dest, int32_t destsize) {
 4549|   108k|  int result;
 4550|       |
 4551|   108k|  if (context->do_compress != 0) {
  ------------------
  |  Branch (4551:7): [True: 0, False: 108k]
  ------------------
 4552|      0|    BLOSC_TRACE_ERROR("Context is not meant for decompression.  Giving up.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4553|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4554|      0|  }
 4555|       |
 4556|   108k|  result = blosc_run_decompression_with_context(context, src, srcsize, dest, destsize);
 4557|       |
 4558|       |  // Reset a possible block_maskout
 4559|   108k|  ctx_clear_maskout(context);
 4560|       |
 4561|   108k|  return result;
 4562|   108k|}
_blosc_getitem:
 4935|  77.7k|                   int start, int nitems, void* dest, int32_t destsize) {
 4936|  77.7k|  uint8_t* _src = (uint8_t*)(src);  /* current pos for source buffer */
 4937|  77.7k|  uint8_t* _dest = (uint8_t*)(dest);
 4938|  77.7k|  int32_t ntbytes = 0;              /* the number of uncompressed bytes */
 4939|  77.7k|  int32_t bsize, bsize2, leftoverblock;
 4940|  77.7k|  int32_t startb, stopb;
 4941|  77.7k|  int32_t stop;
 4942|  77.7k|  int32_t nitems_bytes;
 4943|  77.7k|  int64_t start64 = (int64_t)start;
 4944|  77.7k|  int64_t nitems64 = (int64_t)nitems;
 4945|  77.7k|  int64_t typesize64 = (int64_t)header->typesize;
 4946|  77.7k|  int64_t stop64;
 4947|  77.7k|  int64_t nitems_bytes64;
 4948|  77.7k|  int64_t start_bytes64;
 4949|  77.7k|  int64_t stop_bytes64;
 4950|  77.7k|  int j, rc;
 4951|       |
 4952|  77.7k|  if (nitems == 0) {
  ------------------
  |  Branch (4952:7): [True: 0, False: 77.7k]
  ------------------
 4953|       |    // We have nothing to do
 4954|      0|    return 0;
 4955|      0|  }
 4956|  77.7k|  if (nitems < 0) {
  ------------------
  |  Branch (4956:7): [True: 0, False: 77.7k]
  ------------------
 4957|      0|    BLOSC_TRACE_ERROR("`nitems` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4958|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4959|      0|  }
 4960|       |
 4961|  77.7k|  nitems_bytes64 = nitems64 * typesize64;
 4962|  77.7k|  if (nitems_bytes64 < 0 || nitems_bytes64 > INT32_MAX || nitems_bytes64 > destsize) {
  ------------------
  |  Branch (4962:7): [True: 0, False: 77.7k]
  |  Branch (4962:29): [True: 0, False: 77.7k]
  |  Branch (4962:59): [True: 17, False: 77.7k]
  ------------------
 4963|     17|    BLOSC_TRACE_ERROR("`nitems`*`typesize` out of dest bounds.");
  ------------------
  |  |   93|     17|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     17|    do {                                            \
  |  |  |  |   98|     17|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     17|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 17, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     17|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4964|     17|    return BLOSC2_ERROR_WRITE_BUFFER;
 4965|     17|  }
 4966|  77.7k|  nitems_bytes = (int32_t)nitems_bytes64;
 4967|       |
 4968|  77.7k|  int32_t* bstarts = (int32_t*)(_src + context->header_overhead);
 4969|       |
 4970|       |  /* Check region boundaries */
 4971|  77.7k|  start_bytes64 = start64 * typesize64;
 4972|  77.7k|  if ((start < 0) || (start_bytes64 < 0) || (start_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4972:7): [True: 0, False: 77.7k]
  |  Branch (4972:22): [True: 0, False: 77.7k]
  |  Branch (4972:45): [True: 0, False: 77.7k]
  ------------------
 4973|      0|    BLOSC_TRACE_ERROR("`start` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4974|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4975|      0|  }
 4976|       |
 4977|  77.7k|  stop64 = start64 + nitems64;
 4978|  77.7k|  if ((stop64 < 0) || (stop64 > INT32_MAX)) {
  ------------------
  |  Branch (4978:7): [True: 0, False: 77.7k]
  |  Branch (4978:23): [True: 0, False: 77.7k]
  ------------------
 4979|      0|    BLOSC_TRACE_ERROR("`start`+`nitems` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4980|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4981|      0|  }
 4982|  77.7k|  stop = (int32_t)stop64;
 4983|       |
 4984|  77.7k|  stop_bytes64 = stop64 * typesize64;
 4985|  77.7k|  if ((stop_bytes64 < 0) || (stop_bytes64 > header->nbytes)) {
  ------------------
  |  Branch (4985:7): [True: 0, False: 77.7k]
  |  Branch (4985:29): [True: 0, False: 77.7k]
  ------------------
 4986|      0|    BLOSC_TRACE_ERROR("`start`+`nitems` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4987|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4988|      0|  }
 4989|       |
 4990|  77.7k|  bool chunk_memcpyed = (header->flags & (uint8_t)BLOSC_MEMCPYED) != 0;
 4991|  77.7k|  if (!context->special_type && !chunk_memcpyed &&
  ------------------
  |  Branch (4991:7): [True: 70.5k, False: 7.18k]
  |  Branch (4991:33): [True: 68.6k, False: 1.89k]
  ------------------
 4992|  68.6k|      ((uint8_t *)(_src + srcsize) < (uint8_t *)(bstarts + context->nblocks))) {
  ------------------
  |  Branch (4992:7): [True: 0, False: 68.6k]
  ------------------
 4993|      0|    BLOSC_TRACE_ERROR("`bstarts` out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4994|      0|    return BLOSC2_ERROR_READ_BUFFER;
 4995|      0|  }
 4996|       |
 4997|  77.7k|  bool memcpyed = header->flags & (uint8_t)BLOSC_MEMCPYED;
 4998|  77.7k|  if (context->special_type) {
  ------------------
  |  Branch (4998:7): [True: 7.18k, False: 70.5k]
  ------------------
 4999|       |    // Fake a runlen as if its a memcpyed chunk
 5000|  7.18k|    memcpyed = true;
 5001|  7.18k|  }
 5002|       |
 5003|  77.7k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (5003:19): [True: 77.5k, False: 167]
  ------------------
 5004|  77.5k|                  (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (5004:19): [True: 2.46k, False: 75.0k]
  |  Branch (5004:54): [True: 0, False: 2.46k]
  ------------------
 5005|  77.7k|  if (memcpyed && !is_lazy && !context->postfilter) {
  ------------------
  |  Branch (5005:7): [True: 9.07k, False: 68.6k]
  |  Branch (5005:19): [True: 9.07k, False: 0]
  |  Branch (5005:31): [True: 9.07k, False: 0]
  ------------------
 5006|       |    // Short-circuit for (non-lazy) memcpyed or special values
 5007|  9.07k|    ntbytes = nitems_bytes;
 5008|  9.07k|    switch (context->special_type) {
 5009|      2|      case BLOSC2_SPECIAL_VALUE: {
  ------------------
  |  Branch (5009:7): [True: 2, False: 9.07k]
  ------------------
 5010|       |        // The repeated value's width is cbytes minus the header, not the header
 5011|       |        // typesize byte (which is left unconstrained for special-value chunks).
 5012|       |        // Derive it the same way blosc_d() does so a crafted typesize cannot make
 5013|       |        // set_values() read past the end of the chunk.
 5014|      2|        int32_t value_typesize = header->cbytes - context->header_overhead;
 5015|      2|        rc = set_values(value_typesize, _src, _dest, ntbytes);
 5016|      2|        if (rc < 0) {
  ------------------
  |  Branch (5016:13): [True: 2, False: 0]
  ------------------
 5017|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5018|      2|          return BLOSC2_ERROR_DATA;
 5019|      2|        }
 5020|      0|        break;
 5021|      2|      }
 5022|      0|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (5022:7): [True: 0, False: 9.07k]
  ------------------
 5023|      0|        rc = set_nans(context->typesize, _dest, ntbytes);
 5024|      0|        if (rc < 0) {
  ------------------
  |  Branch (5024:13): [True: 0, False: 0]
  ------------------
 5025|      0|          BLOSC_TRACE_ERROR("set_nans failed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5026|      0|          return BLOSC2_ERROR_DATA;
 5027|      0|        }
 5028|      0|        break;
 5029|  7.17k|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (5029:7): [True: 7.17k, False: 1.90k]
  ------------------
 5030|  7.17k|        memset(_dest, 0, ntbytes);
 5031|  7.17k|        break;
 5032|      2|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (5032:7): [True: 2, False: 9.07k]
  ------------------
 5033|       |        // We do nothing here
 5034|      2|        break;
 5035|  1.89k|      case BLOSC2_NO_SPECIAL:
  ------------------
  |  Branch (5035:7): [True: 1.89k, False: 7.18k]
  ------------------
 5036|  1.89k|        {
 5037|  1.89k|          int64_t src_offset64 = (int64_t)context->header_overhead + start_bytes64;
 5038|  1.89k|          int64_t src_stop64 = src_offset64 + nitems_bytes64;
 5039|  1.89k|          if ((src_offset64 < 0) || (src_stop64 < src_offset64) || (src_stop64 > srcsize)) {
  ------------------
  |  Branch (5039:15): [True: 0, False: 1.89k]
  |  Branch (5039:37): [True: 0, False: 1.89k]
  |  Branch (5039:68): [True: 0, False: 1.89k]
  ------------------
 5040|      0|            BLOSC_TRACE_ERROR("getitem memcpy source out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5041|      0|            return BLOSC2_ERROR_READ_BUFFER;
 5042|      0|          }
 5043|  1.89k|          _src += (int32_t)src_offset64;
 5044|  1.89k|        }
 5045|      0|        memcpy(_dest, _src, ntbytes);
 5046|  1.89k|        break;
 5047|      0|      default:
  ------------------
  |  Branch (5047:7): [True: 0, False: 9.07k]
  ------------------
 5048|      0|        BLOSC_TRACE_ERROR("Unhandled special value case");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5049|      0|        BLOSC_ERROR(BLOSC2_ERROR_SCHUNK_SPECIAL);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5050|  9.07k|    }
 5051|  9.07k|    return ntbytes;
 5052|  9.07k|  }
 5053|       |
 5054|  68.6k|  if (filters_contain(context->filters, BLOSC_DELTA)) {
  ------------------
  |  Branch (5054:7): [True: 25.5k, False: 43.0k]
  ------------------
 5055|  25.5k|    uint8_t* full_chunk = malloc((size_t)header->nbytes);
 5056|  25.5k|    if (full_chunk == NULL) {
  ------------------
  |  Branch (5056:9): [True: 0, False: 25.5k]
  ------------------
 5057|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 5058|      0|    }
 5059|  25.5k|    int dbytes = blosc2_decompress_ctx(context, src, srcsize, full_chunk, header->nbytes);
 5060|  25.5k|    context->dest = NULL;
 5061|  25.5k|    context->destsize = 0;
 5062|  25.5k|    if (dbytes < 0 || dbytes != header->nbytes) {
  ------------------
  |  Branch (5062:9): [True: 0, False: 25.5k]
  |  Branch (5062:23): [True: 0, False: 25.5k]
  ------------------
 5063|      0|      free(full_chunk);
 5064|      0|      return dbytes < 0 ? dbytes : BLOSC2_ERROR_DATA;
  ------------------
  |  Branch (5064:14): [True: 0, False: 0]
  ------------------
 5065|      0|    }
 5066|  25.5k|    memcpy(dest, full_chunk + start_bytes64, (size_t)nitems_bytes);
 5067|  25.5k|    free(full_chunk);
 5068|  25.5k|    return nitems_bytes;
 5069|  25.5k|  }
 5070|       |
 5071|  43.0k|  struct thread_context* scontext = serial_context_get(context);
 5072|  43.0k|  BLOSC_ERROR_NULL(scontext, BLOSC2_ERROR_THREAD_CREATE);
  ------------------
  |  |  104|  43.0k|    do {                                            \
  |  |  105|  43.0k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 43.0k]
  |  |  ------------------
  |  |  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|  43.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 43.0k]
  |  |  ------------------
  ------------------
 5073|       |
 5074|  86.7k|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (5074:15): [True: 57.0k, False: 29.7k]
  ------------------
 5075|  57.0k|    bsize = header->blocksize;
 5076|  57.0k|    leftoverblock = 0;
 5077|  57.0k|    if ((j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (5077:9): [True: 43.0k, False: 13.9k]
  |  Branch (5077:40): [True: 13.9k, False: 29.1k]
  ------------------
 5078|  13.9k|      bsize = context->leftover;
 5079|  13.9k|      leftoverblock = 1;
 5080|  13.9k|    }
 5081|       |
 5082|       |    /* Compute start & stop for each block */
 5083|  57.0k|    startb = start * header->typesize - j * header->blocksize;
 5084|  57.0k|    stopb = stop * header->typesize - j * header->blocksize;
 5085|  57.0k|    if (stopb <= 0) {
  ------------------
  |  Branch (5085:9): [True: 13.3k, False: 43.6k]
  ------------------
 5086|       |      // We can exit as soon as this block is beyond stop
 5087|  13.3k|      break;
 5088|  13.3k|    }
 5089|  43.6k|    if (startb >= header->blocksize) {
  ------------------
  |  Branch (5089:9): [True: 529, False: 43.1k]
  ------------------
 5090|    529|      continue;
 5091|    529|    }
 5092|  43.1k|    if (startb < 0) {
  ------------------
  |  Branch (5092:9): [True: 34, False: 43.0k]
  ------------------
 5093|     34|      startb = 0;
 5094|     34|    }
 5095|  43.1k|    if (stopb > header->blocksize) {
  ------------------
  |  Branch (5095:9): [True: 34, False: 43.0k]
  ------------------
 5096|     34|      stopb = header->blocksize;
 5097|     34|    }
 5098|  43.1k|    bsize2 = stopb - startb;
 5099|       |
 5100|  43.1k|#if defined(HAVE_ZFP)
 5101|  43.1k|    if (context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) {
  ------------------
  |  Branch (5101:9): [True: 2.09k, False: 41.0k]
  ------------------
 5102|       |      // The items in this block
 5103|  2.09k|      scontext->zfp_cell_start = startb / context->typesize;
 5104|  2.09k|      scontext->zfp_cell_nitems = bsize2 / context->typesize;
 5105|  2.09k|    }
 5106|  43.1k|#endif /* HAVE_ZFP */
 5107|       |
 5108|       |    /* Do the actual data copy */
 5109|       |    // Regular decompression.  Put results in tmp2.
 5110|       |    // If the items are exactly this block, decompress it in destination and avoid a copy
 5111|  43.1k|    bool get_single_block = ((ntbytes == 0) && (startb == 0) && (bsize == nitems_bytes));
  ------------------
  |  Branch (5111:30): [True: 43.0k, False: 34]
  |  Branch (5111:48): [True: 396, False: 42.7k]
  |  Branch (5111:65): [True: 22, False: 374]
  ------------------
 5112|  43.1k|    uint8_t* tmp2 = get_single_block ? dest : scontext->tmp2;
  ------------------
  |  Branch (5112:21): [True: 22, False: 43.1k]
  ------------------
 5113|       |
 5114|       |    // If memcpyed we don't have a bstarts section (because it is not needed)
 5115|  43.1k|    int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (5115:26): [True: 0, False: 43.1k]
  ------------------
 5116|  43.1k|      context->header_overhead + j * header->blocksize : sw32_(bstarts + j);
 5117|       |
 5118|  43.1k|    int32_t cbytes = blosc_d(scontext, bsize, leftoverblock, memcpyed,
 5119|  43.1k|                             src, srcsize, src_offset, j,
 5120|  43.1k|                             tmp2, 0, scontext->tmp, scontext->tmp3);
 5121|  43.1k|    if (cbytes < 0) {
  ------------------
  |  Branch (5121:9): [True: 0, False: 43.1k]
  ------------------
 5122|      0|      ntbytes = cbytes;
 5123|      0|      break;
 5124|      0|    }
 5125|  43.1k|    if (!get_single_block) {
  ------------------
  |  Branch (5125:9): [True: 43.1k, False: 22]
  ------------------
 5126|       |      /* Copy to destination.  When ZFP decoded just the requested items (a single
 5127|       |         cell), they are at the start of tmp2, else the whole block was decoded. */
 5128|  43.1k|      bool zfp_cell = (scontext->zfp_cell_nitems > 0) && (cbytes == bsize2);
  ------------------
  |  Branch (5128:23): [True: 2.09k, False: 41.0k]
  |  Branch (5128:58): [True: 0, False: 2.09k]
  ------------------
 5129|  43.1k|      memcpy((uint8_t *) dest + ntbytes, tmp2 + (zfp_cell ? 0 : startb), (unsigned int) bsize2);
  ------------------
  |  Branch (5129:50): [True: 0, False: 43.1k]
  ------------------
 5130|  43.1k|    }
 5131|  43.1k|    ntbytes += bsize2;
 5132|  43.1k|  }
 5133|       |
 5134|  43.0k|  scontext->zfp_cell_nitems = 0;
 5135|  43.0k|  serial_context_put(scontext);
 5136|       |
 5137|  43.0k|  if (ntbytes >= 0 && ntbytes != nitems_bytes) {
  ------------------
  |  Branch (5137:7): [True: 43.0k, False: 0]
  |  Branch (5137:23): [True: 0, False: 43.0k]
  ------------------
 5138|       |    // A partial decode must not look like a success: callers that only test for
 5139|       |    // a negative return would silently keep hold of an incompletely filled dest.
 5140|      0|    BLOSC_TRACE_ERROR("Only %d bytes out of the %d requested could be decoded.",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5141|      0|                      ntbytes, nitems_bytes);
 5142|      0|    return BLOSC2_ERROR_DATA;
 5143|      0|  }
 5144|       |
 5145|  43.0k|  return ntbytes;
 5146|  43.0k|}
blosc2_getitem:
 5148|  77.7k|int blosc2_getitem(const void* src, int32_t srcsize, int start, int nitems, void* dest, int32_t destsize) {
 5149|  77.7k|  blosc2_context context;
 5150|  77.7k|  int result;
 5151|       |
 5152|       |  /* Minimally populate the context */
 5153|  77.7k|  memset(&context, 0, sizeof(blosc2_context));
 5154|       |
 5155|  77.7k|  context.schunk = g_schunk;
 5156|  77.7k|  context.nthreads = 1;  // force a serial decompression; fixes #95
 5157|       |
 5158|       |  /* Call the actual getitem function */
 5159|  77.7k|  result = blosc2_getitem_ctx(&context, src, srcsize, start, nitems, dest, destsize);
 5160|       |
 5161|       |  /* Release resources */
 5162|  77.7k|  if (context.serial_context != NULL) {
  ------------------
  |  Branch (5162:7): [True: 27, False: 77.6k]
  ------------------
 5163|     27|    free_thread_context(context.serial_context);
 5164|     27|  }
 5165|  77.7k|  return result;
 5166|  77.7k|}
blosc2_getitem_ctx:
 5210|  77.7k|    int start, int nitems, void* dest, int32_t destsize) {
 5211|  77.7k|  blosc_header header;
 5212|  77.7k|  int result = getitem_read_header(src, srcsize, &header);
 5213|  77.7k|  if (result < 0) {
  ------------------
  |  Branch (5213:7): [True: 0, False: 77.7k]
  ------------------
 5214|      0|    return result;
 5215|      0|  }
 5216|       |
 5217|  77.7k|  return getitem_with_header(context, &header, src, srcsize, start, nitems, dest, destsize);
 5218|  77.7k|}
blosc2_get_nthreads:
 6400|  14.0k|{
 6401|  14.0k|  int16_t nthreads;
 6402|  14.0k|  blosc2_init();
 6403|  14.0k|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|  14.0k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 6404|  14.0k|  nthreads = g_nthreads;
 6405|  14.0k|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|  14.0k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 6406|  14.0k|  return nthreads;
 6407|  14.0k|}
blosc2_set_nthreads:
 6409|  7.08k|int16_t blosc2_set_nthreads(int16_t nthreads) {
 6410|  7.08k|  int16_t ret;          /* the previous number of threads */
 6411|       |
 6412|       |  /* Check whether the library should be initialized */
 6413|  7.08k|  blosc2_init();
 6414|       |
 6415|  7.08k|  blosc2_pthread_mutex_lock(&global_comp_mutex);
  ------------------
  |  |   92|  7.08k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
 6416|  7.08k|  ret = g_nthreads;
 6417|  7.08k|  if (nthreads != ret) {
  ------------------
  |  Branch (6417:7): [True: 0, False: 7.08k]
  ------------------
 6418|      0|    int16_t old_new_nthreads = g_global_context->new_nthreads;
 6419|      0|    int16_t old_nthreads = g_global_context->nthreads;
 6420|      0|    g_nthreads = nthreads;
 6421|      0|    g_global_context->new_nthreads = nthreads;
 6422|      0|    int16_t ret2 = check_nthreads(g_global_context, true);
 6423|      0|    if (ret2 < 0) {
  ------------------
  |  Branch (6423:9): [True: 0, False: 0]
  ------------------
 6424|      0|      g_nthreads = ret;
 6425|      0|      g_global_context->new_nthreads = old_new_nthreads;
 6426|      0|      g_global_context->nthreads = old_nthreads;
 6427|      0|      check_nthreads(g_global_context, true);
 6428|      0|      blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|      0|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 6429|      0|      return ret2;
 6430|      0|    }
 6431|      0|  }
 6432|  7.08k|  blosc2_pthread_mutex_unlock(&global_comp_mutex);
  ------------------
  |  |   93|  7.08k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
 6433|       |
 6434|  7.08k|  return ret;
 6435|  7.08k|}
blosc2_cbuffer_sizes:
 6552|  49.9M|int blosc2_cbuffer_sizes(const void* cbuffer, int32_t* nbytes, int32_t* cbytes, int32_t* blocksize) {
 6553|  49.9M|  blosc_header header;
 6554|  49.9M|  int rc = read_chunk_header((uint8_t *) cbuffer, BLOSC_MIN_HEADER_LENGTH, false, &header);
 6555|  49.9M|  if (rc < 0) {
  ------------------
  |  Branch (6555:7): [True: 48, False: 49.9M]
  ------------------
 6556|       |    /* Return zeros if error reading header */
 6557|     48|    memset(&header, 0, sizeof(header));
 6558|     48|  }
 6559|       |
 6560|       |  /* Read the interesting values */
 6561|  49.9M|  if (nbytes != NULL)
  ------------------
  |  Branch (6561:7): [True: 49.9M, False: 46.3k]
  ------------------
 6562|  49.9M|    *nbytes = header.nbytes;
 6563|  49.9M|  if (cbytes != NULL)
  ------------------
  |  Branch (6563:7): [True: 49.9M, False: 0]
  ------------------
 6564|  49.9M|    *cbytes = header.cbytes;
 6565|  49.9M|  if (blocksize != NULL)
  ------------------
  |  Branch (6565:7): [True: 130k, False: 49.8M]
  ------------------
 6566|   130k|    *blocksize = header.blocksize;
 6567|  49.9M|  return rc;
 6568|  49.9M|}
blosc2_init:
 6758|  28.1k|void blosc2_init(void) {
 6759|       |  /* Return if Blosc is already initialized */
 6760|  28.1k|  if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  142|  28.1k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  104|  28.1k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (6760:7): [True: 21.0k, False: 7.08k]
  ------------------
 6761|       |
 6762|  7.08k|#if !defined(_WIN32)
 6763|       |  /* Before g_init_lock is taken: from now on a fork() waits for it */
 6764|  7.08k|  pthread_once(&atfork_once, register_atfork);
 6765|  7.08k|#endif
 6766|  7.08k|  static_lock(&g_init_lock);
  ------------------
  |  |  132|  7.08k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6767|       |  /* Teardown drops this lock while joining prefetch workers.  Wait without
 6768|       |     holding it so the destroyer can finish; never reinitialize live globals. */
 6769|  7.08k|  while (g_initlib == BLOSC_STATE_TEARDOWN) {
  ------------------
  |  |  105|  7.08k|#define BLOSC_STATE_TEARDOWN      2
  ------------------
  |  Branch (6769:10): [True: 0, False: 7.08k]
  ------------------
 6770|       |#if defined(_WIN32)
 6771|       |    SleepConditionVariableSRW(&g_init_cv, &g_init_lock, INFINITE, 0);
 6772|       |#else
 6773|      0|    pthread_cond_wait(&g_init_cv, &g_init_lock);
 6774|      0|#endif
 6775|      0|  }
 6776|       |  /* Unless another thread initialized it meanwhile */
 6777|  7.08k|  if (g_initlib != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  104|  7.08k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (6777:7): [True: 7.08k, False: 0]
  ------------------
 6778|  7.08k|    blosc2_init_locked();
 6779|  7.08k|  }
 6780|  7.08k|  static_unlock(&g_init_lock);
  ------------------
  |  |  133|  7.08k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6781|  7.08k|}
blosc2_tmp_free:
 6970|  30.6k|void blosc2_tmp_free(void *ptr, size_t capacity) {
 6971|  30.6k|  if (ptr == NULL) {
  ------------------
  |  Branch (6971:7): [True: 0, False: 30.6k]
  ------------------
 6972|      0|    return;
 6973|      0|  }
 6974|  30.6k|#if !defined(_WIN32)
 6975|  30.6k|  tmp_cache_t *cache = NULL;
 6976|  30.6k|  if (capacity >= BLOSC2_TMP_CACHE_MIN && capacity <= BLOSC2_TMP_CACHE_MAX / 2) {
  ------------------
  |  | 6812|  61.2k|#define BLOSC2_TMP_CACHE_MIN (64 * 1024)
  ------------------
                if (capacity >= BLOSC2_TMP_CACHE_MIN && capacity <= BLOSC2_TMP_CACHE_MAX / 2) {
  ------------------
  |  | 6813|      0|#define BLOSC2_TMP_CACHE_MAX (64 * 1024 * 1024)
  ------------------
  |  Branch (6976:7): [True: 0, False: 30.6k]
  |  Branch (6976:43): [True: 0, False: 0]
  ------------------
 6977|      0|    cache = tmp_cache_get(true);
 6978|      0|  }
 6979|  30.6k|  if (cache != NULL) {
  ------------------
  |  Branch (6979:7): [True: 0, False: 30.6k]
  ------------------
 6980|       |    // Make room by dropping the smallest buffers (each one smaller than this)
 6981|      0|    for (;;) {
 6982|      0|      size_t total = capacity;
 6983|      0|      int empty = -1;
 6984|      0|      int smallest = -1;
 6985|      0|      for (int i = 0; i < BLOSC2_TMP_CACHE_SLOTS; ++i) {
  ------------------
  |  | 6811|      0|#define BLOSC2_TMP_CACHE_SLOTS 4
  ------------------
  |  Branch (6985:23): [True: 0, False: 0]
  ------------------
 6986|      0|        if (cache->ptr[i] == NULL) {
  ------------------
  |  Branch (6986:13): [True: 0, False: 0]
  ------------------
 6987|      0|          empty = i;
 6988|      0|          continue;
 6989|      0|        }
 6990|      0|        total += cache->size[i];
 6991|      0|        if (smallest < 0 || cache->size[i] < cache->size[smallest]) {
  ------------------
  |  Branch (6991:13): [True: 0, False: 0]
  |  Branch (6991:29): [True: 0, False: 0]
  ------------------
 6992|      0|          smallest = i;
 6993|      0|        }
 6994|      0|      }
 6995|      0|      if (empty >= 0 && total <= BLOSC2_TMP_CACHE_MAX) {
  ------------------
  |  | 6813|      0|#define BLOSC2_TMP_CACHE_MAX (64 * 1024 * 1024)
  ------------------
  |  Branch (6995:11): [True: 0, False: 0]
  |  Branch (6995:25): [True: 0, False: 0]
  ------------------
 6996|      0|        cache->ptr[empty] = ptr;
 6997|      0|        cache->size[empty] = capacity;
 6998|      0|        return;
 6999|      0|      }
 7000|      0|      if (smallest < 0 || cache->size[smallest] >= capacity) {
  ------------------
  |  Branch (7000:11): [True: 0, False: 0]
  |  Branch (7000:27): [True: 0, False: 0]
  ------------------
 7001|      0|        break;
 7002|      0|      }
 7003|      0|      free(cache->ptr[smallest]);
 7004|      0|      cache->ptr[smallest] = NULL;
 7005|      0|      cache->size[smallest] = 0;
 7006|      0|    }
 7007|      0|  }
 7008|       |#else
 7009|       |  BLOSC_UNUSED_PARAM(capacity);
 7010|       |#endif
 7011|  30.6k|  free(ptr);
 7012|  30.6k|}
blosc2_tmp_cache_clear:
 7014|  14.1k|void blosc2_tmp_cache_clear(void) {
 7015|  14.1k|#if !defined(_WIN32)
 7016|  14.1k|  tmp_cache_t *cache = tmp_cache_get(false);
 7017|  14.1k|  if (cache != NULL) {
  ------------------
  |  Branch (7017:7): [True: 14.1k, False: 0]
  ------------------
 7018|  70.8k|    for (int i = 0; i < BLOSC2_TMP_CACHE_SLOTS; ++i) {
  ------------------
  |  | 6811|  70.8k|#define BLOSC2_TMP_CACHE_SLOTS 4
  ------------------
  |  Branch (7018:21): [True: 56.6k, False: 14.1k]
  ------------------
 7019|  56.6k|      free(cache->ptr[i]);
 7020|  56.6k|      cache->ptr[i] = NULL;
 7021|  56.6k|      cache->size[i] = 0;
 7022|  56.6k|    }
 7023|  14.1k|    if (cache->serial != NULL && !cache->serial_busy) {
  ------------------
  |  Branch (7023:9): [True: 5.69k, False: 8.47k]
  |  Branch (7023:34): [True: 5.69k, False: 0]
  ------------------
 7024|  5.69k|      free_thread_context(cache->serial);
 7025|       |      cache->serial = NULL;
 7026|  5.69k|    }
 7027|  14.1k|  }
 7028|  14.1k|#endif
 7029|  14.1k|}
blosc2_destroy:
 7067|  7.08k|void blosc2_destroy(void) {
 7068|       |  /* Return if Blosc is not initialized */
 7069|  7.08k|  if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  142|  7.08k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) return;
  ------------------
  |  |  104|  7.08k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7069:7): [True: 0, False: 7.08k]
  ------------------
 7070|       |
 7071|  7.08k|  static_lock(&g_init_lock);
  ------------------
  |  |  132|  7.08k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 7072|  7.08k|  if (g_initlib != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  104|  7.08k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7072:7): [True: 0, False: 7.08k]
  ------------------
 7073|      0|    static_unlock(&g_init_lock);
  ------------------
  |  |  133|      0|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 7074|      0|    return;
 7075|      0|  }
 7076|  7.08k|  store_release_int(&g_initlib, BLOSC_STATE_TEARDOWN);
  ------------------
  |  |  143|  7.08k|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 7077|  7.08k|  static_unlock(&g_init_lock);
  ------------------
  |  |  133|  7.08k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 7078|       |
 7079|       |  /* Not under g_init_lock: a fork() holds the read-ahead pool's lock while it
 7080|       |     waits for g_init_lock (prefetch.c registers its fork handlers later).
 7081|       |     New prefetch operations and threads are blocked by blosc2_is_initialized(). */
 7082|  7.08k|  prefetch_destroy();
 7083|       |
 7084|  7.08k|  static_lock(&g_init_lock);
  ------------------
  |  |  132|  7.08k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 7085|  7.08k|  blosc2_destroy_locked();
 7086|  7.08k|  store_release_int(&g_initlib, BLOSC_STATE_UNINITIALIZED);
  ------------------
  |  |  143|  7.08k|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 7087|       |#if defined(_WIN32)
 7088|       |  WakeAllConditionVariable(&g_init_cv);
 7089|       |#else
 7090|  7.08k|  pthread_cond_broadcast(&g_init_cv);
 7091|  7.08k|#endif
 7092|  7.08k|  static_unlock(&g_init_lock);
  ------------------
  |  |  133|  7.08k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 7093|  7.08k|}
blosc2_create_cctx:
 7099|  38.1k|blosc2_context* blosc2_create_cctx(blosc2_cparams cparams) {
 7100|  38.1k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 7101|  38.1k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  38.1k|    do {                                            \
  |  |  105|  38.1k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 38.1k]
  |  |  ------------------
  |  |  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|  38.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 38.1k]
  |  |  ------------------
  ------------------
 7102|       |
 7103|       |  /* Populate the context, using zeros as default values */
 7104|  38.1k|  memset(context, 0, sizeof(blosc2_context));
 7105|       |  /* Early, so that the cleanup at `failed` can always destroy it */
 7106|  38.1k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  38.1k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 7107|  38.1k|  context->do_compress = 1;   /* meant for compression */
 7108|  38.1k|  context->use_dict = cparams.use_dict;
 7109|  38.1k|  if (cparams.instr_codec) {
  ------------------
  |  Branch (7109:7): [True: 0, False: 38.1k]
  ------------------
 7110|      0|    context->blosc2_flags = BLOSC2_INSTR_CODEC;
 7111|      0|  }
 7112|       |
 7113|   267k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (7113:19): [True: 228k, False: 38.1k]
  ------------------
 7114|   228k|    context->filters[i] = cparams.filters[i];
 7115|   228k|    context->filters_meta[i] = cparams.filters_meta[i];
 7116|       |
 7117|   228k|    if (context->filters[i] >= BLOSC_LAST_FILTER && context->filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
  ------------------
  |  Branch (7117:9): [True: 4.08k, False: 224k]
  |  Branch (7117:53): [True: 1, False: 4.08k]
  ------------------
 7118|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7119|      1|                        context->filters[i]);
 7120|      1|      goto failed;
 7121|      1|    }
 7122|   228k|    if (context->filters[i] > BLOSC_LAST_REGISTERED_FILTER && context->filters[i] <= BLOSC2_GLOBAL_REGISTERED_FILTERS_STOP) {
  ------------------
  |  Branch (7122:9): [True: 3.41k, False: 225k]
  |  Branch (7122:63): [True: 4, False: 3.41k]
  ------------------
 7123|      4|      BLOSC_TRACE_ERROR("filter (%d) is not yet defined",
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7124|      4|                        context->filters[i]);
 7125|      4|      goto failed;
 7126|      4|    }
 7127|   228k|  }
 7128|       |
 7129|  38.1k|#if defined(HAVE_ZFP)
 7130|  38.1k|#include "blosc2/codecs-registry.h"
 7131|  38.1k|  if ((context->compcode >= BLOSC_CODEC_ZFP_FIXED_ACCURACY) && (context->compcode <= BLOSC_CODEC_ZFP_FIXED_RATE)) {
  ------------------
  |  Branch (7131:7): [True: 0, False: 38.1k]
  |  Branch (7131:64): [True: 0, False: 0]
  ------------------
 7132|      0|    for (int i = 0; i < BLOSC2_MAX_FILTERS; ++i) {
  ------------------
  |  Branch (7132:21): [True: 0, False: 0]
  ------------------
 7133|      0|      if ((context->filters[i] == BLOSC_SHUFFLE) || (context->filters[i] == BLOSC_BITSHUFFLE)) {
  ------------------
  |  Branch (7133:11): [True: 0, False: 0]
  |  Branch (7133:53): [True: 0, False: 0]
  ------------------
 7134|      0|        BLOSC_TRACE_ERROR("ZFP cannot be run in presence of SHUFFLE / BITSHUFFLE");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7135|      0|        goto failed;
 7136|      0|      }
 7137|      0|    }
 7138|      0|  }
 7139|  38.1k|#endif /* HAVE_ZFP */
 7140|       |
 7141|       |  /* Check for a BLOSC_SHUFFLE environment variable */
 7142|  38.1k|  int doshuffle = -1;
 7143|  38.1k|  char* envvar = getenv("BLOSC_SHUFFLE");
 7144|  38.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (7144:7): [True: 0, False: 38.1k]
  ------------------
 7145|      0|    if (strcmp(envvar, "NOSHUFFLE") == 0) {
  ------------------
  |  Branch (7145:9): [True: 0, False: 0]
  ------------------
 7146|      0|      doshuffle = BLOSC_NOSHUFFLE;
 7147|      0|    }
 7148|      0|    else if (strcmp(envvar, "SHUFFLE") == 0) {
  ------------------
  |  Branch (7148:14): [True: 0, False: 0]
  ------------------
 7149|      0|      doshuffle = BLOSC_SHUFFLE;
 7150|      0|    }
 7151|      0|    else if (strcmp(envvar, "BITSHUFFLE") == 0) {
  ------------------
  |  Branch (7151:14): [True: 0, False: 0]
  ------------------
 7152|      0|      doshuffle = BLOSC_BITSHUFFLE;
 7153|      0|    }
 7154|      0|    else {
 7155|      0|      BLOSC_TRACE_WARNING("BLOSC_SHUFFLE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7156|      0|    }
 7157|      0|  }
 7158|       |  /* Check for a BLOSC_DELTA environment variable */
 7159|  38.1k|  int dodelta = BLOSC_NOFILTER;
 7160|  38.1k|  envvar = getenv("BLOSC_DELTA");
 7161|  38.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (7161:7): [True: 0, False: 38.1k]
  ------------------
 7162|      0|    if (strcmp(envvar, "1") == 0) {
  ------------------
  |  Branch (7162:9): [True: 0, False: 0]
  ------------------
 7163|      0|      dodelta = BLOSC_DELTA;
 7164|      0|    } else if (strcmp(envvar, "0") == 0){
  ------------------
  |  Branch (7164:16): [True: 0, False: 0]
  ------------------
 7165|      0|      dodelta = BLOSC_NOFILTER;
 7166|      0|    }
 7167|      0|    else {
 7168|      0|      BLOSC_TRACE_WARNING("BLOSC_DELTA environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7169|      0|    }
 7170|      0|  }
 7171|       |  /* Check for a BLOSC_TYPESIZE environment variable */
 7172|  38.1k|  context->typesize = cparams.typesize;
 7173|  38.1k|  envvar = getenv("BLOSC_TYPESIZE");
 7174|  38.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (7174:7): [True: 0, False: 38.1k]
  ------------------
 7175|      0|    int32_t value;
 7176|      0|    errno = 0; /* To distinguish success/failure after call */
 7177|      0|    value = (int32_t) strtol(envvar, NULL, 10);
 7178|      0|    if ((errno != EINVAL) && (value > 0)) {
  ------------------
  |  Branch (7178:9): [True: 0, False: 0]
  |  Branch (7178:30): [True: 0, False: 0]
  ------------------
 7179|      0|      context->typesize = value;
 7180|      0|    }
 7181|      0|    else {
 7182|      0|      BLOSC_TRACE_WARNING("BLOSC_TYPESIZE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7183|      0|    }
 7184|      0|  }
 7185|  38.1k|  build_filters(doshuffle, dodelta, context->typesize, context->filters);
 7186|       |
 7187|  38.1k|  context->clevel = cparams.clevel;
 7188|       |  /* Check for a BLOSC_CLEVEL environment variable */
 7189|  38.1k|  envvar = getenv("BLOSC_CLEVEL");
 7190|  38.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (7190:7): [True: 0, False: 38.1k]
  ------------------
 7191|      0|    int value;
 7192|      0|    errno = 0; /* To distinguish success/failure after call */
 7193|      0|    value = (int)strtol(envvar, NULL, 10);
 7194|      0|    if ((errno != EINVAL) && (value >= 0)) {
  ------------------
  |  Branch (7194:9): [True: 0, False: 0]
  |  Branch (7194:30): [True: 0, False: 0]
  ------------------
 7195|      0|      context->clevel = value;
 7196|      0|    }
 7197|      0|    else {
 7198|      0|      BLOSC_TRACE_WARNING("BLOSC_CLEVEL environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7199|      0|    }
 7200|      0|  }
 7201|       |
 7202|  38.1k|  context->compcode = cparams.compcode;
 7203|       |  /* Check for a BLOSC_COMPRESSOR environment variable */
 7204|  38.1k|  envvar = getenv("BLOSC_COMPRESSOR");
 7205|  38.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (7205:7): [True: 0, False: 38.1k]
  ------------------
 7206|      0|    int codec = blosc2_compname_to_compcode(envvar);
 7207|      0|    if (codec >= BLOSC_LAST_CODEC) {
  ------------------
  |  Branch (7207:9): [True: 0, False: 0]
  ------------------
 7208|      0|      BLOSC_TRACE_ERROR("User defined codecs cannot be set here. Use Blosc2 mechanism instead.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7209|      0|      goto failed;
 7210|      0|    }
 7211|      0|    context->compcode = codec;
 7212|      0|  }
 7213|  38.1k|  context->compcode_meta = cparams.compcode_meta;
 7214|       |
 7215|  38.1k|  context->blocksize = cparams.blocksize;
 7216|       |  /* Check for a BLOSC_BLOCKSIZE environment variable */
 7217|  38.1k|  envvar = getenv("BLOSC_BLOCKSIZE");
 7218|  38.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (7218:7): [True: 0, False: 38.1k]
  ------------------
 7219|      0|    int32_t blocksize;
 7220|      0|    errno = 0; /* To distinguish success/failure after call */
 7221|      0|    blocksize = (int32_t) strtol(envvar, NULL, 10);
 7222|      0|    if ((errno != EINVAL) && (blocksize > 0)) {
  ------------------
  |  Branch (7222:9): [True: 0, False: 0]
  |  Branch (7222:30): [True: 0, False: 0]
  ------------------
 7223|      0|      context->blocksize = blocksize;
 7224|      0|    }
 7225|      0|    else {
 7226|      0|      BLOSC_TRACE_WARNING("BLOSC_BLOCKSIZE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7227|      0|    }
 7228|      0|  }
 7229|       |
 7230|  38.1k|  context->nthreads = cparams.nthreads;
 7231|       |  /* Check for a BLOSC_NTHREADS environment variable */
 7232|  38.1k|  envvar = getenv("BLOSC_NTHREADS");
 7233|  38.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (7233:7): [True: 0, False: 38.1k]
  ------------------
 7234|      0|    errno = 0; /* To distinguish success/failure after call */
 7235|      0|    int16_t nthreads = (int16_t) strtol(envvar, NULL, 10);
 7236|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (7236:9): [True: 0, False: 0]
  |  Branch (7236:30): [True: 0, False: 0]
  ------------------
 7237|      0|      context->nthreads = nthreads;
 7238|      0|    }
 7239|      0|    else {
 7240|      0|      BLOSC_TRACE_WARNING("BLOSC_NTHREADS environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7241|      0|    }
 7242|      0|  }
 7243|  38.1k|  context->new_nthreads = context->nthreads;
 7244|       |
 7245|  38.1k|  context->splitmode = cparams.splitmode;
 7246|       |  /* Check for a BLOSC_SPLITMODE environment variable */
 7247|  38.1k|  envvar = getenv("BLOSC_SPLITMODE");
 7248|  38.1k|  if (envvar != NULL) {
  ------------------
  |  Branch (7248:7): [True: 0, False: 38.1k]
  ------------------
 7249|      0|    int32_t splitmode = -1;
 7250|      0|    if (strcmp(envvar, "ALWAYS") == 0) {
  ------------------
  |  Branch (7250:9): [True: 0, False: 0]
  ------------------
 7251|      0|      splitmode = BLOSC_ALWAYS_SPLIT;
 7252|      0|    }
 7253|      0|    else if (strcmp(envvar, "NEVER") == 0) {
  ------------------
  |  Branch (7253:14): [True: 0, False: 0]
  ------------------
 7254|      0|      splitmode = BLOSC_NEVER_SPLIT;
 7255|      0|    }
 7256|      0|    else if (strcmp(envvar, "AUTO") == 0) {
  ------------------
  |  Branch (7256:14): [True: 0, False: 0]
  ------------------
 7257|      0|      splitmode = BLOSC_AUTO_SPLIT;
 7258|      0|    }
 7259|      0|    else if (strcmp(envvar, "FORWARD_COMPAT") == 0) {
  ------------------
  |  Branch (7259:14): [True: 0, False: 0]
  ------------------
 7260|      0|      splitmode = BLOSC_FORWARD_COMPAT_SPLIT;
 7261|      0|    }
 7262|      0|    else {
 7263|      0|      BLOSC_TRACE_WARNING("BLOSC_SPLITMODE environment variable '%s' not recognized\n", envvar);
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7264|      0|    }
 7265|      0|    if (splitmode >= 0) {
  ------------------
  |  Branch (7265:9): [True: 0, False: 0]
  ------------------
 7266|      0|      context->splitmode = splitmode;
 7267|      0|    }
 7268|      0|  }
 7269|       |
 7270|  38.1k|  context->threads_started = 0;
 7271|  38.1k|  context->schunk = cparams.schunk;
 7272|       |
 7273|  38.1k|  if (cparams.prefilter != NULL) {
  ------------------
  |  Branch (7273:7): [True: 0, False: 38.1k]
  ------------------
 7274|      0|    context->prefilter = cparams.prefilter;
 7275|      0|    context->preparams = (blosc2_prefilter_params*)my_malloc(sizeof(blosc2_prefilter_params));
 7276|      0|    if (context->preparams == NULL) {
  ------------------
  |  Branch (7276:9): [True: 0, False: 0]
  ------------------
 7277|      0|      goto failed;
 7278|      0|    }
 7279|      0|    memcpy(context->preparams, cparams.preparams, sizeof(blosc2_prefilter_params));
 7280|      0|  }
 7281|       |
 7282|  38.1k|  if (cparams.tuner_id <= 0) {
  ------------------
  |  Branch (7282:7): [True: 38.1k, False: 0]
  ------------------
 7283|  38.1k|    cparams.tuner_id = g_tuner;
 7284|  38.1k|  } else {
 7285|      0|    for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (7285:21): [True: 0, False: 0]
  ------------------
 7286|      0|      if (g_tuners[i].id == cparams.tuner_id) {
  ------------------
  |  Branch (7286:11): [True: 0, False: 0]
  ------------------
 7287|      0|        if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (7287:13): [True: 0, False: 0]
  ------------------
 7288|      0|          if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (7288:15): [True: 0, False: 0]
  ------------------
 7289|      0|            BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7290|      0|            goto failed;
 7291|      0|          }
 7292|      0|        }
 7293|      0|        if (g_tuners[i].init(cparams.tuner_params, context, NULL) < 0) {
  ------------------
  |  Branch (7293:13): [True: 0, False: 0]
  ------------------
 7294|      0|          BLOSC_TRACE_ERROR("Error in user-defined tuner %d init function\n", cparams.tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7295|      0|          goto failed;
 7296|      0|        }
 7297|      0|        goto urtunersuccess;
 7298|      0|      }
 7299|      0|    }
 7300|      0|    BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", cparams.tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7301|      0|    goto failed;
 7302|      0|  }
 7303|  38.1k|  urtunersuccess:;
 7304|       |
 7305|  38.1k|  context->tuner_id = cparams.tuner_id;
 7306|       |
 7307|  38.1k|  context->codec_params = cparams.codec_params;
 7308|  38.1k|  memcpy(context->filter_params, cparams.filter_params, BLOSC2_MAX_FILTERS * sizeof(void*));
 7309|       |
 7310|  38.1k|  return context;
 7311|       |
 7312|      5|failed:
 7313|      5|  my_free(context->preparams);
 7314|      5|  blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|      5|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7315|      5|  my_free(context);
 7316|       |  return NULL;
 7317|  38.1k|}
blosc2_create_dctx:
 7320|  13.9k|blosc2_context* blosc2_create_dctx(blosc2_dparams dparams) {
 7321|  13.9k|  blosc2_context* context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 7322|  13.9k|  BLOSC_ERROR_NULL(context, NULL);
  ------------------
  |  |  104|  13.9k|    do {                                            \
  |  |  105|  13.9k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 13.9k]
  |  |  ------------------
  |  |  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|  13.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 13.9k]
  |  |  ------------------
  ------------------
 7323|       |
 7324|       |  /* Populate the context, using zeros as default values */
 7325|  13.9k|  memset(context, 0, sizeof(blosc2_context));
 7326|  13.9k|  context->do_compress = 0;   /* Meant for decompression */
 7327|       |
 7328|  13.9k|  context->nthreads = dparams.nthreads;
 7329|  13.9k|  char* envvar = getenv("BLOSC_NTHREADS");
 7330|  13.9k|  if (envvar != NULL) {
  ------------------
  |  Branch (7330:7): [True: 0, False: 13.9k]
  ------------------
 7331|      0|    errno = 0; /* To distinguish success/failure after call */
 7332|      0|    long nthreads = strtol(envvar, NULL, 10);
 7333|      0|    if ((errno != EINVAL) && (nthreads > 0)) {
  ------------------
  |  Branch (7333:9): [True: 0, False: 0]
  |  Branch (7333:30): [True: 0, False: 0]
  ------------------
 7334|      0|      context->nthreads = (int16_t) nthreads;
 7335|      0|    }
 7336|      0|  }
 7337|  13.9k|  context->new_nthreads = context->nthreads;
 7338|       |
 7339|  13.9k|  context->threads_started = 0;
 7340|  13.9k|  context->block_maskout = NULL;
 7341|  13.9k|  context->block_maskout_nitems = 0;
 7342|  13.9k|  blosc2_pthread_mutex_init(&context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  13.9k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 7343|  13.9k|  context->schunk = dparams.schunk;
 7344|       |
 7345|  13.9k|  if (dparams.postfilter != NULL) {
  ------------------
  |  Branch (7345:7): [True: 0, False: 13.9k]
  ------------------
 7346|      0|    context->postfilter = dparams.postfilter;
 7347|      0|    context->postparams = (blosc2_postfilter_params*)my_malloc(sizeof(blosc2_postfilter_params));
 7348|      0|    if (context->postparams == NULL) {
  ------------------
  |  Branch (7348:9): [True: 0, False: 0]
  ------------------
 7349|      0|      blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7350|      0|      my_free(context);
 7351|      0|      return NULL;
 7352|      0|    }
 7353|      0|    memcpy(context->postparams, dparams.postparams, sizeof(blosc2_postfilter_params));
 7354|      0|  }
 7355|       |
 7356|  13.9k|  return context;
 7357|  13.9k|}
blosc2_free_ctx:
 7360|  59.1k|void blosc2_free_ctx(blosc2_context* context) {
 7361|  59.1k|  if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED ||
  ------------------
  |  |  142|  59.1k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) == BLOSC_STATE_INITIALIZED ||
  ------------------
  |  |  104|   118k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7361:7): [True: 52.0k, False: 7.08k]
  ------------------
 7362|  7.08k|      context->thread_backend == BLOSC_BACKEND_PER_CONTEXT ||
  ------------------
  |  |   36|  66.2k|#define BLOSC_BACKEND_PER_CONTEXT 3   /* per-context threads; used on Windows */
  ------------------
  |  Branch (7362:7): [True: 0, False: 7.08k]
  ------------------
 7363|  52.0k|      context->thread_backend == BLOSC_BACKEND_CALLBACK) {
  ------------------
  |  |   35|  7.08k|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (7363:7): [True: 0, False: 7.08k]
  ------------------
 7364|  52.0k|    release_thread_backend(context);
 7365|  52.0k|  }
 7366|  59.1k|  if (context->serial_context != NULL) {
  ------------------
  |  Branch (7366:7): [True: 812, False: 58.3k]
  ------------------
 7367|    812|    free_thread_context(context->serial_context);
 7368|    812|  }
 7369|  59.1k|  blosc2_pthread_mutex_destroy(&context->nchunk_mutex);
  ------------------
  |  |   91|  59.1k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7370|  59.1k|  release_context_dict_buffer(context);
 7371|  59.1k|  if (context->dict_cdict != NULL) {
  ------------------
  |  Branch (7371:7): [True: 0, False: 59.1k]
  ------------------
 7372|      0|    if (context->compcode == BLOSC_LZ4) {
  ------------------
  |  Branch (7372:9): [True: 0, False: 0]
  ------------------
 7373|      0|      LZ4_freeStream((LZ4_stream_t*)context->dict_cdict);
 7374|      0|    } else if (context->compcode == BLOSC_LZ4HC) {
  ------------------
  |  Branch (7374:16): [True: 0, False: 0]
  ------------------
 7375|      0|      LZ4_freeStreamHC((LZ4_streamHC_t*)context->dict_cdict);
 7376|      0|    }
 7377|      0|#ifdef HAVE_ZSTD
 7378|      0|    else if (context->compcode == BLOSC_ZSTD) {
  ------------------
  |  Branch (7378:14): [True: 0, False: 0]
  ------------------
 7379|      0|      ZSTD_freeCDict(context->dict_cdict);
 7380|      0|    }
 7381|      0|#endif
 7382|      0|  }
 7383|  59.1k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (7383:7): [True: 1.22k, False: 57.9k]
  ------------------
 7384|  1.22k|#ifdef HAVE_ZSTD
 7385|  1.22k|    ZSTD_freeDDict(context->dict_ddict);
 7386|  1.22k|#endif
 7387|  1.22k|  }
 7388|  59.1k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (7388:7): [True: 0, False: 59.1k]
  ------------------
 7389|      0|    int rc;
 7390|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (7390:9): [True: 0, False: 0]
  |  Branch (7390:49): [True: 0, False: 0]
  ------------------
 7391|      0|      rc = blosc_stune_free(context);
 7392|      0|    } else {
 7393|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (7393:23): [True: 0, False: 0]
  ------------------
 7394|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (7394:13): [True: 0, False: 0]
  ------------------
 7395|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (7395:15): [True: 0, False: 0]
  ------------------
 7396|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (7396:17): [True: 0, False: 0]
  ------------------
 7397|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7398|      0|              return;
 7399|      0|            }
 7400|      0|          }
 7401|      0|          rc = g_tuners[i].free(context);
 7402|      0|          goto urtunersuccess;
 7403|      0|        }
 7404|      0|      }
 7405|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7406|      0|      return;
 7407|      0|      urtunersuccess:;
 7408|      0|    }
 7409|      0|    if (rc < 0) {
  ------------------
  |  Branch (7409:9): [True: 0, False: 0]
  ------------------
 7410|      0|      BLOSC_TRACE_ERROR("Error in user-defined tuner free function\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7411|      0|      return;
 7412|      0|    }
 7413|      0|  }
 7414|       |  /* May be needed if codec_params ever contains nested objects
 7415|       |  if (context->codec_params != NULL) {
 7416|       |    int rc;
 7417|       |    for (int i = 0; i < g_ncodecs; ++i) {
 7418|       |      if (g_codecs[i].compcode == context->compcode) {
 7419|       |        if (g_codecs[i].free == NULL) {
 7420|       |          // Dynamically load codec plugin
 7421|       |          if (fill_codec(&g_codecs[i]) < 0) {
 7422|       |            BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
 7423|       |            return BLOSC2_ERROR_CODEC_SUPPORT;
 7424|       |          }
 7425|       |        }
 7426|       |        if (g_codecs[i].free == NULL){
 7427|       |          // no free func, codec_params is simple
 7428|       |          my_free(context->codec_params);
 7429|       |        }
 7430|       |        else{ // has free function for codec_params (e.g. openzl)
 7431|       |        rc = g_codecs[i].free(context->codec_params);
 7432|       |          goto urcodecsuccess;
 7433|       |        }
 7434|       |      }
 7435|       |    }
 7436|       |      BLOSC_TRACE_ERROR("User-defined compressor codec %d not found", context->compcode);
 7437|       |      return BLOSC2_ERROR_CODEC_SUPPORT;
 7438|       |    urcodecsuccess:;
 7439|       |    if (rc < 0) {
 7440|       |      BLOSC_TRACE_ERROR("Error in user-defined codec free function\n");
 7441|       |      return;
 7442|       |    }
 7443|       |  }
 7444|       |  */
 7445|  59.1k|  if (context->prefilter != NULL) {
  ------------------
  |  Branch (7445:7): [True: 0, False: 59.1k]
  ------------------
 7446|      0|    my_free(context->preparams);
 7447|      0|  }
 7448|  59.1k|  if (context->postfilter != NULL) {
  ------------------
  |  Branch (7448:7): [True: 0, False: 59.1k]
  ------------------
 7449|      0|    my_free(context->postparams);
 7450|      0|  }
 7451|       |
 7452|  59.1k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (7452:7): [True: 0, False: 59.1k]
  ------------------
 7453|      0|    free(context->block_maskout);
 7454|      0|  }
 7455|  59.1k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (7455:7): [True: 36, False: 59.1k]
  ------------------
 7456|     36|    free(context->blocknbytes);
 7457|     36|  }
 7458|  59.1k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (7458:7): [True: 36, False: 59.1k]
  ------------------
 7459|     36|    free(context->blockoffsets);
 7460|     36|  }
 7461|  59.1k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (7461:7): [True: 36, False: 59.1k]
  ------------------
 7462|     36|    free(context->blockcbytes);
 7463|     36|  }
 7464|  59.1k|  my_free(context);
 7465|  59.1k|}
blosc2_ctx_get_dparams:
 7492|  83.9k|int blosc2_ctx_get_dparams(blosc2_context *ctx, blosc2_dparams *dparams) {
 7493|  83.9k|  dparams->nthreads = ctx->nthreads;
 7494|  83.9k|  dparams->schunk = ctx->schunk;
 7495|  83.9k|  dparams->postfilter = ctx->postfilter;
 7496|  83.9k|  dparams->postparams = ctx->postparams;
 7497|  83.9k|  dparams->typesize = ctx->typesize;
 7498|       |
 7499|  83.9k|  return BLOSC2_ERROR_SUCCESS;
 7500|  83.9k|}
blosc2_chunk_zeros:
 7528|  28.7k|int blosc2_chunk_zeros(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 7529|  28.7k|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (7529:7): [True: 0, False: 28.7k]
  ------------------
 7530|      0|    BLOSC_TRACE_ERROR("dest buffer is not long enough");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7531|      0|    return BLOSC2_ERROR_DATA;
 7532|      0|  }
 7533|       |
 7534|  28.7k|  if ((nbytes > 0) && (nbytes % cparams.typesize)) {
  ------------------
  |  Branch (7534:7): [True: 28.7k, False: 0]
  |  Branch (7534:23): [True: 13, False: 28.7k]
  ------------------
 7535|     13|    BLOSC_TRACE_ERROR("nbytes must be a multiple of typesize");
  ------------------
  |  |   93|     13|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     13|    do {                                            \
  |  |  |  |   98|     13|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     13|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 13, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     13|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7536|     13|    return BLOSC2_ERROR_DATA;
 7537|     13|  }
 7538|       |
 7539|  28.7k|  blosc_header header;
 7540|  28.7k|  blosc2_context* context = blosc2_create_cctx(cparams);
 7541|  28.7k|  if (context == NULL) {
  ------------------
  |  Branch (7541:7): [True: 0, False: 28.7k]
  ------------------
 7542|      0|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7543|      0|    return BLOSC2_ERROR_NULL_POINTER;
 7544|      0|  }
 7545|       |
 7546|  28.7k|  int error = initialize_context_compression(
 7547|  28.7k|          context, NULL, nbytes, dest, destsize,
 7548|  28.7k|          context->clevel, context->filters, context->filters_meta,
 7549|  28.7k|          context->typesize, context->compcode, context->blocksize,
 7550|  28.7k|          context->new_nthreads, context->nthreads, context->splitmode,
 7551|  28.7k|          context->tuner_id, context->tuner_params, context->schunk);
 7552|  28.7k|  if (error <= 0) {
  ------------------
  |  Branch (7552:7): [True: 0, False: 28.7k]
  ------------------
 7553|      0|    blosc2_free_ctx(context);
 7554|      0|    return error;
 7555|      0|  }
 7556|       |
 7557|  28.7k|  memset(&header, 0, sizeof(header));
 7558|  28.7k|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 7559|  28.7k|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 7560|  28.7k|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 7561|  28.7k|  header.typesize = context->typesize;
 7562|  28.7k|  header.nbytes = (int32_t)nbytes;
 7563|  28.7k|  header.blocksize = context->blocksize;
 7564|  28.7k|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 7565|  28.7k|  header.blosc2_flags = BLOSC2_SPECIAL_ZERO << 4;  // mark chunk as all zeros
 7566|  28.7k|  memcpy((uint8_t *)dest, &header, sizeof(header));
 7567|       |
 7568|  28.7k|  blosc2_free_ctx(context);
 7569|       |
 7570|  28.7k|  return BLOSC_EXTENDED_HEADER_LENGTH;
 7571|  28.7k|}
blosc2_chunk_uninit:
 7575|  1.91k|int blosc2_chunk_uninit(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 7576|  1.91k|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (7576:7): [True: 0, False: 1.91k]
  ------------------
 7577|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7578|      0|    return BLOSC2_ERROR_DATA;
 7579|      0|  }
 7580|       |
 7581|  1.91k|  if (nbytes % cparams.typesize) {
  ------------------
  |  Branch (7581:7): [True: 2, False: 1.91k]
  ------------------
 7582|      2|    BLOSC_TRACE_ERROR("nbytes must 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7583|      2|    return BLOSC2_ERROR_DATA;
 7584|      2|  }
 7585|       |
 7586|  1.91k|  blosc_header header;
 7587|  1.91k|  blosc2_context* context = blosc2_create_cctx(cparams);
 7588|  1.91k|  if (context == NULL) {
  ------------------
  |  Branch (7588:7): [True: 0, False: 1.91k]
  ------------------
 7589|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7590|      0|    return BLOSC2_ERROR_NULL_POINTER;
 7591|      0|  }
 7592|  1.91k|  int error = initialize_context_compression(
 7593|  1.91k|          context, NULL, nbytes, dest, destsize,
 7594|  1.91k|          context->clevel, context->filters, context->filters_meta,
 7595|  1.91k|          context->typesize, context->compcode, context->blocksize,
 7596|  1.91k|          context->new_nthreads, context->nthreads, context->splitmode,
 7597|  1.91k|          context->tuner_id, context->tuner_params, context->schunk);
 7598|  1.91k|  if (error <= 0) {
  ------------------
  |  Branch (7598:7): [True: 0, False: 1.91k]
  ------------------
 7599|      0|    blosc2_free_ctx(context);
 7600|      0|    return error;
 7601|      0|  }
 7602|       |
 7603|  1.91k|  memset(&header, 0, sizeof(header));
 7604|  1.91k|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 7605|  1.91k|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 7606|  1.91k|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 7607|  1.91k|  header.typesize = context->typesize;
 7608|  1.91k|  header.nbytes = (int32_t)nbytes;
 7609|  1.91k|  header.blocksize = context->blocksize;
 7610|  1.91k|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 7611|  1.91k|  header.blosc2_flags = BLOSC2_SPECIAL_UNINIT << 4;  // mark chunk as uninitialized
 7612|  1.91k|  memcpy((uint8_t *)dest, &header, sizeof(header));
 7613|       |
 7614|  1.91k|  blosc2_free_ctx(context);
 7615|       |
 7616|  1.91k|  return BLOSC_EXTENDED_HEADER_LENGTH;
 7617|  1.91k|}
blosc2_chunk_nans:
 7621|    502|int blosc2_chunk_nans(blosc2_cparams cparams, const int32_t nbytes, void* dest, int32_t destsize) {
 7622|    502|  if (destsize < BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (7622:7): [True: 0, False: 502]
  ------------------
 7623|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7624|      0|    return BLOSC2_ERROR_DATA;
 7625|      0|  }
 7626|       |
 7627|    502|  if (nbytes % cparams.typesize) {
  ------------------
  |  Branch (7627:7): [True: 10, False: 492]
  ------------------
 7628|     10|    BLOSC_TRACE_ERROR("nbytes must be a multiple of typesize");
  ------------------
  |  |   93|     10|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     10|    do {                                            \
  |  |  |  |   98|     10|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     10|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     10|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7629|     10|    return BLOSC2_ERROR_DATA;
 7630|     10|  }
 7631|       |
 7632|    492|  blosc_header header;
 7633|    492|  blosc2_context* context = blosc2_create_cctx(cparams);
 7634|    492|  if (context == NULL) {
  ------------------
  |  Branch (7634:7): [True: 0, False: 492]
  ------------------
 7635|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7636|      0|    return BLOSC2_ERROR_NULL_POINTER;
 7637|      0|  }
 7638|       |
 7639|    492|  int error = initialize_context_compression(
 7640|    492|          context, NULL, nbytes, dest, destsize,
 7641|    492|          context->clevel, context->filters, context->filters_meta,
 7642|    492|          context->typesize, context->compcode, context->blocksize,
 7643|    492|          context->new_nthreads, context->nthreads, context->splitmode,
 7644|    492|          context->tuner_id, context->tuner_params, context->schunk);
 7645|    492|  if (error <= 0) {
  ------------------
  |  Branch (7645:7): [True: 0, False: 492]
  ------------------
 7646|      0|    blosc2_free_ctx(context);
 7647|      0|    return error;
 7648|      0|  }
 7649|       |
 7650|    492|  memset(&header, 0, sizeof(header));
 7651|    492|  header.version = BLOSC2_VERSION_FORMAT_STABLE;
 7652|    492|  header.versionlz = BLOSC_BLOSCLZ_VERSION_FORMAT;
 7653|    492|  header.flags = BLOSC_DOSHUFFLE | BLOSC_DOBITSHUFFLE;  // extended header
 7654|    492|  header.typesize = context->typesize;
 7655|    492|  header.nbytes = (int32_t)nbytes;
 7656|    492|  header.blocksize = context->blocksize;
 7657|    492|  header.cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 7658|    492|  header.blosc2_flags = BLOSC2_SPECIAL_NAN << 4;  // mark chunk as all NaNs
 7659|    492|  memcpy((uint8_t *)dest, &header, sizeof(header));
 7660|       |
 7661|    492|  blosc2_free_ctx(context);
 7662|       |
 7663|    492|  return BLOSC_EXTENDED_HEADER_LENGTH;
 7664|    492|}
register_filter_private:
 7718|  35.4k|int register_filter_private(blosc2_filter *filter) {
 7719|  35.4k|    BLOSC_ERROR_NULL(filter, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  35.4k|    do {                                            \
  |  |  105|  35.4k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 35.4k]
  |  |  ------------------
  |  |  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|  35.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 35.4k]
  |  |  ------------------
  ------------------
 7720|  35.4k|    if (g_nfilters == UINT8_MAX) {
  ------------------
  |  Branch (7720:9): [True: 0, False: 35.4k]
  ------------------
 7721|      0|        BLOSC_TRACE_ERROR("Can not register more filters");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7722|      0|        return BLOSC2_ERROR_CODEC_SUPPORT;
 7723|      0|    }
 7724|  35.4k|    if (filter->id < BLOSC2_GLOBAL_REGISTERED_FILTERS_START) {
  ------------------
  |  Branch (7724:9): [True: 0, False: 35.4k]
  ------------------
 7725|      0|        BLOSC_TRACE_ERROR("The id must be greater or equal than %d", BLOSC2_GLOBAL_REGISTERED_FILTERS_START);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7726|      0|        return BLOSC2_ERROR_FAILURE;
 7727|      0|    }
 7728|       |    /* This condition can never be fulfilled
 7729|       |    if (filter->id > BLOSC2_USER_REGISTERED_FILTERS_STOP) {
 7730|       |        BLOSC_TRACE_ERROR("The id must be less than or equal to %d", BLOSC2_USER_REGISTERED_FILTERS_STOP);
 7731|       |        return BLOSC2_ERROR_FAILURE;
 7732|       |    }
 7733|       |    */
 7734|       |
 7735|   106k|    for (uint64_t i = 0; i < g_nfilters; ++i) {
  ------------------
  |  Branch (7735:26): [True: 70.8k, False: 35.4k]
  ------------------
 7736|  70.8k|      if (g_filters[i].id == filter->id) {
  ------------------
  |  Branch (7736:11): [True: 0, False: 70.8k]
  ------------------
 7737|      0|        if (strcmp(g_filters[i].name, filter->name) != 0) {
  ------------------
  |  Branch (7737:13): [True: 0, False: 0]
  ------------------
 7738|      0|          BLOSC_TRACE_ERROR("The filter (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7739|      0|                            "  Choose another one !", filter->id, g_filters[i].name);
 7740|      0|          return BLOSC2_ERROR_FAILURE;
 7741|      0|        }
 7742|      0|        else {
 7743|       |          // Already registered, so no more actions needed
 7744|      0|          return BLOSC2_ERROR_SUCCESS;
 7745|      0|        }
 7746|      0|      }
 7747|  70.8k|    }
 7748|       |
 7749|  35.4k|    blosc2_filter *filter_new = &g_filters[g_nfilters++];
 7750|  35.4k|    memcpy(filter_new, filter, sizeof(blosc2_filter));
 7751|       |
 7752|  35.4k|    return BLOSC2_ERROR_SUCCESS;
 7753|  35.4k|}
register_codec_private:
 7768|  63.7k|int register_codec_private(blosc2_codec *codec) {
 7769|  63.7k|    BLOSC_ERROR_NULL(codec, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  63.7k|    do {                                            \
  |  |  105|  63.7k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 63.7k]
  |  |  ------------------
  |  |  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|  63.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 63.7k]
  |  |  ------------------
  ------------------
 7770|  63.7k|    if (g_ncodecs == UINT8_MAX) {
  ------------------
  |  Branch (7770:9): [True: 0, False: 63.7k]
  ------------------
 7771|      0|      BLOSC_TRACE_ERROR("Can not register more codecs");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7772|      0|      return BLOSC2_ERROR_CODEC_SUPPORT;
 7773|      0|    }
 7774|  63.7k|    if (codec->compcode < BLOSC2_GLOBAL_REGISTERED_CODECS_START) {
  ------------------
  |  Branch (7774:9): [True: 0, False: 63.7k]
  ------------------
 7775|      0|      BLOSC_TRACE_ERROR("The id must be greater or equal than %d", BLOSC2_GLOBAL_REGISTERED_CODECS_START);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7776|      0|      return BLOSC2_ERROR_FAILURE;
 7777|      0|    }
 7778|       |    /* This condition can never be fulfilled
 7779|       |    if (codec->compcode > BLOSC2_USER_REGISTERED_CODECS_STOP) {
 7780|       |      BLOSC_TRACE_ERROR("The id must be less or equal to %d", BLOSC2_USER_REGISTERED_CODECS_STOP);
 7781|       |      return BLOSC2_ERROR_FAILURE;
 7782|       |    }
 7783|       |     */
 7784|       |
 7785|   318k|    for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (7785:21): [True: 255k, False: 63.7k]
  ------------------
 7786|   255k|      if (g_codecs[i].compcode == codec->compcode) {
  ------------------
  |  Branch (7786:11): [True: 0, False: 255k]
  ------------------
 7787|      0|        if (strcmp(g_codecs[i].compname, codec->compname) != 0) {
  ------------------
  |  Branch (7787:13): [True: 0, False: 0]
  ------------------
 7788|      0|          BLOSC_TRACE_ERROR("The codec (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7789|      0|                            "  Choose another one !", codec->compcode, codec->compname);
 7790|      0|          return BLOSC2_ERROR_CODEC_PARAM;
 7791|      0|        }
 7792|      0|        else {
 7793|       |          // Already registered, so no more actions needed
 7794|      0|          return BLOSC2_ERROR_SUCCESS;
 7795|      0|        }
 7796|      0|      }
 7797|   255k|    }
 7798|       |
 7799|  63.7k|    blosc2_codec *codec_new = &g_codecs[g_ncodecs++];
 7800|  63.7k|    memcpy(codec_new, codec, sizeof(blosc2_codec));
 7801|       |
 7802|  63.7k|    return BLOSC2_ERROR_SUCCESS;
 7803|  63.7k|}
register_tuner_private:
 7818|  7.08k|int register_tuner_private(blosc2_tuner *tuner) {
 7819|  7.08k|  BLOSC_ERROR_NULL(tuner, BLOSC2_ERROR_INVALID_PARAM);
  ------------------
  |  |  104|  7.08k|    do {                                            \
  |  |  105|  7.08k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 7.08k]
  |  |  ------------------
  |  |  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|  7.08k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 7.08k]
  |  |  ------------------
  ------------------
 7820|  7.08k|  if (g_ntuners == UINT8_MAX) {
  ------------------
  |  Branch (7820:7): [True: 0, False: 7.08k]
  ------------------
 7821|      0|    BLOSC_TRACE_ERROR("Can not register more tuners");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7822|      0|    return BLOSC2_ERROR_CODEC_SUPPORT;
 7823|      0|  }
 7824|  7.08k|  if (tuner->id < BLOSC2_GLOBAL_REGISTERED_TUNER_START) {
  ------------------
  |  Branch (7824:7): [True: 0, False: 7.08k]
  ------------------
 7825|      0|    BLOSC_TRACE_ERROR("The id must be greater or equal than %d", BLOSC2_GLOBAL_REGISTERED_TUNER_START);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7826|      0|    return BLOSC2_ERROR_FAILURE;
 7827|      0|  }
 7828|       |
 7829|  7.08k|  for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (7829:19): [True: 0, False: 7.08k]
  ------------------
 7830|      0|    if (g_tuners[i].id == tuner->id) {
  ------------------
  |  Branch (7830:9): [True: 0, False: 0]
  ------------------
 7831|      0|      if (strcmp(g_tuners[i].name, tuner->name) != 0) {
  ------------------
  |  Branch (7831:11): [True: 0, False: 0]
  ------------------
 7832|      0|        BLOSC_TRACE_ERROR("The tuner (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7833|      0|                          "  Choose another one !", tuner->id, g_tuners[i].name);
 7834|      0|        return BLOSC2_ERROR_FAILURE;
 7835|      0|      }
 7836|      0|      else {
 7837|       |        // Already registered, so no more actions needed
 7838|      0|        return BLOSC2_ERROR_SUCCESS;
 7839|      0|      }
 7840|      0|    }
 7841|      0|  }
 7842|       |
 7843|  7.08k|  blosc2_tuner *tuner_new = &g_tuners[g_ntuners++];
 7844|  7.08k|  memcpy(tuner_new, tuner, sizeof(blosc2_tuner));
 7845|       |
 7846|  7.08k|  return BLOSC2_ERROR_SUCCESS;
 7847|  7.08k|}
_blosc2_register_io_cb:
 7860|  14.1k|int _blosc2_register_io_cb(const blosc2_io_cb *io) {
 7861|       |
 7862|  21.2k|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (7862:24): [True: 21.2k, False: 2]
  ------------------
 7863|  21.2k|    if (g_ios[i].id == io->id) {
  ------------------
  |  Branch (7863:9): [True: 14.1k, False: 7.08k]
  ------------------
 7864|  14.1k|      if (strcmp(g_ios[i].name, io->name) != 0) {
  ------------------
  |  Branch (7864:11): [True: 0, False: 14.1k]
  ------------------
 7865|      0|        BLOSC_TRACE_ERROR("The IO (ID: %d) plugin is already registered with name: %s."
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7866|      0|                          "  Choose another one !", io->id, g_ios[i].name);
 7867|      0|        return BLOSC2_ERROR_PLUGIN_IO;
 7868|      0|      }
 7869|  14.1k|      else {
 7870|       |        // Already registered, so no more actions needed
 7871|  14.1k|        return BLOSC2_ERROR_SUCCESS;
 7872|  14.1k|      }
 7873|  14.1k|    }
 7874|  21.2k|  }
 7875|       |
 7876|      2|  blosc2_io_cb *io_new = &g_ios[g_nio++];
 7877|      2|  memcpy(io_new, io, sizeof(blosc2_io_cb));
 7878|       |
 7879|      2|  return BLOSC2_ERROR_SUCCESS;
 7880|  14.1k|}
blosc2_get_io_cb:
 7897|   140k|blosc2_io_cb *blosc2_get_io_cb(uint8_t id) {
 7898|       |  // If g_initlib is not set by blosc2_init() this function will try to read
 7899|       |  // uninitialized memory. We should therefore always return NULL in that case
 7900|   140k|  if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  142|   140k|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
                if (load_acquire_int(&g_initlib) != BLOSC_STATE_INITIALIZED) {
  ------------------
  |  |  104|   140k|#define BLOSC_STATE_INITIALIZED   1
  ------------------
  |  Branch (7900:7): [True: 0, False: 140k]
  ------------------
 7901|      0|    return NULL;
 7902|      0|  }
 7903|   140k|  for (uint64_t i = 0; i < g_nio; ++i) {
  ------------------
  |  Branch (7903:24): [True: 140k, False: 0]
  ------------------
 7904|   140k|    if (g_ios[i].id == id) {
  ------------------
  |  Branch (7904:9): [True: 140k, False: 0]
  ------------------
 7905|   140k|      return &g_ios[i];
 7906|   140k|    }
 7907|   140k|  }
 7908|      0|  if (id == BLOSC2_IO_FILESYSTEM) {
  ------------------
  |  Branch (7908:7): [True: 0, False: 0]
  ------------------
 7909|      0|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS) < 0) {
  ------------------
  |  Branch (7909:9): [True: 0, False: 0]
  ------------------
 7910|      0|      BLOSC_TRACE_ERROR("Error registering the default IO API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7911|      0|      return NULL;
 7912|      0|    }
 7913|      0|    return blosc2_get_io_cb(id);
 7914|      0|  }
 7915|      0|  else if (id == BLOSC2_IO_FILESYSTEM_MMAP) {
  ------------------
  |  Branch (7915:12): [True: 0, False: 0]
  ------------------
 7916|      0|    if (_blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP) < 0) {
  ------------------
  |  Branch (7916:9): [True: 0, False: 0]
  ------------------
 7917|      0|      BLOSC_TRACE_ERROR("Error registering the mmap IO API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7918|      0|      return NULL;
 7919|      0|    }
 7920|      0|    return blosc2_get_io_cb(id);
 7921|      0|  }
 7922|      0|  return NULL;
 7923|      0|}
blosc2_error_string:
 7995|     12|const char *blosc2_error_string(int error_code) {
 7996|     12|  switch (error_code) {
 7997|     10|    case BLOSC2_ERROR_FAILURE:
  ------------------
  |  Branch (7997:5): [True: 10, False: 2]
  ------------------
 7998|     10|      return "Generic failure";
 7999|      0|    case BLOSC2_ERROR_STREAM:
  ------------------
  |  Branch (7999:5): [True: 0, False: 12]
  ------------------
 8000|      0|      return "Bad stream";
 8001|      2|    case BLOSC2_ERROR_DATA:
  ------------------
  |  Branch (8001:5): [True: 2, False: 10]
  ------------------
 8002|      2|      return "Invalid data";
 8003|      0|    case BLOSC2_ERROR_MEMORY_ALLOC:
  ------------------
  |  Branch (8003:5): [True: 0, False: 12]
  ------------------
 8004|      0|      return "Memory alloc/realloc failure";
 8005|      0|    case BLOSC2_ERROR_READ_BUFFER:
  ------------------
  |  Branch (8005:5): [True: 0, False: 12]
  ------------------
 8006|      0|      return "Not enough space to read";
 8007|      0|    case BLOSC2_ERROR_WRITE_BUFFER:
  ------------------
  |  Branch (8007:5): [True: 0, False: 12]
  ------------------
 8008|      0|      return "Not enough space to write";
 8009|      0|    case BLOSC2_ERROR_CODEC_SUPPORT:
  ------------------
  |  Branch (8009:5): [True: 0, False: 12]
  ------------------
 8010|      0|      return "Codec not supported";
 8011|      0|    case BLOSC2_ERROR_CODEC_PARAM:
  ------------------
  |  Branch (8011:5): [True: 0, False: 12]
  ------------------
 8012|      0|      return "Invalid parameter supplied to codec";
 8013|      0|    case BLOSC2_ERROR_CODEC_DICT:
  ------------------
  |  Branch (8013:5): [True: 0, False: 12]
  ------------------
 8014|      0|      return "Codec dictionary error";
 8015|      0|    case BLOSC2_ERROR_VERSION_SUPPORT:
  ------------------
  |  Branch (8015:5): [True: 0, False: 12]
  ------------------
 8016|      0|      return "Version not supported";
 8017|      0|    case BLOSC2_ERROR_INVALID_HEADER:
  ------------------
  |  Branch (8017:5): [True: 0, False: 12]
  ------------------
 8018|      0|      return "Invalid value in header";
 8019|      0|    case BLOSC2_ERROR_INVALID_PARAM:
  ------------------
  |  Branch (8019:5): [True: 0, False: 12]
  ------------------
 8020|      0|      return "Invalid parameter supplied to function";
 8021|      0|    case BLOSC2_ERROR_FILE_READ:
  ------------------
  |  Branch (8021:5): [True: 0, False: 12]
  ------------------
 8022|      0|      return "File read failure";
 8023|      0|    case BLOSC2_ERROR_FILE_WRITE:
  ------------------
  |  Branch (8023:5): [True: 0, False: 12]
  ------------------
 8024|      0|      return "File write failure";
 8025|      0|    case BLOSC2_ERROR_FILE_OPEN:
  ------------------
  |  Branch (8025:5): [True: 0, False: 12]
  ------------------
 8026|      0|      return "File open failure";
 8027|      0|    case BLOSC2_ERROR_NOT_FOUND:
  ------------------
  |  Branch (8027:5): [True: 0, False: 12]
  ------------------
 8028|      0|      return "Not found";
 8029|      0|    case BLOSC2_ERROR_RUN_LENGTH:
  ------------------
  |  Branch (8029:5): [True: 0, False: 12]
  ------------------
 8030|      0|      return "Bad run length encoding";
 8031|      0|    case BLOSC2_ERROR_FILTER_PIPELINE:
  ------------------
  |  Branch (8031:5): [True: 0, False: 12]
  ------------------
 8032|      0|      return "Filter pipeline error";
 8033|      0|    case BLOSC2_ERROR_CHUNK_INSERT:
  ------------------
  |  Branch (8033:5): [True: 0, False: 12]
  ------------------
 8034|      0|      return "Chunk insert failure";
 8035|      0|    case BLOSC2_ERROR_CHUNK_APPEND:
  ------------------
  |  Branch (8035:5): [True: 0, False: 12]
  ------------------
 8036|      0|      return "Chunk append failure";
 8037|      0|    case BLOSC2_ERROR_CHUNK_UPDATE:
  ------------------
  |  Branch (8037:5): [True: 0, False: 12]
  ------------------
 8038|      0|      return "Chunk update failure";
 8039|      0|    case BLOSC2_ERROR_2GB_LIMIT:
  ------------------
  |  Branch (8039:5): [True: 0, False: 12]
  ------------------
 8040|      0|      return "Sizes larger than 2gb not supported";
 8041|      0|    case BLOSC2_ERROR_SCHUNK_COPY:
  ------------------
  |  Branch (8041:5): [True: 0, False: 12]
  ------------------
 8042|      0|      return "Super-chunk copy failure";
 8043|      0|    case BLOSC2_ERROR_FRAME_TYPE:
  ------------------
  |  Branch (8043:5): [True: 0, False: 12]
  ------------------
 8044|      0|      return "Wrong type for frame";
 8045|      0|    case BLOSC2_ERROR_FILE_TRUNCATE:
  ------------------
  |  Branch (8045:5): [True: 0, False: 12]
  ------------------
 8046|      0|      return "File truncate failure";
 8047|      0|    case BLOSC2_ERROR_LOCK:
  ------------------
  |  Branch (8047:5): [True: 0, False: 12]
  ------------------
 8048|      0|      return "Frame lock failure";
 8049|      0|    case BLOSC2_ERROR_THREAD_CREATE:
  ------------------
  |  Branch (8049:5): [True: 0, False: 12]
  ------------------
 8050|      0|      return "Thread or thread context creation failure";
 8051|      0|    case BLOSC2_ERROR_POSTFILTER:
  ------------------
  |  Branch (8051:5): [True: 0, False: 12]
  ------------------
 8052|      0|      return "Postfilter failure";
 8053|      0|    case BLOSC2_ERROR_FRAME_SPECIAL:
  ------------------
  |  Branch (8053:5): [True: 0, False: 12]
  ------------------
 8054|      0|      return "Special frame failure";
 8055|      0|    case BLOSC2_ERROR_SCHUNK_SPECIAL:
  ------------------
  |  Branch (8055:5): [True: 0, False: 12]
  ------------------
 8056|      0|      return "Special super-chunk failure";
 8057|      0|    case BLOSC2_ERROR_PLUGIN_IO:
  ------------------
  |  Branch (8057:5): [True: 0, False: 12]
  ------------------
 8058|      0|      return "IO plugin error";
 8059|      0|    case BLOSC2_ERROR_FILE_REMOVE:
  ------------------
  |  Branch (8059:5): [True: 0, False: 12]
  ------------------
 8060|      0|      return "Remove file failure";
 8061|      0|    case BLOSC2_ERROR_NULL_POINTER:
  ------------------
  |  Branch (8061:5): [True: 0, False: 12]
  ------------------
 8062|      0|      return "Pointer is null";
 8063|      0|    case BLOSC2_ERROR_INVALID_INDEX:
  ------------------
  |  Branch (8063:5): [True: 0, False: 12]
  ------------------
 8064|      0|      return "Invalid index";
 8065|      0|    case BLOSC2_ERROR_METALAYER_NOT_FOUND:
  ------------------
  |  Branch (8065:5): [True: 0, False: 12]
  ------------------
 8066|      0|      return "Metalayer has not been found";
 8067|      0|    case BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED:
  ------------------
  |  Branch (8067:5): [True: 0, False: 12]
  ------------------
 8068|      0|      return "Maximum buffersize exceeded";
 8069|      0|    case BLOSC2_ERROR_TUNER:
  ------------------
  |  Branch (8069:5): [True: 0, False: 12]
  ------------------
 8070|      0|      return "Tuner failure";
 8071|      0|    default:
  ------------------
  |  Branch (8071:5): [True: 0, False: 12]
  ------------------
 8072|      0|      return "Unknown error";
 8073|     12|  }
 8074|     12|}
blosc2.c:shuffle_size:
  791|   925k|static int32_t shuffle_size(const blosc2_context* context, int i) {
  792|   925k|  return context->filters_meta[i] == 0 ? context->typesize : context->filters_meta[i];
  ------------------
  |  Branch (792:10): [True: 144k, False: 781k]
  ------------------
  793|   925k|}
blosc2.c:flags_to_filters:
  875|  49.9M|static void flags_to_filters(const uint8_t flags, uint8_t* filters) {
  876|       |  /* Initialize the filter pipeline */
  877|  49.9M|  memset(filters, 0, BLOSC2_MAX_FILTERS);
  878|       |  /* Fill the filter pipeline */
  879|  49.9M|  if (flags & BLOSC_DOSHUFFLE)
  ------------------
  |  Branch (879:7): [True: 49.9M, False: 1.98k]
  ------------------
  880|  49.9M|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_SHUFFLE;
  881|  49.9M|  if (flags & BLOSC_DOBITSHUFFLE)
  ------------------
  |  Branch (881:7): [True: 49.9M, False: 2.62k]
  ------------------
  882|  49.9M|    filters[BLOSC2_MAX_FILTERS - 1] = BLOSC_BITSHUFFLE;
  883|  49.9M|  if (flags & BLOSC_DODELTA)
  ------------------
  |  Branch (883:7): [True: 297k, False: 49.6M]
  ------------------
  884|   297k|    filters[BLOSC2_MAX_FILTERS - 2] = BLOSC_DELTA;
  885|  49.9M|}
blosc2.c:load_codec_locked:
 1155|      4|static int load_codec_locked(blosc2_codec *codec) {
 1156|      4|  char libpath[PATH_MAX];
 1157|      4|  void *lib = load_lib(codec->compname, libpath);
 1158|      4|  if(lib == NULL) {
  ------------------
  |  Branch (1158:6): [True: 4, False: 0]
  ------------------
 1159|      4|    BLOSC_TRACE_ERROR("Error while loading the library for codec `%s`", codec->compname);
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1160|      4|    return BLOSC2_ERROR_FAILURE;
 1161|      4|  }
 1162|       |
 1163|      0|  codec_info *info = dlsym(lib, "info");
 1164|      0|  if (info == NULL) {
  ------------------
  |  Branch (1164:7): [True: 0, False: 0]
  ------------------
 1165|      0|    BLOSC_TRACE_ERROR("`info` symbol cannot be loaded from plugin `%s`", codec->compname);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1166|      0|    dlclose(lib);
 1167|      0|    return BLOSC2_ERROR_FAILURE;
 1168|      0|  }
 1169|      0|  void *encoder = plugin_dlsym(lib, info->encoder);
 1170|      0|  void *decoder = plugin_dlsym(lib, info->decoder);
 1171|       |
 1172|      0|  if (encoder == NULL || decoder == NULL) {
  ------------------
  |  Branch (1172:7): [True: 0, False: 0]
  |  Branch (1172:26): [True: 0, False: 0]
  ------------------
 1173|      0|    BLOSC_TRACE_ERROR("encoder or decoder cannot be loaded from plugin `%s`", codec->compname);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1174|      0|    dlclose(lib);
 1175|      0|    return BLOSC2_ERROR_FAILURE;
 1176|      0|  }
 1177|      0|  codec->encoder = encoder;
 1178|      0|  store_release_ptr(&codec->decoder, decoder);
  ------------------
  |  |  145|      0|#define store_release_ptr(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 1179|       |
 1180|       |  /* If ever add .free function in future for codec params
 1181|       |  codecparams_info *info2 = dlsym(lib, "info2");
 1182|       |  if (info2 != NULL) {
 1183|       |    // New plugin (e.g. openzl) with free function for codec_params defined
 1184|       |    // will be used when destroying context in blosc2_free_ctx
 1185|       |      codec->free = dlsym(lib, info2->free);
 1186|       |  }
 1187|       |  else{
 1188|       |    codec->free = NULL;
 1189|       |  }
 1190|       |  */
 1191|       |
 1192|      0|  return BLOSC2_ERROR_SUCCESS;
 1193|      0|}
blosc2.c:fused_shuffle_bytedelta_size:
  799|   467k|static int fused_shuffle_bytedelta_size(const blosc2_context *context, int i) {
  800|   467k|  if (i < 0 || i + 1 >= BLOSC2_MAX_FILTERS || context->filters[i] != BLOSC_SHUFFLE ||
  ------------------
  |  Branch (800:7): [True: 57.3k, False: 410k]
  |  Branch (800:16): [True: 0, False: 410k]
  |  Branch (800:47): [True: 275k, False: 134k]
  ------------------
  801|   413k|      context->filters[i + 1] != BLOSC_FILTER_BYTEDELTA) {
  ------------------
  |  Branch (801:7): [True: 80.4k, False: 54.4k]
  ------------------
  802|   413k|    return 0;
  803|   413k|  }
  804|  54.4k|  int delta_size = context->filters_meta[i + 1];
  805|  54.4k|  if (delta_size == 0 && context->schunk != NULL) {
  ------------------
  |  Branch (805:7): [True: 30, False: 54.4k]
  |  Branch (805:26): [True: 30, False: 0]
  ------------------
  806|     30|    delta_size = context->schunk->typesize;
  807|     30|  }
  808|  54.4k|  int size = shuffle_size(context, i);
  809|  54.4k|  return (size == 2 || size == 4 || size == 8) && size == delta_size &&
  ------------------
  |  Branch (809:11): [True: 12.6k, False: 41.7k]
  |  Branch (809:24): [True: 4.79k, False: 37.0k]
  |  Branch (809:37): [True: 23.2k, False: 13.7k]
  |  Branch (809:51): [True: 36.2k, False: 4.44k]
  ------------------
  810|  36.2k|         shuffle_bytedelta_available() ? size : 0;
  ------------------
  |  Branch (810:10): [True: 36.2k, False: 0]
  ------------------
  811|   467k|}
blosc2.c:bitshuffle_scratch:
 1322|  66.6k|static uint8_t* bitshuffle_scratch(struct thread_context* thread_context, int32_t bsize) {
 1323|  66.6k|  size_t offset = (size_t)(thread_context->tmp4 - thread_context->tmp);
 1324|  66.6k|  size_t shift = (16 - ((uintptr_t)thread_context->tmp4 & 15)) & 15;
 1325|  66.6k|  if (offset + shift + (size_t)bsize <= thread_context->tmp_nbytes) {
  ------------------
  |  Branch (1325:7): [True: 66.5k, False: 30]
  ------------------
 1326|  66.5k|    return thread_context->tmp4 + shift;
 1327|  66.5k|  }
 1328|     30|  if (offset + (size_t)bsize <= thread_context->tmp_nbytes) {
  ------------------
  |  Branch (1328:7): [True: 30, False: 0]
  ------------------
 1329|     30|    return thread_context->tmp4;
 1330|     30|  }
 1331|      0|  return NULL;
 1332|     30|}
blosc2.c:destroy_thread_context:
 2689|  6.55k|static void destroy_thread_context(struct thread_context* thread_context) {
 2690|  6.55k|  my_free(thread_context->tmp);
 2691|  6.55k|  free(thread_context->blosclz_state);
 2692|  6.55k|#if defined(HAVE_ZSTD)
 2693|  6.55k|  if (thread_context->zstd_cctx != NULL) {
  ------------------
  |  Branch (2693:7): [True: 0, False: 6.55k]
  ------------------
 2694|      0|    ZSTD_freeCCtx(thread_context->zstd_cctx);
 2695|      0|  }
 2696|  6.55k|  if (thread_context->zstd_dctx != NULL) {
  ------------------
  |  Branch (2696:7): [True: 3.19k, False: 3.36k]
  ------------------
 2697|  3.19k|    ZSTD_freeDCtx(thread_context->zstd_dctx);
 2698|  3.19k|  }
 2699|  6.55k|#endif
 2700|  6.55k|  if (thread_context->lz4_cstream != NULL) {
  ------------------
  |  Branch (2700:7): [True: 0, False: 6.55k]
  ------------------
 2701|      0|    LZ4_freeStream((LZ4_stream_t*)thread_context->lz4_cstream);
 2702|      0|  }
 2703|  6.55k|  if (thread_context->lz4hc_cstream != NULL) {
  ------------------
  |  Branch (2703:7): [True: 0, False: 6.55k]
  ------------------
 2704|      0|    LZ4_freeStreamHC((LZ4_streamHC_t*)thread_context->lz4hc_cstream);
 2705|      0|  }
 2706|  6.55k|}
blosc2.c:my_free:
  412|  72.9k|static void my_free(void* block) {
  413|       |#if defined(_WIN32)
  414|       |  _aligned_free(block);
  415|       |#else
  416|  72.9k|  free(block);
  417|  72.9k|#endif  /* _WIN32 */
  418|  72.9k|}
blosc2.c:initialize_context_compression:
 2879|  31.1k|        blosc2_schunk* schunk) {
 2880|       |
 2881|       |  /* The block size and the filters divide by the typesize */
 2882|  31.1k|  if (typesize <= 0) {
  ------------------
  |  Branch (2882:7): [True: 0, False: 31.1k]
  ------------------
 2883|      0|    BLOSC_TRACE_ERROR("The typesize must be positive, not %d.", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2884|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2885|      0|  }
 2886|       |
 2887|       |  /* Check typesize limits */
 2888|  31.1k|  if (typesize > BLOSC2_MAXTYPESIZE) {
  ------------------
  |  Branch (2888:7): [True: 0, False: 31.1k]
  ------------------
 2889|       |    // If typesize is too large for Blosc2, return an error
 2890|      0|    BLOSC_TRACE_ERROR("Typesize cannot exceed %d bytes.", BLOSC2_MAXTYPESIZE);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2891|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2892|      0|  }
 2893|       |  /* Now, cap typesize so that blosc2 split machinery can continue to work.  This has to be
 2894|       |     done before the tuner chooses the block size, which depends on the typesize: a buffer
 2895|       |     with a larger typesize is a plain stream of bytes and is blocked as one. */
 2896|  31.1k|  if (typesize > BLOSC_MAX_TYPESIZE) {
  ------------------
  |  Branch (2896:7): [True: 692, False: 30.4k]
  ------------------
 2897|       |    /* If typesize is too large, treat buffer as an 1-byte stream. */
 2898|    692|    typesize = 1;
 2899|    692|  }
 2900|       |
 2901|       |  /* Set parameters */
 2902|  31.1k|  context->do_compress = 1;
 2903|  31.1k|  context->src = (const uint8_t*)src;
 2904|  31.1k|  context->srcsize = srcsize;
 2905|  31.1k|  context->dest = (uint8_t*)dest;
 2906|  31.1k|  context->output_bytes = 0;
 2907|  31.1k|  context->destsize = destsize;
 2908|  31.1k|  context->sourcesize = srcsize;
 2909|  31.1k|  context->typesize = typesize;
 2910|  31.1k|  context->filter_flags = filters_to_flags(filters);
 2911|   218k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (2911:19): [True: 186k, False: 31.1k]
  ------------------
 2912|   186k|    context->filters[i] = filters[i];
 2913|   186k|    context->filters_meta[i] = filters_meta[i];
 2914|   186k|  }
 2915|  31.1k|  context->compcode = compressor;
 2916|  31.1k|  context->nthreads = nthreads;
 2917|  31.1k|  context->new_nthreads = new_nthreads;
 2918|  31.1k|  context->clevel = clevel;
 2919|  31.1k|  context->schunk = schunk;
 2920|  31.1k|  context->tuner_params = tuner_params;
 2921|  31.1k|  context->tuner_id = tuner_id;
 2922|  31.1k|  context->splitmode = splitmode;
 2923|  31.1k|  context->blosc2_flags2 = 0;
 2924|  31.1k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (2924:7): [True: 0, False: 31.1k]
  ------------------
 2925|      0|    free(context->blocknbytes);
 2926|      0|    context->blocknbytes = NULL;
 2927|      0|  }
 2928|  31.1k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (2928:7): [True: 0, False: 31.1k]
  ------------------
 2929|      0|    free(context->blockoffsets);
 2930|      0|    context->blockoffsets = NULL;
 2931|      0|  }
 2932|  31.1k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (2932:7): [True: 0, False: 31.1k]
  ------------------
 2933|      0|    free(context->blockcbytes);
 2934|      0|    context->blockcbytes = NULL;
 2935|      0|  }
 2936|  31.1k|  context->vlblock_sources = NULL;
 2937|  31.1k|  context->vlblock_dests = NULL;
 2938|       |  /* tuner some compression parameters */
 2939|  31.1k|  context->blocksize = (int32_t)blocksize;
 2940|  31.1k|  int rc = 0;
 2941|  31.1k|  if (context->tuner_params != NULL) {
  ------------------
  |  Branch (2941:7): [True: 0, False: 31.1k]
  ------------------
 2942|      0|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|      0|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2942:9): [True: 0, False: 0]
  |  Branch (2942:49): [True: 0, False: 0]
  ------------------
 2943|      0|      if (blosc_stune_next_cparams(context) < 0) {
  ------------------
  |  Branch (2943:11): [True: 0, False: 0]
  ------------------
 2944|      0|        BLOSC_TRACE_ERROR("Error in stune next_cparams func\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2945|      0|        return BLOSC2_ERROR_TUNER;
 2946|      0|      }
 2947|      0|    } else {
 2948|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2948:23): [True: 0, False: 0]
  ------------------
 2949|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2949:13): [True: 0, False: 0]
  ------------------
 2950|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2950:15): [True: 0, False: 0]
  ------------------
 2951|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2951:17): [True: 0, False: 0]
  ------------------
 2952|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2953|      0|              return BLOSC2_ERROR_FAILURE;
 2954|      0|            }
 2955|      0|          }
 2956|      0|          if (g_tuners[i].next_cparams(context) < 0) {
  ------------------
  |  Branch (2956:15): [True: 0, False: 0]
  ------------------
 2957|      0|            BLOSC_TRACE_ERROR("Error in tuner %d next_cparams func\n", context->tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2958|      0|            return BLOSC2_ERROR_TUNER;
 2959|      0|          }
 2960|      0|          if (g_tuners[i].id == BLOSC_BTUNE && context->blocksize == 0) {
  ------------------
  |  Branch (2960:15): [True: 0, False: 0]
  |  Branch (2960:48): [True: 0, False: 0]
  ------------------
 2961|       |            // Call stune for initializing blocksize
 2962|      0|            if (blosc_stune_next_blocksize(context) < 0) {
  ------------------
  |  Branch (2962:17): [True: 0, False: 0]
  ------------------
 2963|      0|              BLOSC_TRACE_ERROR("Error in stune next_blocksize func\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2964|      0|              return BLOSC2_ERROR_TUNER;
 2965|      0|            }
 2966|      0|          }
 2967|      0|          goto urtunersuccess;
 2968|      0|        }
 2969|      0|      }
 2970|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2971|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2972|      0|    }
 2973|  31.1k|  } else {
 2974|  31.1k|    if (context->tuner_id < BLOSC_LAST_TUNER && context->tuner_id == BLOSC_STUNE) {
  ------------------
  |  |   26|  31.1k|#define BLOSC_STUNE 0
  ------------------
  |  Branch (2974:9): [True: 31.1k, False: 0]
  |  Branch (2974:49): [True: 31.1k, False: 0]
  ------------------
 2975|  31.1k|      rc = blosc_stune_next_blocksize(context);
 2976|  31.1k|    } else {
 2977|      0|      for (int i = 0; i < g_ntuners; ++i) {
  ------------------
  |  Branch (2977:23): [True: 0, False: 0]
  ------------------
 2978|      0|        if (g_tuners[i].id == context->tuner_id) {
  ------------------
  |  Branch (2978:13): [True: 0, False: 0]
  ------------------
 2979|      0|          if (load_acquire_ptr(&g_tuners[i].init) == NULL) {
  ------------------
  |  |  144|      0|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2979:15): [True: 0, False: 0]
  ------------------
 2980|      0|            if (fill_tuner(&g_tuners[i]) < 0) {
  ------------------
  |  Branch (2980:17): [True: 0, False: 0]
  ------------------
 2981|      0|              BLOSC_TRACE_ERROR("Could not load tuner %d.", g_tuners[i].id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2982|      0|              return BLOSC2_ERROR_FAILURE;
 2983|      0|            }
 2984|      0|          }
 2985|      0|          rc = g_tuners[i].next_blocksize(context);
 2986|      0|          goto urtunersuccess;
 2987|      0|        }
 2988|      0|      }
 2989|      0|      BLOSC_TRACE_ERROR("User-defined tuner %d not found\n", context->tuner_id);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2990|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2991|      0|    }
 2992|  31.1k|  }
 2993|  31.1k|  urtunersuccess:;
 2994|  31.1k|  if (rc < 0) {
  ------------------
  |  Branch (2994:7): [True: 0, False: 31.1k]
  ------------------
 2995|      0|    BLOSC_TRACE_ERROR("Error in tuner next_blocksize func\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2996|      0|    return BLOSC2_ERROR_TUNER;
 2997|      0|  }
 2998|       |  /* The header must record the block size that the tuner settled on (it rounds a requested
 2999|       |     one to a multiple of the typesize, for instance), not the one that was asked for: a reader
 3000|       |     splits the chunk into blocks of the size in the header.  Variable-length block chunks
 3001|       |     store something else there and set it themselves. */
 3002|  31.1k|  context->header_blocksize = context->blocksize;
 3003|       |
 3004|       |
 3005|       |  /* Check buffer size limits */
 3006|  31.1k|  if (srcsize > BLOSC2_MAX_BUFFERSIZE) {
  ------------------
  |  Branch (3006:7): [True: 0, False: 31.1k]
  ------------------
 3007|      0|    BLOSC_TRACE_ERROR("Input buffer size cannot exceed %d bytes.",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3008|      0|                      BLOSC2_MAX_BUFFERSIZE);
 3009|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 3010|      0|  }
 3011|       |
 3012|  31.1k|  if (destsize < BLOSC2_MAX_OVERHEAD) {
  ------------------
  |  Branch (3012:7): [True: 0, False: 31.1k]
  ------------------
 3013|      0|    BLOSC_TRACE_ERROR("Output buffer size should be larger than %d bytes.",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3014|      0|                      BLOSC2_MAX_OVERHEAD);
 3015|      0|    return BLOSC2_ERROR_MAX_BUFSIZE_EXCEEDED;
 3016|      0|  }
 3017|       |
 3018|       |  /* Compression level */
 3019|  31.1k|  if (clevel < 0 || clevel > 9) {
  ------------------
  |  Branch (3019:7): [True: 0, False: 31.1k]
  |  Branch (3019:21): [True: 0, False: 31.1k]
  ------------------
 3020|       |    /* If clevel not in 0..9, print an error */
 3021|      0|    BLOSC_TRACE_ERROR("`clevel` parameter must be between 0 and 9!.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3022|      0|    return BLOSC2_ERROR_CODEC_PARAM;
 3023|      0|  }
 3024|       |
 3025|       |  /* Dictionary support is only available for ZSTD, LZ4, and LZ4HC.
 3026|       |   * Skip the check when src is NULL (special-value chunks): no compression
 3027|       |   * will actually happen, so codec compatibility is irrelevant. */
 3028|  31.1k|  if (src != NULL && context->use_dict && context->compcode != BLOSC_ZSTD &&
  ------------------
  |  Branch (3028:7): [True: 0, False: 31.1k]
  |  Branch (3028:22): [True: 0, False: 0]
  |  Branch (3028:43): [True: 0, False: 0]
  ------------------
 3029|      0|      context->compcode != BLOSC_LZ4 && context->compcode != BLOSC_LZ4HC) {
  ------------------
  |  Branch (3029:7): [True: 0, False: 0]
  |  Branch (3029:41): [True: 0, False: 0]
  ------------------
 3030|      0|    BLOSC_TRACE_ERROR("`use_dict` is only supported for ZSTD, LZ4, and LZ4HC codecs.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3031|      0|    return BLOSC2_ERROR_CODEC_PARAM;
 3032|      0|  }
 3033|       |
 3034|  31.1k|  blosc2_calculate_blocks(context);
 3035|       |
 3036|  31.1k|  return 1;
 3037|  31.1k|}
blosc2.c:filters_to_flags:
  852|   216k|static uint8_t filters_to_flags(const uint8_t* filters) {
  853|   216k|  uint8_t flags = 0;
  854|       |
  855|  1.51M|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (855:19): [True: 1.30M, False: 216k]
  ------------------
  856|  1.30M|    switch (filters[i]) {
  857|   236k|      case BLOSC_SHUFFLE:
  ------------------
  |  Branch (857:7): [True: 236k, False: 1.06M]
  ------------------
  858|   236k|        flags |= BLOSC_DOSHUFFLE;
  859|   236k|        break;
  860|  56.7k|      case BLOSC_BITSHUFFLE:
  ------------------
  |  Branch (860:7): [True: 56.7k, False: 1.24M]
  ------------------
  861|  56.7k|        flags |= BLOSC_DOBITSHUFFLE;
  862|  56.7k|        break;
  863|  86.4k|      case BLOSC_DELTA:
  ------------------
  |  Branch (863:7): [True: 86.4k, False: 1.21M]
  ------------------
  864|  86.4k|        flags |= BLOSC_DODELTA;
  865|  86.4k|        break;
  866|   921k|      default :
  ------------------
  |  Branch (866:7): [True: 921k, False: 379k]
  ------------------
  867|   921k|        break;
  868|  1.30M|    }
  869|  1.30M|  }
  870|   216k|  return flags;
  871|   216k|}
blosc2.c:blosc2_calculate_blocks:
 1042|   217k|static inline void blosc2_calculate_blocks(blosc2_context* context) {
 1043|       |  /* Compute number of blocks in buffer */
 1044|   217k|  context->nblocks = context->sourcesize / context->blocksize;
 1045|   217k|  context->leftover = context->sourcesize % context->blocksize;
 1046|   217k|  context->nblocks = (context->leftover > 0) ?
  ------------------
  |  Branch (1046:22): [True: 107k, False: 109k]
  ------------------
 1047|   109k|                     (context->nblocks + 1) : context->nblocks;
 1048|   217k|}
blosc2.c:blosc_run_decompression_with_context:
 4515|   108k|                                                void* dest, int32_t destsize) {
 4516|   108k|  blosc_header header;
 4517|   108k|  int32_t ntbytes;
 4518|   108k|  int rc;
 4519|       |
 4520|   108k|  rc = read_chunk_header(src, srcsize, true, &header);
 4521|   108k|  if (rc < 0) {
  ------------------
  |  Branch (4521:7): [True: 17, False: 108k]
  ------------------
 4522|     17|    return rc;
 4523|     17|  }
 4524|       |
 4525|   108k|  if (header.nbytes > destsize) {
  ------------------
  |  Branch (4525:7): [True: 0, False: 108k]
  ------------------
 4526|       |    // Not enough space for writing into the destination
 4527|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 4528|      0|  }
 4529|       |
 4530|   108k|  rc = initialize_context_decompression(context, &header, src, srcsize, dest, destsize);
 4531|   108k|  if (rc < 0) {
  ------------------
  |  Branch (4531:7): [True: 672, False: 107k]
  ------------------
 4532|    672|    return rc;
 4533|    672|  }
 4534|       |
 4535|       |  /* Do the actual decompression */
 4536|   107k|  ntbytes = do_job(context);
 4537|   107k|  if (ntbytes < 0) {
  ------------------
  |  Branch (4537:7): [True: 5.39k, False: 102k]
  ------------------
 4538|  5.39k|    return ntbytes;
 4539|  5.39k|  }
 4540|       |
 4541|   107k|  assert(ntbytes <= (int32_t)destsize);
 4542|   102k|  return ntbytes;
 4543|   107k|}
blosc2.c:initialize_context_decompression:
 3206|   108k|                                            int32_t srcsize, void* dest, int32_t destsize) {
 3207|   108k|  int32_t bstarts_end;
 3208|   108k|  bool vlblocks;
 3209|       |
 3210|   108k|  context->do_compress = 0;
 3211|   108k|  context->src = (const uint8_t*)src;
 3212|   108k|  context->srcsize = srcsize;
 3213|   108k|  context->dest = (uint8_t*)dest;
 3214|   108k|  context->destsize = destsize;
 3215|   108k|  context->output_bytes = 0;
 3216|   108k|  context->vlblock_sources = NULL;
 3217|   108k|  context->vlblock_dests = NULL;
 3218|   108k|  if (context->blocknbytes != NULL) {
  ------------------
  |  Branch (3218:7): [True: 0, False: 108k]
  ------------------
 3219|      0|    free(context->blocknbytes);
 3220|      0|    context->blocknbytes = NULL;
 3221|      0|  }
 3222|   108k|  if (context->blockoffsets != NULL) {
  ------------------
  |  Branch (3222:7): [True: 0, False: 108k]
  ------------------
 3223|      0|    free(context->blockoffsets);
 3224|      0|    context->blockoffsets = NULL;
 3225|      0|  }
 3226|   108k|  if (context->blockcbytes != NULL) {
  ------------------
  |  Branch (3226:7): [True: 0, False: 108k]
  ------------------
 3227|      0|    free(context->blockcbytes);
 3228|      0|    context->blockcbytes = NULL;
 3229|      0|  }
 3230|       |
 3231|   108k|  int rc = blosc2_initialize_context_from_header(context, header);
 3232|   108k|  if (rc < 0) {
  ------------------
  |  Branch (3232:7): [True: 0, False: 108k]
  ------------------
 3233|      0|    return rc;
 3234|      0|  }
 3235|   108k|  clear_context_decompression_dict(context);
 3236|   108k|  vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 3237|   108k|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (3237:19): [True: 108k, False: 530]
  ------------------
 3238|   108k|                  (context->blosc2_flags & 0x08u));
  ------------------
  |  Branch (3238:19): [True: 2.67k, False: 105k]
  ------------------
 3239|       |
 3240|       |  /* Check that we have enough space to decompress */
 3241|   108k|  if (context->sourcesize > (int32_t)context->destsize) {
  ------------------
  |  Branch (3241:7): [True: 0, False: 108k]
  ------------------
 3242|      0|    return BLOSC2_ERROR_WRITE_BUFFER;
 3243|      0|  }
 3244|       |
 3245|   108k|  if (context->block_maskout != NULL) {
  ------------------
  |  Branch (3245:7): [True: 0, False: 108k]
  ------------------
 3246|      0|    if (context->block_maskout_nitems != context->nblocks) {
  ------------------
  |  Branch (3246:9): [True: 0, False: 0]
  ------------------
 3247|      0|      BLOSC_TRACE_ERROR("The number of items in block_maskout (%d) must match the number"
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3248|      0|                        " of blocks in chunk (%d).",
 3249|      0|                        context->block_maskout_nitems, context->nblocks);
 3250|      0|      return BLOSC2_ERROR_DATA;
 3251|      0|    }
 3252|      0|    if (filters_contain(context->filters, BLOSC_DELTA)) {
  ------------------
  |  Branch (3252:9): [True: 0, False: 0]
  ------------------
 3253|      0|      bool any_needed = false;
 3254|      0|      for (int i = 0; i < context->block_maskout_nitems; ++i) {
  ------------------
  |  Branch (3254:23): [True: 0, False: 0]
  ------------------
 3255|      0|        if (!context->block_maskout[i]) {
  ------------------
  |  Branch (3255:13): [True: 0, False: 0]
  ------------------
 3256|      0|          any_needed = true;
 3257|      0|          break;
 3258|      0|        }
 3259|      0|      }
 3260|      0|      if (any_needed) {
  ------------------
  |  Branch (3260:11): [True: 0, False: 0]
  ------------------
 3261|       |        // Delta filter encodes subsequent blocks relative to block 0; block 0 must be unmasked.
 3262|      0|        context->block_maskout[0] = false;
 3263|      0|      }
 3264|      0|    }
 3265|      0|  }
 3266|       |
 3267|   108k|  context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
 3268|   108k|  if (context->special_type > BLOSC2_SPECIAL_LASTID) {
  ------------------
  |  Branch (3268:7): [True: 0, False: 108k]
  ------------------
 3269|      0|    BLOSC_TRACE_ERROR("Unknown special values ID (%d) ",
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3270|      0|                      context->special_type);
 3271|      0|    return BLOSC2_ERROR_DATA;
 3272|      0|  }
 3273|       |
 3274|   108k|  int memcpyed = (context->header_flags & (uint8_t) BLOSC_MEMCPYED);
 3275|   108k|  if (memcpyed && (header->cbytes != header->nbytes + context->header_overhead)) {
  ------------------
  |  Branch (3275:7): [True: 659, False: 107k]
  |  Branch (3275:19): [True: 25, False: 634]
  ------------------
 3276|     25|    BLOSC_TRACE_ERROR("Wrong header info for this memcpyed chunk");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3277|     25|    return BLOSC2_ERROR_DATA;
 3278|     25|  }
 3279|       |
 3280|   108k|  if ((header->nbytes == 0) && (header->cbytes == context->header_overhead) &&
  ------------------
  |  Branch (3280:7): [True: 96, False: 108k]
  |  Branch (3280:32): [True: 46, False: 50]
  ------------------
 3281|     46|      !context->special_type) {
  ------------------
  |  Branch (3281:7): [True: 24, False: 22]
  ------------------
 3282|       |    // A compressed buffer with only a header can only contain a zero-length buffer
 3283|     24|    return 0;
 3284|     24|  }
 3285|       |
 3286|   108k|  context->bstarts = (int32_t *) (context->src + context->header_overhead);
 3287|   108k|  bstarts_end = context->header_overhead;
 3288|   108k|  if (!context->special_type && !memcpyed) {
  ------------------
  |  Branch (3288:7): [True: 70.4k, False: 38.1k]
  |  Branch (3288:33): [True: 69.8k, False: 574]
  ------------------
 3289|  69.8k|    size_t bstarts_end_tmp;
 3290|  69.8k|    size_t bstarts_nbytes;
 3291|  69.8k|    if (context->nblocks < 0 ||
  ------------------
  |  Branch (3291:9): [True: 23, False: 69.8k]
  ------------------
 3292|  69.8k|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (3292:9): [True: 0, False: 69.8k]
  ------------------
 3293|  69.8k|        !blosc2_checked_add_size((size_t)context->header_overhead, bstarts_nbytes, &bstarts_end_tmp) ||
  ------------------
  |  Branch (3293:9): [True: 0, False: 69.8k]
  ------------------
 3294|  69.8k|        bstarts_end_tmp > (size_t)INT32_MAX) {
  ------------------
  |  Branch (3294:9): [True: 0, False: 69.8k]
  ------------------
 3295|     23|      BLOSC_TRACE_ERROR("Invalid bstarts size in chunk header.");
  ------------------
  |  |   93|     23|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     23|    do {                                            \
  |  |  |  |   98|     23|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     23|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 23, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     23|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3296|     23|      return BLOSC2_ERROR_INVALID_HEADER;
 3297|     23|    }
 3298|       |    /* If chunk is not special or a memcpyed, we do have a bstarts section */
 3299|  69.8k|    bstarts_end = (int32_t)bstarts_end_tmp;
 3300|  69.8k|  }
 3301|       |
 3302|   108k|  if (srcsize < bstarts_end) {
  ------------------
  |  Branch (3302:7): [True: 7, False: 108k]
  ------------------
 3303|      7|    BLOSC_TRACE_ERROR("`bstarts` exceeds length of source buffer.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3304|      7|    return BLOSC2_ERROR_READ_BUFFER;
 3305|      7|  }
 3306|       |
 3307|   108k|  if (vlblocks && is_lazy && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (3307:7): [True: 36, False: 108k]
  |  Branch (3307:19): [True: 22, False: 14]
  |  Branch (3307:30): [True: 22, False: 0]
  |  Branch (3307:56): [True: 22, False: 0]
  ------------------
 3308|     22|    size_t block_csizes_nbytes;
 3309|     22|    size_t trailer_meta_nbytes;
 3310|     22|    size_t lazy_trailer_end;
 3311|     22|    if (context->srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (3311:9): [True: 0, False: 22]
  |  Branch (3311:33): [True: 0, False: 22]
  ------------------
 3312|     22|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (3312:9): [True: 0, False: 22]
  ------------------
 3313|     22|        !blosc2_checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (3313:9): [True: 0, False: 22]
  ------------------
 3314|     22|        !blosc2_checked_add_size((size_t)bstarts_end, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (3314:9): [True: 0, False: 22]
  ------------------
 3315|     22|        (size_t)context->srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (3315:9): [True: 0, False: 22]
  ------------------
 3316|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3317|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3318|      0|    }
 3319|     22|  }
 3320|   108k|  srcsize -= bstarts_end;
 3321|       |
 3322|       |  /* Read optional dictionary if flag set.  A memcpyed chunk has none, even if the flag says so
 3323|       |     (older versions left it on chunks with a dictionary that did not compress) */
 3324|   108k|  if ((context->blosc2_flags & BLOSC2_USEDICT) && !memcpyed && !is_lazy) {
  ------------------
  |  Branch (3324:7): [True: 7.41k, False: 101k]
  |  Branch (3324:51): [True: 7.37k, False: 43]
  |  Branch (3324:64): [True: 7.19k, False: 183]
  ------------------
 3325|  7.19k|    context->use_dict = 1;
 3326|       |    // The dictionary section is after the bstarts block: [int32 size | raw bytes]
 3327|  7.19k|    if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (3327:9): [True: 1, False: 7.18k]
  ------------------
 3328|      1|      BLOSC_TRACE_ERROR("Not enough space to read size of dictionary.");
  ------------------
  |  |   93|      1|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      1|    do {                                            \
  |  |  |  |   98|      1|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      1|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      1|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3329|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3330|      1|    }
 3331|  7.18k|    srcsize -= sizeof(int32_t);
 3332|       |    // Read dictionary size
 3333|  7.18k|    context->dict_size = sw32_(context->src + bstarts_end);
 3334|  7.18k|    if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (3334:9): [True: 1, False: 7.18k]
  |  Branch (3334:36): [True: 4, False: 7.18k]
  ------------------
 3335|      5|      BLOSC_TRACE_ERROR("Dictionary size is smaller than minimum or larger than maximum allowed.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3336|      5|      return BLOSC2_ERROR_CODEC_DICT;
 3337|      5|    }
 3338|  7.18k|    if (srcsize < (int32_t)context->dict_size) {
  ------------------
  |  Branch (3338:9): [True: 3, False: 7.18k]
  ------------------
 3339|      3|      BLOSC_TRACE_ERROR("Not enough space to read entire dictionary.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3340|      3|      return BLOSC2_ERROR_READ_BUFFER;
 3341|      3|    }
 3342|  7.18k|    srcsize -= context->dict_size;
 3343|       |    // dict_buffer points directly into the source chunk — no copy needed
 3344|  7.18k|    context->dict_buffer = (void*)(context->src + bstarts_end + sizeof(int32_t));
 3345|  7.18k|    context->dict_buffer_owned = false;
 3346|  7.18k|#if defined(HAVE_ZSTD)
 3347|       |    // context->compcode during decompression holds the format code (flags >> 5),
 3348|       |    // so compare against BLOSC_ZSTD_FORMAT (not BLOSC_ZSTD).
 3349|  7.18k|    if (context->compcode == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (3349:9): [True: 6.14k, False: 1.03k]
  ------------------
 3350|  6.14k|      context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 3351|  6.14k|      if (context->dict_ddict == NULL) {
  ------------------
  |  Branch (3351:11): [True: 392, False: 5.75k]
  ------------------
 3352|    392|        BLOSC_TRACE_ERROR("Cannot create ZSTD dictionary for chunk.");
  ------------------
  |  |   93|    392|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    392|    do {                                            \
  |  |  |  |   98|    392|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    392|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 392, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    392|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3353|    392|        return BLOSC2_ERROR_CODEC_DICT;
 3354|    392|      }
 3355|  6.14k|    }
 3356|  7.18k|#endif   // HAVE_ZSTD
 3357|       |    // For LZ4/LZ4HC: dict_buffer and dict_size are sufficient; no digested object needed.
 3358|  7.18k|  }
 3359|   101k|  else if ((context->blosc2_flags & BLOSC2_USEDICT) && !memcpyed && is_lazy) {
  ------------------
  |  Branch (3359:12): [True: 226, False: 101k]
  |  Branch (3359:56): [True: 183, False: 43]
  |  Branch (3359:69): [True: 183, False: 0]
  ------------------
 3360|    183|    rc = load_lazy_chunk_dict(context, header, bstarts_end);
 3361|    183|    if (rc < 0) {
  ------------------
  |  Branch (3361:9): [True: 183, False: 0]
  ------------------
 3362|    183|      return rc;
 3363|    183|    }
 3364|    183|  }
 3365|       |
 3366|   107k|  if (vlblocks && !context->special_type && !memcpyed) {
  ------------------
  |  Branch (3366:7): [True: 36, False: 107k]
  |  Branch (3366:19): [True: 36, False: 0]
  |  Branch (3366:45): [True: 36, False: 0]
  ------------------
 3367|     36|    context->blocknbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 3368|     36|    BLOSC_ERROR_NULL(context->blocknbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     36|    do {                                            \
  |  |  105|     36|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 36]
  |  |  ------------------
  |  |  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|     36|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 36]
  |  |  ------------------
  ------------------
 3369|     36|    context->blockoffsets = malloc((size_t)context->nblocks * sizeof(int32_t));
 3370|     36|    BLOSC_ERROR_NULL(context->blockoffsets, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     36|    do {                                            \
  |  |  105|     36|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 36]
  |  |  ------------------
  |  |  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|     36|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 36]
  |  |  ------------------
  ------------------
 3371|     36|    context->blockcbytes = malloc((size_t)context->nblocks * sizeof(int32_t));
 3372|     36|    BLOSC_ERROR_NULL(context->blockcbytes, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|     36|    do {                                            \
  |  |  105|     36|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 36]
  |  |  ------------------
  |  |  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|     36|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 36]
  |  |  ------------------
  ------------------
 3373|       |
 3374|     36|    if (is_lazy) {
  ------------------
  |  Branch (3374:9): [True: 22, False: 14]
  ------------------
 3375|       |      // Lazy VL: block data is on disk, so blocknbytes is unknown at this point.
 3376|       |      // Populate blockcbytes from bstarts differences; blocksize gets max(blockcbytes)
 3377|       |      // as a safe upper bound so tmp buffers are large enough for the lazy block read.
 3378|     22|      int32_t max_csize = 0;
 3379|     33|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (3379:27): [True: 30, False: 3]
  ------------------
 3380|     30|        int32_t bstart = sw32_(context->bstarts + i);
 3381|     30|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (3381:31): [True: 27, False: 3]
  ------------------
 3382|     27|            sw32_(context->bstarts + i + 1) : header->cbytes;
 3383|     30|        if (bstart < bstarts_end || next_bstart <= bstart ||
  ------------------
  |  Branch (3383:13): [True: 1, False: 29]
  |  Branch (3383:37): [True: 5, False: 24]
  ------------------
 3384|     24|            next_bstart > header->cbytes) {
  ------------------
  |  Branch (3384:13): [True: 13, False: 11]
  ------------------
 3385|     19|          BLOSC_TRACE_ERROR("Invalid VL-block offsets in lazy chunk.");
  ------------------
  |  |   93|     19|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     19|    do {                                            \
  |  |  |  |   98|     19|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     19|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 19, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     19|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3386|     19|          return BLOSC2_ERROR_INVALID_HEADER;
 3387|     19|        }
 3388|     11|        context->blocknbytes[i] = 0;   // unknown until block is read from disk
 3389|     11|        context->blockoffsets[i] = 0;  // unknown
 3390|     11|        context->blockcbytes[i] = next_bstart - bstart;
 3391|     11|        if (context->blockcbytes[i] > max_csize) {
  ------------------
  |  Branch (3391:13): [True: 10, False: 1]
  ------------------
 3392|     10|          max_csize = context->blockcbytes[i];
 3393|     10|        }
 3394|     11|      }
 3395|      3|      context->blocksize = max_csize;
 3396|      3|      context->leftover = 0;
 3397|      3|    }
 3398|     14|    else {
 3399|     14|      int32_t max_blocksize = 0;
 3400|     14|      int64_t total_nbytes = 0;
 3401|     14|      int32_t prev_bstart = 0;
 3402|     19|      for (int32_t i = 0; i < context->nblocks; ++i) {
  ------------------
  |  Branch (3402:27): [True: 19, False: 0]
  ------------------
 3403|     19|        int32_t bstart = sw32_(context->bstarts + i);
 3404|     19|        int32_t next_bstart = (i + 1 < context->nblocks) ?
  ------------------
  |  Branch (3404:31): [True: 17, False: 2]
  ------------------
 3405|     17|            sw32_(context->bstarts + i + 1) : header->cbytes;
 3406|     19|        if (bstart < bstarts_end || bstart <= prev_bstart || next_bstart <= bstart ||
  ------------------
  |  Branch (3406:13): [True: 0, False: 19]
  |  Branch (3406:37): [True: 0, False: 19]
  |  Branch (3406:62): [True: 0, False: 19]
  ------------------
 3407|     19|            next_bstart > header->cbytes || bstart > context->srcsize - (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (3407:13): [True: 12, False: 7]
  |  Branch (3407:45): [True: 0, False: 7]
  ------------------
 3408|     12|          BLOSC_TRACE_ERROR("Invalid VL-block offsets in chunk.");
  ------------------
  |  |   93|     12|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     12|    do {                                            \
  |  |  |  |   98|     12|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     12|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 12, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     12|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3409|     12|          return BLOSC2_ERROR_INVALID_HEADER;
 3410|     12|        }
 3411|      7|        context->blocknbytes[i] = sw32_(context->src + bstart);
 3412|      7|        context->blockcbytes[i] = next_bstart - bstart;
 3413|      7|        if (context->blocknbytes[i] <= 0) {
  ------------------
  |  Branch (3413:13): [True: 1, False: 6]
  ------------------
 3414|      1|          BLOSC_TRACE_ERROR("Invalid VL-block uncompressed size 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3415|      1|          return BLOSC2_ERROR_INVALID_HEADER;
 3416|      1|        }
 3417|      6|        if (total_nbytes > INT32_MAX) {
  ------------------
  |  Branch (3417:13): [True: 0, False: 6]
  ------------------
 3418|      0|          BLOSC_TRACE_ERROR("Invalid VL-block cumulative size in chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3419|      0|          return BLOSC2_ERROR_INVALID_HEADER;
 3420|      0|        }
 3421|      6|        context->blockoffsets[i] = (int32_t)total_nbytes;
 3422|      6|        total_nbytes += context->blocknbytes[i];
 3423|      6|        if (total_nbytes > context->sourcesize) {
  ------------------
  |  Branch (3423:13): [True: 1, False: 5]
  ------------------
 3424|      1|          BLOSC_TRACE_ERROR("VL-block sizes exceed chunk nbytes.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3425|      1|          return BLOSC2_ERROR_INVALID_HEADER;
 3426|      1|        }
 3427|      5|        if (context->blocknbytes[i] > max_blocksize) {
  ------------------
  |  Branch (3427:13): [True: 4, False: 1]
  ------------------
 3428|      4|          max_blocksize = context->blocknbytes[i];
 3429|      4|        }
 3430|      5|        prev_bstart = bstart;
 3431|      5|      }
 3432|      0|      if (total_nbytes != context->sourcesize) {
  ------------------
  |  Branch (3432:11): [True: 0, False: 0]
  ------------------
 3433|      0|        BLOSC_TRACE_ERROR("VL-block sizes do not add up to chunk nbytes.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3434|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 3435|      0|      }
 3436|      0|      context->blocksize = max_blocksize;
 3437|      0|      context->leftover = 0;
 3438|      0|    }
 3439|     36|  }
 3440|       |
 3441|   107k|  return 0;
 3442|   107k|}
blosc2.c:load_lazy_chunk_dict:
 3152|    183|static int load_lazy_chunk_dict(blosc2_context* context, blosc_header* header, int32_t bstarts_end) {
 3153|    183|  int32_t dict_offset = bstarts_end;
 3154|    183|  if (header->cbytes < dict_offset + (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (3154:7): [True: 0, False: 183]
  ------------------
 3155|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3156|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3157|      0|  }
 3158|       |
 3159|    183|  uint8_t dict_size_buf[sizeof(int32_t)];
 3160|    183|  int rc = read_lazy_chunk_bytes(context, dict_offset, dict_size_buf, (int32_t)sizeof(dict_size_buf),
 3161|    183|                                 "Cannot open frame file for lazy chunk dictionary read.",
 3162|    183|                                 "Cannot read lazy chunk dictionary size from disk.");
 3163|    183|  if (rc < 0) {
  ------------------
  |  Branch (3163:7): [True: 183, False: 0]
  ------------------
 3164|    183|    return rc;
 3165|    183|  }
 3166|       |
 3167|      0|  context->dict_size = sw32_(dict_size_buf);
 3168|      0|  if (context->dict_size <= 0 || context->dict_size > BLOSC2_MAXDICTSIZE) {
  ------------------
  |  Branch (3168:7): [True: 0, False: 0]
  |  Branch (3168:34): [True: 0, False: 0]
  ------------------
 3169|      0|    BLOSC_TRACE_ERROR("Dictionary size is smaller than minimum or larger than maximum allowed.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3170|      0|    return BLOSC2_ERROR_CODEC_DICT;
 3171|      0|  }
 3172|      0|  if (header->cbytes < dict_offset + (int32_t)sizeof(int32_t) + context->dict_size) {
  ------------------
  |  Branch (3172:7): [True: 0, False: 0]
  ------------------
 3173|      0|    BLOSC_TRACE_ERROR("Lazy chunk dictionary exceeds chunk length.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3174|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3175|      0|  }
 3176|       |
 3177|      0|  context->dict_buffer = malloc((size_t)context->dict_size);
 3178|      0|  BLOSC_ERROR_NULL(context->dict_buffer, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|      0|    do {                                            \
  |  |  105|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3179|      0|  context->dict_buffer_owned = true;
 3180|      0|  rc = read_lazy_chunk_bytes(context, dict_offset + (int32_t)sizeof(int32_t),
 3181|      0|                             context->dict_buffer, context->dict_size,
 3182|      0|                             "Cannot open frame file for lazy chunk dictionary read.",
 3183|      0|                             "Cannot read lazy chunk dictionary from disk.");
 3184|      0|  if (rc < 0) {
  ------------------
  |  Branch (3184:7): [True: 0, False: 0]
  ------------------
 3185|      0|    release_context_dict_buffer(context);
 3186|      0|    return rc;
 3187|      0|  }
 3188|       |
 3189|      0|  context->use_dict = 1;
 3190|      0|#if defined(HAVE_ZSTD)
 3191|      0|  if (context->compcode == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (3191:7): [True: 0, False: 0]
  ------------------
 3192|      0|    context->dict_ddict = ZSTD_createDDict(context->dict_buffer, context->dict_size);
 3193|      0|    if (context->dict_ddict == NULL) {
  ------------------
  |  Branch (3193:9): [True: 0, False: 0]
  ------------------
 3194|      0|      release_context_dict_buffer(context);
 3195|      0|      BLOSC_TRACE_ERROR("Cannot create ZSTD dictionary for lazy chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3196|      0|      return BLOSC2_ERROR_CODEC_DICT;
 3197|      0|    }
 3198|      0|  }
 3199|      0|#endif
 3200|       |
 3201|      0|  return 0;
 3202|      0|}
blosc2.c:do_job:
 2836|   107k|static int do_job(blosc2_context* context) {
 2837|   107k|  int32_t ntbytes;
 2838|       |
 2839|       |  /* Set sentinels */
 2840|   107k|  context->dref_not_init = 1;
 2841|       |
 2842|       |  /* Apply thread-count changes before deciding whether this operation actually
 2843|       |     needs a parallel backend.  POSIX defers backend startup for serial jobs.
 2844|       |     Windows keeps its existing per-context thread lifecycle and starts/rebinds
 2845|       |     the backend eagerly. */
 2846|       |#if defined(_WIN32)
 2847|       |  int rc = check_nthreads(context, true);
 2848|       |#else
 2849|   107k|  int rc = check_nthreads(context, false);
 2850|   107k|#endif
 2851|       |
 2852|       |  /* Run serially with one thread, with fewer than two full blocks of source
 2853|       |     data, or if thread configuration/backend setup fails. */
 2854|   107k|  if (context->nthreads == 1 || (context->sourcesize / context->blocksize) <= 1 || rc < 0) {
  ------------------
  |  Branch (2854:7): [True: 107k, False: 0]
  |  Branch (2854:33): [True: 0, False: 0]
  |  Branch (2854:84): [True: 0, False: 0]
  ------------------
 2855|   107k|    ntbytes = run_serial_job(context);
 2856|   107k|  }
 2857|      0|  else {
 2858|      0|    rc = check_nthreads(context, true);
 2859|      0|    if (rc < 0) {
  ------------------
  |  Branch (2859:9): [True: 0, False: 0]
  ------------------
 2860|       |      /* Backend startup failed; run serially and retry on the next parallel job. */
 2861|      0|      ntbytes = run_serial_job(context);
 2862|      0|    }
 2863|      0|    else {
 2864|      0|      ntbytes = parallel_blosc(context);
 2865|      0|    }
 2866|      0|  }
 2867|       |
 2868|   107k|  return ntbytes;
 2869|   107k|}
blosc2.c:run_serial_job:
 2824|   107k|static int run_serial_job(blosc2_context* context) {
 2825|   107k|  struct thread_context* thread_context = serial_context_get(context);
 2826|   107k|  if (thread_context == NULL) {
  ------------------
  |  Branch (2826:7): [True: 0, False: 107k]
  ------------------
 2827|      0|    return BLOSC2_ERROR_THREAD_CREATE;
 2828|      0|  }
 2829|   107k|  int ntbytes = serial_blosc(thread_context);
 2830|   107k|  serial_context_put(thread_context);
 2831|   107k|  return ntbytes;
 2832|   107k|}
blosc2.c:serial_blosc:
 2571|   107k|static int serial_blosc(struct thread_context* thread_context) {
 2572|   107k|  blosc2_context* context = thread_context->parent_context;
 2573|   107k|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2574|   107k|  int32_t j, bsize, leftoverblock;
 2575|   107k|  int32_t cbytes;
 2576|   107k|  int32_t ntbytes = context->output_bytes;
 2577|   107k|  int32_t* bstarts = context->bstarts;
 2578|   107k|  uint8_t* tmp = thread_context->tmp;
 2579|   107k|  uint8_t* tmp2 = thread_context->tmp2;
 2580|   107k|  int dict_training = context->use_dict && (context->dict_cdict == NULL);
  ------------------
  |  Branch (2580:23): [True: 6.78k, False: 101k]
  |  Branch (2580:44): [True: 6.78k, False: 0]
  ------------------
 2581|   107k|  bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
 2582|   107k|  if (!context->do_compress && context->special_type) {
  ------------------
  |  Branch (2582:7): [True: 107k, False: 0]
  |  Branch (2582:32): [True: 37.7k, False: 70.2k]
  ------------------
 2583|       |    // Fake a runlen as if it was a memcpyed chunk
 2584|  37.7k|    memcpyed = true;
 2585|  37.7k|  }
 2586|       |
 2587|  49.8M|  for (j = 0; j < context->nblocks; j++) {
  ------------------
  |  Branch (2587:15): [True: 49.7M, False: 102k]
  ------------------
 2588|  49.7M|    if (context->do_compress && !memcpyed && !dict_training) {
  ------------------
  |  Branch (2588:9): [True: 0, False: 49.7M]
  |  Branch (2588:33): [True: 0, False: 0]
  |  Branch (2588:46): [True: 0, False: 0]
  ------------------
 2589|      0|      _sw32(bstarts + j, ntbytes);
 2590|      0|    }
 2591|  49.7M|    bsize = vlblocks ? context->blocknbytes[j] : context->blocksize;
  ------------------
  |  Branch (2591:13): [True: 3, False: 49.7M]
  ------------------
 2592|  49.7M|    leftoverblock = 0;
 2593|  49.7M|    if (!vlblocks && (j == context->nblocks - 1) && (context->leftover > 0)) {
  ------------------
  |  Branch (2593:9): [True: 49.7M, False: 3]
  |  Branch (2593:22): [True: 104k, False: 49.6M]
  |  Branch (2593:53): [True: 61.4k, False: 43.0k]
  ------------------
 2594|  61.4k|      bsize = context->leftover;
 2595|  61.4k|      leftoverblock = 1;
 2596|  61.4k|    }
 2597|  49.7M|    if (context->do_compress) {
  ------------------
  |  Branch (2597:9): [True: 0, False: 49.7M]
  ------------------
 2598|      0|      if (memcpyed && !context->prefilter) {
  ------------------
  |  Branch (2598:11): [True: 0, False: 0]
  |  Branch (2598:23): [True: 0, False: 0]
  ------------------
 2599|       |        /* We want to memcpy only */
 2600|      0|        memcpy(context->dest + context->header_overhead + j * context->blocksize,
 2601|      0|               context->src + j * context->blocksize, (unsigned int)bsize);
 2602|      0|        cbytes = (int32_t)bsize;
 2603|      0|      }
 2604|      0|      else {
 2605|       |        /* Regular compression */
 2606|      0|        cbytes = blosc_c(thread_context, bsize, leftoverblock, ntbytes,
 2607|      0|                         context->destsize,
 2608|      0|                         vlblocks ? context->vlblock_sources[j] : context->src,
  ------------------
  |  Branch (2608:26): [True: 0, False: 0]
  ------------------
 2609|      0|                         vlblocks ? 0 : j * context->blocksize,
  ------------------
  |  Branch (2609:26): [True: 0, False: 0]
  ------------------
 2610|      0|                         context->dest + ntbytes, tmp, tmp2);
 2611|      0|        if (cbytes == 0) {
  ------------------
  |  Branch (2611:13): [True: 0, False: 0]
  ------------------
 2612|      0|          ntbytes = 0;              /* incompressible data */
 2613|      0|          break;
 2614|      0|        }
 2615|      0|      }
 2616|      0|    }
 2617|  49.7M|    else {
 2618|       |      /* Regular decompression */
 2619|       |      // If memcpyed we don't have a bstarts section (because it is not needed)
 2620|  49.7M|      int32_t src_offset = memcpyed ?
  ------------------
  |  Branch (2620:28): [True: 49.5M, False: 125k]
  ------------------
 2621|  49.5M|          context->header_overhead + j * context->blocksize : sw32_(bstarts + j);
 2622|  49.7M|      uint8_t *dest_block = (vlblocks && context->vlblock_dests != NULL) ? context->vlblock_dests[j] : context->dest;
  ------------------
  |  Branch (2622:30): [True: 3, False: 49.7M]
  |  Branch (2622:42): [True: 0, False: 3]
  ------------------
 2623|  49.7M|      int32_t dest_offset = (vlblocks && context->vlblock_dests != NULL) ? 0 :
  ------------------
  |  Branch (2623:30): [True: 3, False: 49.7M]
  |  Branch (2623:42): [True: 0, False: 3]
  ------------------
 2624|  49.7M|                            (vlblocks ? context->blockoffsets[j] : j * context->blocksize);
  ------------------
  |  Branch (2624:30): [True: 3, False: 49.7M]
  ------------------
 2625|  49.7M|      cbytes = blosc_d(thread_context, bsize, leftoverblock, memcpyed,
 2626|  49.7M|                       context->src, context->srcsize, src_offset, j,
 2627|  49.7M|                       dest_block, dest_offset, tmp, tmp2);
 2628|  49.7M|    }
 2629|       |
 2630|  49.7M|    if (cbytes < 0) {
  ------------------
  |  Branch (2630:9): [True: 5.39k, False: 49.7M]
  ------------------
 2631|  5.39k|      ntbytes = cbytes;         /* error in blosc_c or blosc_d */
 2632|  5.39k|      break;
 2633|  5.39k|    }
 2634|  49.7M|    ntbytes += cbytes;
 2635|  49.7M|  }
 2636|       |
 2637|   107k|  return ntbytes;
 2638|   107k|}
blosc2.c:fit_thread_context:
 2764|   144k|static int fit_thread_context(struct thread_context* thread_context, blosc2_context* context) {
 2765|   144k|  int32_t ebsize = context->blocksize + context->typesize * (int32_t)sizeof(int32_t);
 2766|   144k|  if ((size_t)4 * ebsize <= thread_context->tmp_nbytes) {
  ------------------
  |  Branch (2766:7): [True: 143k, False: 600]
  ------------------
 2767|   143k|    return 0;
 2768|   143k|  }
 2769|    600|  my_free(thread_context->tmp);
 2770|    600|  thread_context->tmp = my_malloc((size_t)4 * ebsize);
 2771|    600|  if (thread_context->tmp == NULL) {
  ------------------
  |  Branch (2771:7): [True: 0, False: 600]
  ------------------
 2772|      0|    thread_context->tmp_nbytes = 0;
 2773|      0|    thread_context->tmp_blocksize = 0;
 2774|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2775|      0|  }
 2776|    600|  thread_context->tmp_nbytes = (size_t)4 * ebsize;
 2777|    600|  thread_context->tmp2 = thread_context->tmp + ebsize;
 2778|    600|  thread_context->tmp3 = thread_context->tmp2 + ebsize;
 2779|    600|  thread_context->tmp4 = thread_context->tmp3 + ebsize;
 2780|    600|  thread_context->tmp_blocksize = context->blocksize;
 2781|    600|  return 0;
 2782|    600|}
blosc2.c:read_lazy_chunk_bytes:
 3064|    183|                                 const char* open_error, const char* read_error) {
 3065|    183|  int32_t chunk_cbytes;
 3066|    183|  if (context->src == NULL || context->srcsize < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3066:7): [True: 0, False: 183]
  |  Branch (3066:31): [True: 0, False: 183]
  ------------------
 3067|    183|      offset < 0 || nbytes < 0 || context->nblocks <= 0 ||
  ------------------
  |  Branch (3067:7): [True: 0, False: 183]
  |  Branch (3067:21): [True: 0, False: 183]
  |  Branch (3067:35): [True: 29, False: 154]
  ------------------
 3068|    154|      blosc2_cbuffer_sizes(context->src, NULL, &chunk_cbytes, NULL) < 0 ||
  ------------------
  |  Branch (3068:7): [True: 0, False: 154]
  ------------------
 3069|    154|      offset > chunk_cbytes || nbytes > chunk_cbytes - offset) {
  ------------------
  |  Branch (3069:7): [True: 0, False: 154]
  |  Branch (3069:32): [True: 0, False: 154]
  ------------------
 3070|     29|    return BLOSC2_ERROR_INVALID_HEADER;
 3071|     29|  }
 3072|    154|  int64_t trailer_end = BLOSC_EXTENDED_HEADER_LENGTH +
 3073|    154|      (int64_t)context->nblocks * sizeof(int32_t) + sizeof(int32_t) + sizeof(int64_t);
 3074|    154|  if (trailer_end > context->srcsize) return BLOSC2_ERROR_READ_BUFFER;
  ------------------
  |  Branch (3074:7): [True: 3, False: 151]
  ------------------
 3075|    151|  if (context->schunk == NULL || context->schunk->frame == NULL) {
  ------------------
  |  Branch (3075:7): [True: 5, False: 146]
  |  Branch (3075:34): [True: 0, False: 146]
  ------------------
 3076|      5|    BLOSC_TRACE_ERROR("Lazy chunk needs an associated super-chunk with a frame.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3077|      5|    return BLOSC2_ERROR_INVALID_PARAM;
 3078|      5|  }
 3079|       |
 3080|    146|  blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 3081|    146|  blosc2_io_cb* io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 3082|    146|  if (io_cb == NULL) {
  ------------------
  |  Branch (3082:7): [True: 0, False: 146]
  ------------------
 3083|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3084|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 3085|      0|  }
 3086|       |
 3087|    146|  int32_t trailer_offset = BLOSC_EXTENDED_HEADER_LENGTH +
 3088|    146|                           context->nblocks * (int32_t)sizeof(int32_t);
 3089|    146|  int32_t nchunk_lazy;
 3090|    146|  int64_t chunk_offset;
 3091|    146|  memcpy(&nchunk_lazy, context->src + trailer_offset, sizeof(nchunk_lazy));
 3092|    146|  memcpy(&chunk_offset, context->src + trailer_offset + (int32_t)sizeof(int32_t), sizeof(chunk_offset));
 3093|    146|  if (nchunk_lazy < 0 || chunk_offset < 0 || frame->file_offset < 0 ||
  ------------------
  |  Branch (3093:7): [True: 27, False: 119]
  |  Branch (3093:26): [True: 5, False: 114]
  |  Branch (3093:46): [True: 0, False: 114]
  ------------------
 3094|    114|      (!frame->sframe && (chunk_offset < FRAME_HEADER_MINLEN ||
  ------------------
  |  |   49|    228|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|    114|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    114|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|    114|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|    114|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|    114|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|    114|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|    114|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|    114|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|    114|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|    114|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|    114|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|    114|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|    114|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (3094:8): [True: 114, False: 0]
  |  Branch (3094:27): [True: 2, False: 112]
  ------------------
 3095|    128|       chunk_offset > frame->len || chunk_cbytes > frame->len - chunk_offset))) {
  ------------------
  |  Branch (3095:8): [True: 93, False: 19]
  |  Branch (3095:37): [True: 1, False: 18]
  ------------------
 3096|    128|    return BLOSC2_ERROR_INVALID_HEADER;
 3097|    128|  }
 3098|       |
 3099|     18|  void* fp = NULL;
 3100|     18|  int64_t io_pos;
 3101|     18|  if (frame->sframe) {
  ------------------
  |  Branch (3101:7): [True: 0, False: 18]
  ------------------
 3102|      0|    fp = sframe_open_chunk(frame->urlpath, nchunk_lazy, "rb", context->schunk->storage->io);
 3103|      0|    io_pos = offset;
 3104|      0|  }
 3105|     18|  else {
 3106|     18|    if (chunk_offset < 0 || offset < 0) {
  ------------------
  |  Branch (3106:9): [True: 0, False: 18]
  |  Branch (3106:29): [True: 0, False: 18]
  ------------------
 3107|      0|      BLOSC_TRACE_ERROR("Lazy chunk offset cannot be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3108|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3109|      0|    }
 3110|     18|    fp = frame_reader_acquire(frame, context->schunk->storage->io);
 3111|     18|    if (!blosc2_checked_add_i64(frame->file_offset, chunk_offset, &io_pos)) {
  ------------------
  |  Branch (3111:9): [True: 0, False: 18]
  ------------------
 3112|      0|      BLOSC_TRACE_ERROR("Lazy chunk offset overflows file position.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3113|      0|      if (fp != NULL) {
  ------------------
  |  Branch (3113:11): [True: 0, False: 0]
  ------------------
 3114|      0|        frame_reader_release(frame, io_cb, fp);
 3115|      0|      }
 3116|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3117|      0|    }
 3118|     18|    if (!blosc2_checked_add_i64(io_pos, offset, &io_pos)) {
  ------------------
  |  Branch (3118:9): [True: 0, False: 18]
  ------------------
 3119|      0|      BLOSC_TRACE_ERROR("Lazy block offset overflows file position.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3120|      0|      if (fp != NULL) {
  ------------------
  |  Branch (3120:11): [True: 0, False: 0]
  ------------------
 3121|      0|        frame_reader_release(frame, io_cb, fp);
 3122|      0|      }
 3123|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3124|      0|    }
 3125|     18|  }
 3126|     18|  if (fp == NULL) {
  ------------------
  |  Branch (3126:7): [True: 18, False: 0]
  ------------------
 3127|     18|    BLOSC_TRACE_ERROR("%s", open_error);
  ------------------
  |  |   93|     18|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     18|    do {                                            \
  |  |  |  |   98|     18|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     18|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 18, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     18|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3128|     18|    return BLOSC2_ERROR_FILE_OPEN;
 3129|     18|  }
 3130|      0|  if (!blosc2_checked_add_i64(io_pos, nbytes, NULL)) {
  ------------------
  |  Branch (3130:7): [True: 0, False: 0]
  ------------------
 3131|      0|    frame_reader_release(frame, io_cb, fp);
 3132|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 3133|      0|  }
 3134|       |
 3135|      0|  uint8_t* read_buffer = buffer;
 3136|      0|  int64_t rbytes = io_cb->read((void**)&read_buffer, 1, nbytes, io_pos, fp);
 3137|      0|  bool complete = rbytes == nbytes && read_buffer != NULL;
  ------------------
  |  Branch (3137:19): [True: 0, False: 0]
  |  Branch (3137:39): [True: 0, False: 0]
  ------------------
 3138|      0|  if (complete && read_buffer != buffer) {
  ------------------
  |  Branch (3138:7): [True: 0, False: 0]
  |  Branch (3138:19): [True: 0, False: 0]
  ------------------
 3139|       |    // An io that hands out its own memory (mmap) keeps owning it
 3140|      0|    memcpy(buffer, read_buffer, (size_t)nbytes);
 3141|      0|  }
 3142|      0|  frame_reader_release(frame, io_cb, fp);
 3143|      0|  if (!complete) {
  ------------------
  |  Branch (3143:7): [True: 0, False: 0]
  ------------------
 3144|      0|    BLOSC_TRACE_ERROR("%s", read_error);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3145|      0|    return BLOSC2_ERROR_FILE_READ;
 3146|      0|  }
 3147|       |
 3148|      0|  return 0;
 3149|      0|}
blosc2.c:serial_context_get:
 2796|   151k|static struct thread_context* serial_context_get(blosc2_context* context) {
 2797|   151k|  struct thread_context* thread_context = NULL;
 2798|   151k|  if (context->serial_context == NULL) {
  ------------------
  |  Branch (2798:7): [True: 150k, False: 85]
  ------------------
 2799|   150k|    thread_context = serial_context_take_tls(context);
 2800|   150k|  }
 2801|   151k|  if (thread_context == NULL) {
  ------------------
  |  Branch (2801:7): [True: 921, False: 150k]
  ------------------
 2802|    921|    if (context->serial_context != NULL &&
  ------------------
  |  Branch (2802:9): [True: 85, False: 836]
  ------------------
 2803|     85|        context->serial_context->tmp_blocksize != context->blocksize) {
  ------------------
  |  Branch (2803:9): [True: 23, False: 62]
  ------------------
 2804|     23|      free_thread_context(context->serial_context);
 2805|     23|      context->serial_context = NULL;
 2806|     23|    }
 2807|    921|    if (context->serial_context == NULL) {
  ------------------
  |  Branch (2807:9): [True: 859, False: 62]
  ------------------
 2808|    859|      context->serial_context = create_thread_context(context, 0);
 2809|    859|      if (context->serial_context == NULL) {
  ------------------
  |  Branch (2809:11): [True: 0, False: 859]
  ------------------
 2810|      0|        return NULL;
 2811|      0|      }
 2812|    859|    }
 2813|     62|    else if (fit_thread_context(context->serial_context, context) < 0) {
  ------------------
  |  Branch (2813:14): [True: 0, False: 62]
  ------------------
 2814|      0|      return NULL;
 2815|      0|    }
 2816|    921|    thread_context = context->serial_context;
 2817|    921|  }
 2818|   151k|  thread_context->parent_context = context;
 2819|   151k|  thread_context->tid = 0;
 2820|       |  thread_context->serial = true;
 2821|   151k|  return thread_context;
 2822|   151k|}
blosc2.c:serial_context_take_tls:
 6894|   150k|static struct thread_context* serial_context_take_tls(blosc2_context* context) {
 6895|   150k|#if !defined(_WIN32)
 6896|   150k|  int32_t ebsize = context->blocksize + context->typesize * (int32_t)sizeof(int32_t);
 6897|   150k|  if ((size_t)4 * ebsize > BLOSC2_SERIAL_TLS_MAX) {
  ------------------
  |  | 6817|   150k|#define BLOSC2_SERIAL_TLS_MAX (16 * 1024 * 1024)
  ------------------
  |  Branch (6897:7): [True: 836, False: 150k]
  ------------------
 6898|    836|    return NULL;
 6899|    836|  }
 6900|   150k|  tmp_cache_t *cache = tmp_cache_get(true);
 6901|   150k|  if (cache == NULL || cache->serial_busy) {
  ------------------
  |  Branch (6901:7): [True: 0, False: 150k]
  |  Branch (6901:24): [True: 0, False: 150k]
  ------------------
 6902|      0|    return NULL;
 6903|      0|  }
 6904|   150k|  if (cache->serial == NULL) {
  ------------------
  |  Branch (6904:7): [True: 5.69k, False: 144k]
  ------------------
 6905|  5.69k|    cache->serial = create_thread_context(context, 0);
 6906|  5.69k|    if (cache->serial == NULL) {
  ------------------
  |  Branch (6906:9): [True: 0, False: 5.69k]
  ------------------
 6907|      0|      return NULL;
 6908|      0|    }
 6909|  5.69k|  }
 6910|   144k|  else if (fit_thread_context(cache->serial, context) < 0) {
  ------------------
  |  Branch (6910:12): [True: 0, False: 144k]
  ------------------
 6911|      0|    return NULL;
 6912|      0|  }
 6913|   150k|  cache->serial_busy = true;
 6914|   150k|  return cache->serial;
 6915|       |#else
 6916|       |  BLOSC_UNUSED_PARAM(context);
 6917|       |  return NULL;
 6918|       |#endif
 6919|   150k|}
blosc2.c:create_thread_context:
 2676|  6.55k|create_thread_context(blosc2_context* context, int32_t tid) {
 2677|  6.55k|  struct thread_context* thread_context;
 2678|  6.55k|  thread_context = (struct thread_context*)my_malloc(sizeof(struct thread_context));
 2679|  6.55k|  BLOSC_ERROR_NULL(thread_context, NULL);
  ------------------
  |  |  104|  6.55k|    do {                                            \
  |  |  105|  6.55k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 6.55k]
  |  |  ------------------
  |  |  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|  6.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 6.55k]
  |  |  ------------------
  ------------------
 2680|  6.55k|  int rc = init_thread_context(thread_context, context, tid);
 2681|  6.55k|  if (rc < 0) {
  ------------------
  |  Branch (2681:7): [True: 0, False: 6.55k]
  ------------------
 2682|      0|    my_free(thread_context);
 2683|      0|    return NULL;
 2684|      0|  }
 2685|  6.55k|  return thread_context;
 2686|  6.55k|}
blosc2.c:init_thread_context:
 2644|  6.55k|{
 2645|  6.55k|  int32_t ebsize;
 2646|       |
 2647|  6.55k|  thread_context->parent_context = context;
 2648|  6.55k|  thread_context->owner_pool = NULL;
 2649|  6.55k|  thread_context->tid = tid;
 2650|  6.55k|  thread_context->serial = false;
 2651|  6.55k|  thread_context->blosclz_state = NULL;
 2652|       |
 2653|  6.55k|  int32_t blocksize = context != NULL ? context->blocksize : 0;
  ------------------
  |  Branch (2653:23): [True: 6.55k, False: 0]
  ------------------
 2654|  6.55k|  int32_t typesize = context != NULL ? context->typesize : 0;
  ------------------
  |  Branch (2654:22): [True: 6.55k, False: 0]
  ------------------
 2655|  6.55k|  ebsize = blocksize + typesize * (signed)sizeof(int32_t);
 2656|  6.55k|  thread_context->tmp_nbytes = (size_t)4 * ebsize;
 2657|  6.55k|  thread_context->tmp = my_malloc(thread_context->tmp_nbytes);
 2658|  6.55k|  BLOSC_ERROR_NULL(thread_context->tmp, BLOSC2_ERROR_MEMORY_ALLOC);
  ------------------
  |  |  104|  6.55k|    do {                                            \
  |  |  105|  6.55k|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 6.55k]
  |  |  ------------------
  |  |  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|  6.55k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 6.55k]
  |  |  ------------------
  ------------------
 2659|  6.55k|  thread_context->tmp2 = thread_context->tmp + ebsize;
 2660|  6.55k|  thread_context->tmp3 = thread_context->tmp2 + ebsize;
 2661|  6.55k|  thread_context->tmp4 = thread_context->tmp3 + ebsize;
 2662|  6.55k|  thread_context->tmp_blocksize = blocksize;
 2663|  6.55k|  thread_context->zfp_cell_nitems = 0;
 2664|  6.55k|  thread_context->zfp_cell_start = 0;
 2665|  6.55k|  #if defined(HAVE_ZSTD)
 2666|  6.55k|  thread_context->zstd_cctx = NULL;
 2667|  6.55k|  thread_context->zstd_dctx = NULL;
 2668|  6.55k|  #endif
 2669|  6.55k|  thread_context->lz4_cstream = NULL;
 2670|  6.55k|  thread_context->lz4hc_cstream = NULL;
 2671|       |
 2672|  6.55k|  return 0;
 2673|  6.55k|}
blosc2.c:blosc_d:
 2122|  49.7M|    int32_t nblock, uint8_t* dest, int32_t dest_offset, uint8_t* tmp, uint8_t* tmp2) {
 2123|  49.7M|  blosc2_context* context = thread_context->parent_context;
 2124|  49.7M|  uint8_t *tmp3 = thread_context->tmp4;
 2125|  49.7M|  bool vlblocks = (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) != 0;
 2126|  49.7M|  int32_t compformat = (context->header_flags & (uint8_t)0xe0) >> 5u;
 2127|  49.7M|  int dont_split = (context->header_flags & 0x10) >> 4;
 2128|  49.7M|  int32_t chunk_nbytes;
 2129|  49.7M|  int32_t chunk_cbytes;
 2130|  49.7M|  int nstreams;
 2131|  49.7M|  int32_t neblock;
 2132|  49.7M|  int32_t nbytes;                /* number of decompressed bytes in split */
 2133|  49.7M|  int32_t cbytes;                /* number of compressed bytes in split */
 2134|       |  // int32_t ctbytes = 0;           /* number of compressed bytes in block */
 2135|  49.7M|  int32_t ntbytes = 0;           /* number of uncompressed bytes in block */
 2136|  49.7M|  uint8_t* _dest;
 2137|  49.7M|  int32_t typesize = context->typesize;
 2138|  49.7M|  bool instr_codec = context->blosc2_flags & BLOSC2_INSTR_CODEC;
 2139|  49.7M|  const char* compname;
 2140|  49.7M|  int rc;
 2141|       |
 2142|  49.7M|  if (context->block_maskout != NULL && context->block_maskout[nblock]) {
  ------------------
  |  Branch (2142:7): [True: 0, False: 49.7M]
  |  Branch (2142:41): [True: 0, False: 0]
  ------------------
 2143|       |    // Do not decompress, but act as if we successfully decompressed everything
 2144|      0|    return bsize;
 2145|      0|  }
 2146|       |
 2147|  49.7M|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 2148|  49.7M|  if (rc < 0) {
  ------------------
  |  Branch (2148:7): [True: 0, False: 49.7M]
  ------------------
 2149|      0|    return rc;
 2150|      0|  }
 2151|  49.7M|  if (context->special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (2151:7): [True: 13, False: 49.7M]
  ------------------
 2152|       |    // We need the actual typesize in this case, but it cannot be encoded in the header, so derive it from cbytes
 2153|     13|    typesize = chunk_cbytes - context->header_overhead;
 2154|     13|  }
 2155|       |
 2156|       |  // In some situations (lazychunks) the context can arrive uninitialized
 2157|       |  // (but BITSHUFFLE needs it for accessing the format of the chunk)
 2158|  49.7M|  if (context->src == NULL) {
  ------------------
  |  Branch (2158:7): [True: 0, False: 49.7M]
  ------------------
 2159|      0|    context->src = src;
 2160|      0|  }
 2161|       |
 2162|       |  // Chunks with special values cannot be lazy
 2163|  49.7M|  bool is_lazy = ((context->header_overhead == BLOSC_EXTENDED_HEADER_LENGTH) &&
  ------------------
  |  Branch (2163:19): [True: 49.7M, False: 642]
  ------------------
 2164|  49.7M|          (context->blosc2_flags & 0x08u) && !context->special_type);
  ------------------
  |  Branch (2164:11): [True: 8.09k, False: 49.7M]
  |  Branch (2164:46): [True: 63, False: 8.02k]
  ------------------
 2165|  49.7M|  if (is_lazy) {
  ------------------
  |  Branch (2165:7): [True: 63, False: 49.7M]
  ------------------
 2166|       |    // The chunk is on disk, so just lazily load the block
 2167|     63|    if (context->schunk == NULL) {
  ------------------
  |  Branch (2167:9): [True: 3, False: 60]
  ------------------
 2168|      3|      BLOSC_TRACE_ERROR("Lazy chunk needs an associated super-chunk.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2169|      3|      return BLOSC2_ERROR_INVALID_PARAM;
 2170|      3|    }
 2171|     60|    if (context->schunk->frame == NULL) {
  ------------------
  |  Branch (2171:9): [True: 0, False: 60]
  ------------------
 2172|      0|      BLOSC_TRACE_ERROR("Lazy chunk needs an associated frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2173|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 2174|      0|    }
 2175|     60|    blosc2_frame_s* frame = (blosc2_frame_s*)context->schunk->frame;
 2176|     60|    size_t bstarts_nbytes;
 2177|     60|    size_t trailer_offset;
 2178|     60|    size_t block_csizes_nbytes;
 2179|     60|    size_t trailer_meta_nbytes;
 2180|     60|    size_t lazy_trailer_end;
 2181|     60|    if (srcsize < 0 || context->nblocks < 0 ||
  ------------------
  |  Branch (2181:9): [True: 0, False: 60]
  |  Branch (2181:24): [True: 0, False: 60]
  ------------------
 2182|     60|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &bstarts_nbytes) ||
  ------------------
  |  Branch (2182:9): [True: 0, False: 60]
  ------------------
 2183|     60|        !blosc2_checked_add_size((size_t)BLOSC_EXTENDED_HEADER_LENGTH, bstarts_nbytes, &trailer_offset) ||
  ------------------
  |  Branch (2183:9): [True: 0, False: 60]
  ------------------
 2184|     60|        !blosc2_checked_mul_size((size_t)context->nblocks, sizeof(int32_t), &block_csizes_nbytes) ||
  ------------------
  |  Branch (2184:9): [True: 0, False: 60]
  ------------------
 2185|     60|        !blosc2_checked_add_size(sizeof(int32_t) + sizeof(int64_t), block_csizes_nbytes, &trailer_meta_nbytes) ||
  ------------------
  |  Branch (2185:9): [True: 0, False: 60]
  ------------------
 2186|     60|        !blosc2_checked_add_size(trailer_offset, trailer_meta_nbytes, &lazy_trailer_end) ||
  ------------------
  |  Branch (2186:9): [True: 0, False: 60]
  ------------------
 2187|     60|        (size_t)srcsize < lazy_trailer_end) {
  ------------------
  |  Branch (2187:9): [True: 3, False: 57]
  ------------------
 2188|      3|      BLOSC_TRACE_ERROR("Lazy trailer exceeds source buffer.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2189|      3|      return BLOSC2_ERROR_READ_BUFFER;
 2190|      3|    }
 2191|     57|    int32_t nchunk;
 2192|     57|    int64_t chunk_offset;
 2193|       |    // The nchunk and the offset of the current chunk are in the trailer
 2194|     57|    memcpy(&nchunk, src + trailer_offset, sizeof(nchunk));
 2195|     57|    memcpy(&chunk_offset, src + trailer_offset + sizeof(int32_t), sizeof(chunk_offset));
 2196|       |    // Get the csize of the nblock
 2197|     57|    if (nblock < 0 || nblock >= context->nblocks) {
  ------------------
  |  Branch (2197:9): [True: 0, False: 57]
  |  Branch (2197:23): [True: 0, False: 57]
  ------------------
 2198|      0|      BLOSC_TRACE_ERROR("Invalid block index in lazy trailer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2199|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2200|      0|    }
 2201|     57|    int32_t *block_csizes = (int32_t *)(src + trailer_offset + sizeof(int32_t) + sizeof(int64_t));
 2202|     57|    int32_t block_csize = block_csizes[nblock];
 2203|     57|    int32_t max_lazy_block_csize = context->blocksize + context->typesize * (signed)sizeof(int32_t);
 2204|     57|    if (block_csize <= 0 || block_csize > max_lazy_block_csize) {
  ------------------
  |  Branch (2204:9): [True: 22, False: 35]
  |  Branch (2204:29): [True: 33, False: 2]
  ------------------
 2205|     55|      BLOSC_TRACE_ERROR("Invalid lazy block size in trailer.");
  ------------------
  |  |   93|     55|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     55|    do {                                            \
  |  |  |  |   98|     55|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     55|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 55, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     55|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2206|     55|      return BLOSC2_ERROR_INVALID_HEADER;
 2207|     55|    }
 2208|      2|    if (vlblocks && block_csize <= (int32_t)sizeof(int32_t)) {
  ------------------
  |  Branch (2208:9): [True: 0, False: 2]
  |  Branch (2208:21): [True: 0, False: 0]
  ------------------
 2209|      0|      BLOSC_TRACE_ERROR("Lazy VL block compressed size is too small.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2210|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 2211|      0|    }
 2212|       |    // Read the lazy block on disk
 2213|      2|    void* fp = NULL;
 2214|      2|    blosc2_io_cb *io_cb = blosc2_get_io_cb(context->schunk->storage->io->id);
 2215|      2|    if (io_cb == NULL) {
  ------------------
  |  Branch (2215:9): [True: 0, False: 2]
  ------------------
 2216|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2217|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 2218|      0|    }
 2219|       |
 2220|      2|    int64_t io_pos = 0;
 2221|      2|    if (frame->sframe) {
  ------------------
  |  Branch (2221:9): [True: 0, False: 2]
  ------------------
 2222|       |      // The chunk is not in the frame
 2223|      0|      fp = sframe_open_chunk(frame->urlpath, nchunk, "rb", context->schunk->storage->io);
 2224|      0|      BLOSC_ERROR_NULL(fp, BLOSC2_ERROR_FILE_OPEN);
  ------------------
  |  |  104|      0|    do {                                            \
  |  |  105|      0|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  106|      0|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      0|            return (rc);                            \
  |  |  108|      0|        }                                           \
  |  |  109|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2225|       |      // The offset of the block is src_offset
 2226|      0|      if (src_offset < 0) {
  ------------------
  |  Branch (2226:11): [True: 0, False: 0]
  ------------------
 2227|      0|        frame_reader_release(frame, io_cb, fp);
 2228|      0|        BLOSC_TRACE_ERROR("Lazy block offset cannot be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2229|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2230|      0|      }
 2231|      0|      io_pos = src_offset;
 2232|      0|    }
 2233|      2|    else {
 2234|      2|      fp = frame_reader_acquire(frame, context->schunk->storage->io);
 2235|      2|      BLOSC_ERROR_NULL(fp, BLOSC2_ERROR_FILE_OPEN);
  ------------------
  |  |  104|      2|    do {                                            \
  |  |  105|      2|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 2, False: 0]
  |  |  ------------------
  |  |  106|      2|            BLOSC_TRACE_ERROR("Pointer is null");   \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  107|      2|            return (rc);                            \
  |  |  108|      2|        }                                           \
  |  |  109|      2|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2236|       |      // The offset of the block is src_offset
 2237|      0|      if (src_offset < 0) {
  ------------------
  |  Branch (2237:11): [True: 0, False: 0]
  ------------------
 2238|      0|        frame_reader_release(frame, io_cb, fp);
 2239|      0|        BLOSC_TRACE_ERROR("Lazy block offset cannot be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2240|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2241|      0|      }
 2242|      0|      if (chunk_offset < 0) {
  ------------------
  |  Branch (2242:11): [True: 0, False: 0]
  ------------------
 2243|      0|        frame_reader_release(frame, io_cb, fp);
 2244|      0|        BLOSC_TRACE_ERROR("Lazy chunk offset cannot be negative.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2245|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2246|      0|      }
 2247|      0|      if (!blosc2_checked_add_i64(frame->file_offset, chunk_offset, &io_pos)) {
  ------------------
  |  Branch (2247:11): [True: 0, False: 0]
  ------------------
 2248|      0|        frame_reader_release(frame, io_cb, fp);
 2249|      0|        BLOSC_TRACE_ERROR("Lazy chunk offset overflows file position.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2250|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2251|      0|      }
 2252|      0|      if (!blosc2_checked_add_i64(io_pos, src_offset, &io_pos)) {
  ------------------
  |  Branch (2252:11): [True: 0, False: 0]
  ------------------
 2253|      0|        frame_reader_release(frame, io_cb, fp);
 2254|      0|        BLOSC_TRACE_ERROR("Lazy block offset overflows file position.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2255|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 2256|      0|      }
 2257|      0|    }
 2258|       |    // We can make use of tmp3 because it will be used after src is not needed anymore
 2259|      0|    int64_t rbytes = io_cb->read((void**)&tmp3, 1, block_csize, io_pos, fp);
 2260|      0|    frame_reader_release(frame, io_cb, fp);
 2261|      0|    if ((int32_t)rbytes != block_csize) {
  ------------------
  |  Branch (2261:9): [True: 0, False: 0]
  ------------------
 2262|      0|      BLOSC_TRACE_ERROR("Cannot read the (lazy) block out of the fileframe.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2263|      0|      return BLOSC2_ERROR_READ_BUFFER;
 2264|      0|    }
 2265|      0|    src = tmp3;
 2266|      0|    src_offset = 0;
 2267|      0|    srcsize = block_csize;
 2268|      0|  }
 2269|       |
 2270|       |  // If the chunk is memcpyed, we just have to copy the block to dest and return
 2271|  49.7M|  if (memcpyed) {
  ------------------
  |  Branch (2271:7): [True: 49.5M, False: 168k]
  ------------------
 2272|  49.5M|    int bsize_ = leftoverblock ? chunk_nbytes % context->blocksize : bsize;
  ------------------
  |  Branch (2272:18): [True: 6.21k, False: 49.5M]
  ------------------
 2273|  49.5M|    if (!context->special_type) {
  ------------------
  |  Branch (2273:9): [True: 1.53k, False: 49.5M]
  ------------------
 2274|  1.53k|      if (chunk_nbytes + context->header_overhead != chunk_cbytes) {
  ------------------
  |  Branch (2274:11): [True: 0, False: 1.53k]
  ------------------
 2275|      0|        return BLOSC2_ERROR_WRITE_BUFFER;
 2276|      0|      }
 2277|  1.53k|      if (chunk_cbytes < context->header_overhead + (nblock * context->blocksize) + bsize_) {
  ------------------
  |  Branch (2277:11): [True: 0, False: 1.53k]
  ------------------
 2278|       |        /* Not enough input to copy block */
 2279|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2280|      0|      }
 2281|  1.53k|    }
 2282|  49.5M|    if (!is_lazy) {
  ------------------
  |  Branch (2282:9): [True: 49.5M, False: 0]
  ------------------
 2283|  49.5M|      src += context->header_overhead + nblock * context->blocksize;
 2284|  49.5M|    }
 2285|  49.5M|    _dest = dest + dest_offset;
 2286|  49.5M|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (2286:9): [True: 0, False: 49.5M]
  ------------------
 2287|       |      // We are making use of a postfilter, so use a temp for destination
 2288|      0|      _dest = tmp;
 2289|      0|    }
 2290|  49.5M|    rc = 0;
 2291|  49.5M|    switch (context->special_type) {
 2292|     13|      case BLOSC2_SPECIAL_VALUE:
  ------------------
  |  Branch (2292:7): [True: 13, False: 49.5M]
  ------------------
 2293|       |        // All repeated values
 2294|     13|        rc = set_values(typesize, context->src, _dest, bsize_);
 2295|     13|        if (rc < 0) {
  ------------------
  |  Branch (2295:13): [True: 1, False: 12]
  ------------------
 2296|      1|          BLOSC_TRACE_ERROR("set_values failed");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2297|      1|          return BLOSC2_ERROR_DATA;
 2298|      1|        }
 2299|     12|        break;
 2300|   289k|      case BLOSC2_SPECIAL_NAN:
  ------------------
  |  Branch (2300:7): [True: 289k, False: 49.2M]
  ------------------
 2301|   289k|        rc = set_nans(context->typesize, _dest, bsize_);
 2302|   289k|        if (rc < 0) {
  ------------------
  |  Branch (2302:13): [True: 10, False: 289k]
  ------------------
 2303|     10|          BLOSC_TRACE_ERROR("set_nans failed");
  ------------------
  |  |   93|     10|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     10|    do {                                            \
  |  |  |  |   98|     10|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     10|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     10|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2304|     10|          return BLOSC2_ERROR_DATA;
 2305|     10|        }
 2306|   289k|        break;
 2307|  47.3M|      case BLOSC2_SPECIAL_ZERO:
  ------------------
  |  Branch (2307:7): [True: 47.3M, False: 2.21M]
  ------------------
 2308|  47.3M|        memset(_dest, 0, bsize_);
 2309|  47.3M|        break;
 2310|  1.92M|      case BLOSC2_SPECIAL_UNINIT:
  ------------------
  |  Branch (2310:7): [True: 1.92M, False: 47.6M]
  ------------------
 2311|       |        // We do nothing here
 2312|  1.92M|        break;
 2313|  1.53k|      default:
  ------------------
  |  Branch (2313:7): [True: 1.53k, False: 49.5M]
  ------------------
 2314|  1.53k|        memcpy(_dest, src, bsize_);
 2315|  49.5M|    }
 2316|  49.5M|    if (context->postfilter != NULL) {
  ------------------
  |  Branch (2316:9): [True: 0, False: 49.5M]
  ------------------
 2317|       |      // Create new postfilter parameters for this block (must be private for each thread)
 2318|      0|      blosc2_postfilter_params postparams;
 2319|      0|      memcpy(&postparams, context->postparams, sizeof(postparams));
 2320|      0|      postparams.input = tmp;
 2321|      0|      postparams.output = dest + dest_offset;
 2322|      0|      postparams.size = bsize;
 2323|      0|      postparams.typesize = typesize;
 2324|      0|      postparams.offset = nblock * context->blocksize;
 2325|      0|      postparams.nchunk = context->schunk != NULL ? context->schunk->current_nchunk : -1;
  ------------------
  |  Branch (2325:27): [True: 0, False: 0]
  ------------------
 2326|      0|      postparams.nblock = nblock;
 2327|      0|      postparams.tid = thread_context->tid;
 2328|      0|      postparams.ttmp = thread_context->tmp;
 2329|      0|      postparams.ttmp_nbytes = thread_context->tmp_nbytes;
 2330|      0|      postparams.ctx = context;
 2331|       |
 2332|       |      // Execute the postfilter (the processed block will be copied to dest)
 2333|      0|      if (context->postfilter(&postparams) != 0) {
  ------------------
  |  Branch (2333:11): [True: 0, False: 0]
  ------------------
 2334|      0|        BLOSC_TRACE_ERROR("Execution of postfilter function failed");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2335|      0|        return BLOSC2_ERROR_POSTFILTER;
 2336|      0|      }
 2337|      0|    }
 2338|  49.5M|    thread_context->zfp_cell_nitems = 0;
 2339|       |
 2340|  49.5M|    return bsize_;
 2341|  49.5M|  }
 2342|       |
 2343|   168k|  if (!is_lazy && (src_offset <= 0 || src_offset >= srcsize)) {
  ------------------
  |  Branch (2343:7): [True: 168k, False: 0]
  |  Branch (2343:20): [True: 24, False: 168k]
  |  Branch (2343:39): [True: 21, False: 168k]
  ------------------
 2344|       |    /* Invalid block src offset encountered */
 2345|     45|    return BLOSC2_ERROR_DATA;
 2346|     45|  }
 2347|       |
 2348|   168k|  src += src_offset;
 2349|   168k|  if (vlblocks) {
  ------------------
  |  Branch (2349:7): [True: 0, False: 168k]
  ------------------
 2350|      0|    if (context->blockcbytes == NULL || nblock >= context->nblocks ||
  ------------------
  |  Branch (2350:9): [True: 0, False: 0]
  |  Branch (2350:41): [True: 0, False: 0]
  ------------------
 2351|      0|        context->blockcbytes[nblock] <= (int32_t)sizeof(int32_t) ||
  ------------------
  |  Branch (2351:9): [True: 0, False: 0]
  ------------------
 2352|      0|        src_offset > srcsize - context->blockcbytes[nblock]) {
  ------------------
  |  Branch (2352:9): [True: 0, False: 0]
  ------------------
 2353|      0|      return BLOSC2_ERROR_DATA;
 2354|      0|    }
 2355|      0|    srcsize = context->blockcbytes[nblock];
 2356|      0|  }
 2357|   168k|  else {
 2358|   168k|    srcsize -= src_offset;
 2359|   168k|  }
 2360|       |
 2361|   168k|  int last_filter_index = last_filter(context, 'd');
 2362|   168k|  if (instr_codec) {
  ------------------
  |  Branch (2362:7): [True: 3.83k, False: 164k]
  ------------------
 2363|       |    // If instrumented, we don't want to run the filters
 2364|  3.83k|    _dest = dest + dest_offset;
 2365|  3.83k|  }
 2366|   164k|  else if (((last_filter_index >= 0) &&
  ------------------
  |  Branch (2366:13): [True: 162k, False: 1.87k]
  ------------------
 2367|   162k|       (next_filter(context, BLOSC2_MAX_FILTERS, 'd') != BLOSC_DELTA)) ||
  ------------------
  |  Branch (2367:8): [True: 120k, False: 41.8k]
  ------------------
 2368|   120k|    context->postfilter != NULL) {
  ------------------
  |  Branch (2368:5): [True: 0, False: 43.7k]
  ------------------
 2369|       |    // We are making use of some filter, so use a temp for destination
 2370|   120k|    _dest = tmp;
 2371|   120k|  }
 2372|  43.7k|  else {
 2373|       |    // If no filters, or only DELTA in pipeline
 2374|  43.7k|    _dest = dest + dest_offset;
 2375|  43.7k|  }
 2376|       |
 2377|       |  /* The number of compressed data streams for this block */
 2378|   168k|  if (vlblocks) {
  ------------------
  |  Branch (2378:7): [True: 0, False: 168k]
  ------------------
 2379|      0|    nstreams = 1;
 2380|      0|  }
 2381|   168k|  else if (!dont_split && !leftoverblock) {
  ------------------
  |  Branch (2381:12): [True: 1.16k, False: 167k]
  |  Branch (2381:27): [True: 1.13k, False: 27]
  ------------------
 2382|  1.13k|    nstreams = context->typesize;
 2383|  1.13k|  }
 2384|   167k|  else {
 2385|   167k|    nstreams = 1;
 2386|   167k|  }
 2387|       |
 2388|   168k|  neblock = bsize / nstreams;
 2389|   168k|  if (neblock == 0) {
  ------------------
  |  Branch (2389:7): [True: 0, False: 168k]
  ------------------
 2390|       |    /* Not enough space to output bytes */
 2391|      0|    BLOSC_ERROR(BLOSC2_ERROR_WRITE_BUFFER);
  ------------------
  |  |  111|      0|    do {                                            \
  |  |  112|      0|        int rc_ = (rc);                             \
  |  |  113|      0|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  114|      0|            char *error_msg = print_error(rc_);     \
  |  |  115|      0|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      0|            return rc_;                             \
  |  |  117|      0|        }                                           \
  |  |  118|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2392|      0|  }
 2393|       |  /* The splits must cover the whole block, or part of tmp is left unwritten */
 2394|   168k|  if (neblock * nstreams != bsize) {
  ------------------
  |  Branch (2394:7): [True: 2, False: 168k]
  ------------------
 2395|      2|    BLOSC_ERROR(BLOSC2_ERROR_DATA);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
 2396|      2|  }
 2397|   331k|  for (int j = 0; j < nstreams; j++) {
  ------------------
  |  Branch (2397:19): [True: 168k, False: 163k]
  ------------------
 2398|   168k|    if (vlblocks) {
  ------------------
  |  Branch (2398:9): [True: 0, False: 168k]
  ------------------
 2399|      0|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2399:11): [True: 0, False: 0]
  ------------------
 2400|       |        /* Not enough input to read compressed bytes */
 2401|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2402|      0|      }
 2403|      0|      neblock = sw32_(src);
 2404|      0|      if (neblock != bsize) {
  ------------------
  |  Branch (2404:11): [True: 0, False: 0]
  ------------------
 2405|      0|        return BLOSC2_ERROR_DATA;
 2406|      0|      }
 2407|      0|      src += sizeof(int32_t);
 2408|      0|      cbytes = srcsize - (int32_t)sizeof(int32_t);
 2409|      0|      srcsize = 0;
 2410|      0|    }
 2411|   168k|    else {
 2412|   168k|      if (srcsize < (signed)sizeof(int32_t)) {
  ------------------
  |  Branch (2412:11): [True: 0, False: 168k]
  ------------------
 2413|       |        /* Not enough input to read compressed size */
 2414|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2415|      0|      }
 2416|   168k|      srcsize -= sizeof(int32_t);
 2417|   168k|      cbytes = sw32_(src);      /* amount of compressed bytes */
 2418|   168k|      if (cbytes > 0) {
  ------------------
  |  Branch (2418:11): [True: 13.6k, False: 155k]
  ------------------
 2419|  13.6k|        if (srcsize < cbytes) {
  ------------------
  |  Branch (2419:13): [True: 6, False: 13.6k]
  ------------------
 2420|       |          /* Not enough input to read compressed bytes */
 2421|      6|          return BLOSC2_ERROR_READ_BUFFER;
 2422|      6|        }
 2423|  13.6k|        srcsize -= cbytes;
 2424|  13.6k|      }
 2425|   168k|      src += sizeof(int32_t);
 2426|   168k|    }
 2427|       |    // ctbytes += (signed)sizeof(int32_t);
 2428|       |
 2429|       |    /* Uncompress */
 2430|   168k|    if (!vlblocks && cbytes == 0) {
  ------------------
  |  Branch (2430:9): [True: 168k, False: 0]
  |  Branch (2430:22): [True: 76.0k, False: 92.6k]
  ------------------
 2431|       |      // A run of 0's
 2432|  76.0k|      memset(_dest, 0, (unsigned int)neblock);
 2433|  76.0k|      nbytes = neblock;
 2434|  76.0k|    }
 2435|  92.6k|    else if (!vlblocks && cbytes < 0) {
  ------------------
  |  Branch (2435:14): [True: 92.6k, False: 0]
  |  Branch (2435:27): [True: 78.9k, False: 13.6k]
  ------------------
 2436|       |      // A negative number means some encoding depending on the token that comes next
 2437|  78.9k|      uint8_t token;
 2438|       |
 2439|  78.9k|      if (srcsize < (signed)sizeof(uint8_t)) {
  ------------------
  |  Branch (2439:11): [True: 0, False: 78.9k]
  ------------------
 2440|       |        // Not enough input to read token */
 2441|      0|        return BLOSC2_ERROR_READ_BUFFER;
 2442|      0|      }
 2443|  78.9k|      srcsize -= sizeof(uint8_t);
 2444|       |
 2445|  78.9k|      token = src[0];
 2446|  78.9k|      src += 1;
 2447|       |      // ctbytes += 1;
 2448|       |
 2449|  78.9k|      if (token & 0x1) {
  ------------------
  |  Branch (2449:11): [True: 78.9k, False: 1]
  ------------------
 2450|       |        // A run of bytes that are different than 0
 2451|  78.9k|        if (cbytes < -255) {
  ------------------
  |  Branch (2451:13): [True: 10, False: 78.9k]
  ------------------
 2452|       |          // Runs can only encode a byte
 2453|     10|          return BLOSC2_ERROR_RUN_LENGTH;
 2454|     10|        }
 2455|  78.9k|        uint8_t value = -cbytes;
 2456|  78.9k|        memset(_dest, value, (unsigned int)neblock);
 2457|  78.9k|      } else {
 2458|      1|        BLOSC_TRACE_ERROR("Invalid or unsupported compressed stream token value - %d", token);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2459|      1|        return BLOSC2_ERROR_RUN_LENGTH;
 2460|      1|      }
 2461|  78.9k|      nbytes = neblock;
 2462|  78.9k|      cbytes = 0;  // everything is encoded in the cbytes token
 2463|  78.9k|    }
 2464|  13.6k|    else if (cbytes == neblock) {
  ------------------
  |  Branch (2464:14): [True: 7.91k, False: 5.76k]
  ------------------
 2465|  7.91k|      memcpy(_dest, src, (unsigned int)neblock);
 2466|  7.91k|      nbytes = (int32_t)neblock;
 2467|  7.91k|    }
 2468|  5.76k|    else {
 2469|  5.76k|      if (compformat == BLOSC_BLOSCLZ_FORMAT) {
  ------------------
  |  Branch (2469:11): [True: 434, False: 5.33k]
  ------------------
 2470|    434|        nbytes = blosclz_decompress(src, cbytes, _dest, (int)neblock);
 2471|    434|      }
 2472|  5.33k|      else if (compformat == BLOSC_LZ4_FORMAT) {
  ------------------
  |  Branch (2472:16): [True: 664, False: 4.67k]
  ------------------
 2473|    664|        nbytes = lz4_wrap_decompress((char*)src, (size_t)cbytes,
 2474|    664|                                     (char*)_dest, (size_t)neblock,
 2475|    664|                                     thread_context);
 2476|    664|      }
 2477|  4.67k|  #if defined(HAVE_ZLIB)
 2478|  4.67k|      else if (compformat == BLOSC_ZLIB_FORMAT) {
  ------------------
  |  Branch (2478:16): [True: 723, False: 3.94k]
  ------------------
 2479|    723|        nbytes = zlib_wrap_decompress((char*)src, (size_t)cbytes,
 2480|    723|                                      (char*)_dest, (size_t)neblock);
 2481|    723|      }
 2482|  3.94k|  #endif /*  HAVE_ZLIB */
 2483|  3.94k|  #if defined(HAVE_ZSTD)
 2484|  3.94k|      else if (compformat == BLOSC_ZSTD_FORMAT) {
  ------------------
  |  Branch (2484:16): [True: 3.39k, False: 548]
  ------------------
 2485|  3.39k|        nbytes = zstd_wrap_decompress(thread_context,
 2486|  3.39k|                                      (char*)src, (size_t)cbytes,
 2487|  3.39k|                                      (char*)_dest, (size_t)neblock);
 2488|  3.39k|      }
 2489|    548|  #endif /*  HAVE_ZSTD */
 2490|    548|      else if (compformat == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (2490:16): [True: 548, False: 0]
  ------------------
 2491|    548|        bool getcell = false;
 2492|       |
 2493|    548|#if defined(HAVE_ZFP)
 2494|    548|        if ((context->compcode == BLOSC_CODEC_ZFP_FIXED_RATE) &&
  ------------------
  |  Branch (2494:13): [True: 4, False: 544]
  ------------------
 2495|      4|            (thread_context->zfp_cell_nitems > 0)) {
  ------------------
  |  Branch (2495:13): [True: 0, False: 4]
  ------------------
 2496|      0|          nbytes = zfp_getcell(thread_context, src, cbytes, _dest, neblock);
 2497|      0|          if (nbytes < 0) {
  ------------------
  |  Branch (2497:15): [True: 0, False: 0]
  ------------------
 2498|      0|            return BLOSC2_ERROR_DATA;
 2499|      0|          }
 2500|      0|          if (nbytes == thread_context->zfp_cell_nitems * typesize) {
  ------------------
  |  Branch (2500:15): [True: 0, False: 0]
  ------------------
 2501|      0|            getcell = true;
 2502|      0|          }
 2503|      0|        }
 2504|    548|#endif /* HAVE_ZFP */
 2505|    548|        if (!getcell) {
  ------------------
  |  Branch (2505:13): [True: 548, False: 0]
  ------------------
 2506|    548|          thread_context->zfp_cell_nitems = 0;
 2507|    631|          for (int i = 0; i < g_ncodecs; ++i) {
  ------------------
  |  Branch (2507:27): [True: 626, False: 5]
  ------------------
 2508|    626|            if (g_codecs[i].compcode == context->compcode) {
  ------------------
  |  Branch (2508:17): [True: 543, False: 83]
  ------------------
 2509|    543|              if (load_acquire_ptr(&g_codecs[i].decoder) == NULL) {
  ------------------
  |  |  144|    543|#define load_acquire_ptr(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2509:19): [True: 4, False: 539]
  ------------------
 2510|       |                // Dynamically load codec plugin
 2511|      4|                if (fill_codec(&g_codecs[i]) < 0) {
  ------------------
  |  Branch (2511:21): [True: 4, False: 0]
  ------------------
 2512|      4|                  BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
  ------------------
  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2513|      4|                  return BLOSC2_ERROR_CODEC_SUPPORT;
 2514|      4|                }
 2515|      4|              }
 2516|    539|              blosc2_dparams dparams;
 2517|    539|              blosc2_ctx_get_dparams(context, &dparams);
 2518|    539|              nbytes = g_codecs[i].decoder(src,
 2519|    539|                                           cbytes,
 2520|    539|                                           _dest,
 2521|    539|                                           neblock,
 2522|    539|                                           context->compcode_meta,
 2523|    539|                                           &dparams,
 2524|    539|                                           context->src);
 2525|    539|              goto urcodecsuccess;
 2526|    543|            }
 2527|    626|          }
 2528|      5|          BLOSC_TRACE_ERROR("User-defined compressor codec %d not found during decompression", context->compcode);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2529|      5|          return BLOSC2_ERROR_CODEC_SUPPORT;
 2530|    548|        }
 2531|    539|      urcodecsuccess:
 2532|    539|        ;
 2533|    539|      }
 2534|      0|      else {
 2535|      0|        compname = clibcode_to_clibname(compformat);
 2536|      0|        BLOSC_TRACE_ERROR(
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2537|      0|                "Blosc has not been compiled with decompression "
 2538|      0|                "support for '%s' format.  "
 2539|      0|                "Please recompile for adding this support.", compname);
 2540|      0|        return BLOSC2_ERROR_CODEC_SUPPORT;
 2541|      0|      }
 2542|       |
 2543|       |      /* Check that decompressed bytes number is correct */
 2544|  5.75k|      if ((nbytes != neblock) && (thread_context->zfp_cell_nitems == 0)) {
  ------------------
  |  Branch (2544:11): [True: 5.23k, False: 524]
  |  Branch (2544:34): [True: 5.23k, False: 0]
  ------------------
 2545|  5.23k|        return BLOSC2_ERROR_DATA;
 2546|  5.23k|      }
 2547|       |
 2548|  5.75k|    }
 2549|   163k|    src += cbytes;
 2550|       |    // ctbytes += cbytes;
 2551|   163k|    _dest += nbytes;
 2552|   163k|    ntbytes += nbytes;
 2553|   163k|  } /* Closes j < nstreams */
 2554|       |
 2555|   163k|  if (!instr_codec) {
  ------------------
  |  Branch (2555:7): [True: 160k, False: 3.06k]
  ------------------
 2556|   160k|    if (last_filter_index >= 0 || context->postfilter != NULL) {
  ------------------
  |  Branch (2556:9): [True: 158k, False: 1.69k]
  |  Branch (2556:35): [True: 0, False: 1.69k]
  ------------------
 2557|       |      /* Apply regular filter pipeline */
 2558|   158k|      int errcode = pipeline_backward(thread_context, bsize, dest, dest_offset, tmp, tmp2, tmp3,
 2559|   158k|                                      last_filter_index, nblock);
 2560|   158k|      if (errcode < 0)
  ------------------
  |  Branch (2560:11): [True: 17, False: 158k]
  ------------------
 2561|     17|        return errcode;
 2562|   158k|    }
 2563|   160k|  }
 2564|       |
 2565|       |  /* Return the number of uncompressed bytes */
 2566|   163k|  return (int)ntbytes;
 2567|   163k|}
blosc2.c:lz4_wrap_decompress:
  659|    664|                               struct thread_context* thread_context) {
  660|    664|  int nbytes;
  661|    664|  blosc2_context* context = thread_context->parent_context;
  662|    664|  if (context->use_dict && context->dict_buffer != NULL && context->dict_size > 0) {
  ------------------
  |  Branch (662:7): [True: 374, False: 290]
  |  Branch (662:28): [True: 374, False: 0]
  |  Branch (662:60): [True: 374, False: 0]
  ------------------
  663|    374|    nbytes = LZ4_decompress_safe_usingDict(input, output,
  664|    374|                                           (int)compressed_length, (int)maxout,
  665|    374|                                           (const char*)context->dict_buffer,
  666|    374|                                           (int)context->dict_size);
  667|    374|  } else {
  668|    290|    nbytes = LZ4_decompress_safe(input, output, (int)compressed_length, (int)maxout);
  669|    290|  }
  670|    664|  if (nbytes != (int)maxout) {
  ------------------
  |  Branch (670:7): [True: 594, False: 70]
  ------------------
  671|    594|    return 0;
  672|    594|  }
  673|     70|  return (int)maxout;
  674|    664|}
blosc2.c:zlib_wrap_decompress:
  698|    723|                                char* output, size_t maxout) {
  699|    723|  int status;
  700|    723|#if defined(HAVE_ZLIB_NG) && ! defined(ZLIB_COMPAT)
  701|    723|  size_t ul = maxout;
  702|    723|  status = zng_uncompress(
  703|    723|      (uint8_t*)output, &ul, (uint8_t*)input, compressed_length);
  704|       |#else
  705|       |  uLongf ul = (uLongf)maxout;
  706|       |  status = uncompress(
  707|       |      (Bytef*)output, &ul, (Bytef*)input, (uLong)compressed_length);
  708|       |#endif
  709|    723|  if (status != Z_OK) {
  ------------------
  |  |  180|    723|#define Z_OK            0
  ------------------
  |  Branch (709:7): [True: 640, False: 83]
  ------------------
  710|    640|    return 0;
  711|    640|  }
  712|     83|  return (int)ul;
  713|    723|}
blosc2.c:zstd_wrap_decompress:
  750|  3.39k|                                char* output, size_t maxout) {
  751|  3.39k|  size_t code;
  752|  3.39k|  blosc2_context* context = thread_context->parent_context;
  753|       |
  754|  3.39k|  if (thread_context->zstd_dctx == NULL) {
  ------------------
  |  Branch (754:7): [True: 3.19k, False: 208]
  ------------------
  755|  3.19k|    thread_context->zstd_dctx = ZSTD_createDCtx();
  756|  3.19k|  }
  757|       |
  758|  3.39k|  if (context->use_dict) {
  ------------------
  |  Branch (758:7): [True: 1.31k, False: 2.08k]
  ------------------
  759|  1.31k|    assert(context->dict_ddict != NULL);
  760|  1.31k|    code = ZSTD_decompress_usingDDict(
  761|  1.31k|            thread_context->zstd_dctx, (void*)output, maxout, (void*)input,
  762|  1.31k|            compressed_length, context->dict_ddict);
  763|  2.08k|  } else {
  764|  2.08k|    code = ZSTD_decompressDCtx(thread_context->zstd_dctx,
  765|  2.08k|        (void*)output, maxout, (void*)input, compressed_length);
  766|  2.08k|  }
  767|  3.39k|  if (ZSTD_isError(code) != ZSTD_error_no_error) {
  ------------------
  |  Branch (767:7): [True: 3.09k, False: 302]
  ------------------
  768|  3.09k|    BLOSC_TRACE_ERROR("Error in ZSTD decompression: '%s'.  Giving up.",
  ------------------
  |  |   93|  3.09k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  3.09k|    do {                                            \
  |  |  |  |   98|  3.09k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  3.09k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 3.09k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  3.09k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  769|  3.09k|                      ZDICT_getErrorName(code));
  770|  3.09k|    return 0;
  771|  3.09k|  }
  772|    302|  return (int)code;
  773|  3.39k|}
blosc2.c:set_values:
 2053|     15|static int32_t set_values(int32_t typesize, const uint8_t* src, uint8_t* dest, int32_t destsize) {
 2054|       |#if defined(BLOSC_STRICT_ALIGN)
 2055|       |  if (destsize % typesize != 0) {
 2056|       |    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
 2057|       |  }
 2058|       |  int32_t nitems = destsize / typesize;
 2059|       |  if (nitems == 0) {
 2060|       |    return 0;
 2061|       |  }
 2062|       |  for (int i = 0; i < nitems; i++) {
 2063|       |    memcpy(dest + i * typesize, src + BLOSC_EXTENDED_HEADER_LENGTH, typesize);
 2064|       |  }
 2065|       |#else
 2066|     15|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (2066:7): [True: 3, False: 12]
  ------------------
 2067|      3|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      3|    do {                                            \
  |  |  112|      3|        int rc_ = (rc);                             \
  |  |  113|      3|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 3, False: 0]
  |  |  ------------------
  |  |  114|      3|            char *error_msg = print_error(rc_);     \
  |  |  115|      3|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      3|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      3|    do {                                            \
  |  |  |  |  |  |   98|      3|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      3|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 3, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      3|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      3|            return rc_;                             \
  |  |  117|      3|        }                                           \
  |  |  118|      3|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2068|      3|  }
 2069|     12|  int32_t nitems = destsize / typesize;
 2070|     12|  if (nitems == 0) {
  ------------------
  |  Branch (2070:7): [True: 0, False: 12]
  ------------------
 2071|      0|    return 0;
 2072|      0|  }
 2073|       |
 2074|     12|  switch (typesize) {
 2075|      0|    case 8: {
  ------------------
  |  Branch (2075:5): [True: 0, False: 12]
  ------------------
 2076|      0|      int64_t val8 = ((int64_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2077|      0|      int64_t* dest8 = (int64_t*)dest;
 2078|      0|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2078:23): [True: 0, False: 0]
  ------------------
 2079|      0|        dest8[i] = val8;
 2080|      0|      }
 2081|      0|      break;
 2082|      0|    }
 2083|      9|    case 4: {
  ------------------
  |  Branch (2083:5): [True: 9, False: 3]
  ------------------
 2084|      9|      int32_t val4 = ((int32_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2085|      9|      int32_t* dest4 = (int32_t*)dest;
 2086|   450k|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2086:23): [True: 450k, False: 9]
  ------------------
 2087|   450k|        dest4[i] = val4;
 2088|   450k|      }
 2089|      9|      break;
 2090|      0|    }
 2091|      0|    case 2: {
  ------------------
  |  Branch (2091:5): [True: 0, False: 12]
  ------------------
 2092|      0|      int16_t val2 = ((int16_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2093|      0|      int16_t* dest2 = (int16_t*)dest;
 2094|      0|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2094:23): [True: 0, False: 0]
  ------------------
 2095|      0|        dest2[i] = val2;
 2096|      0|      }
 2097|      0|      break;
 2098|      0|    }
 2099|      0|    case 1: {
  ------------------
  |  Branch (2099:5): [True: 0, False: 12]
  ------------------
 2100|      0|      int8_t val1 = ((int8_t*)(src + BLOSC_EXTENDED_HEADER_LENGTH))[0];
 2101|      0|      int8_t* dest1 = (int8_t*)dest;
 2102|      0|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2102:23): [True: 0, False: 0]
  ------------------
 2103|      0|        dest1[i] = val1;
 2104|      0|      }
 2105|      0|      break;
 2106|      0|    }
 2107|      3|    default:
  ------------------
  |  Branch (2107:5): [True: 3, False: 9]
  ------------------
 2108|    190|      for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2108:23): [True: 187, False: 3]
  ------------------
 2109|    187|        memcpy(dest + i * typesize, src + BLOSC_EXTENDED_HEADER_LENGTH, typesize);
 2110|    187|      }
 2111|     12|  }
 2112|     12|#endif
 2113|       |
 2114|     12|  return nitems;
 2115|     12|}
blosc2.c:set_nans:
 2021|   289k|static int32_t set_nans(int32_t typesize, uint8_t* dest, int32_t destsize) {
 2022|   289k|  if (destsize % typesize != 0) {
  ------------------
  |  Branch (2022:7): [True: 4, False: 289k]
  ------------------
 2023|      4|    BLOSC_TRACE_ERROR("destsize can only be a multiple of typesize");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2024|      4|    BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  111|      4|    do {                                            \
  |  |  112|      4|        int rc_ = (rc);                             \
  |  |  113|      4|        if (rc_ < BLOSC2_ERROR_SUCCESS) {           \
  |  |  ------------------
  |  |  |  Branch (113:13): [True: 4, False: 0]
  |  |  ------------------
  |  |  114|      4|            char *error_msg = print_error(rc_);     \
  |  |  115|      4|            BLOSC_TRACE_ERROR("%s", error_msg);     \
  |  |  ------------------
  |  |  |  |   93|      4|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      4|    do {                                            \
  |  |  |  |  |  |   98|      4|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      4|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 4, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      4|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  116|      4|            return rc_;                             \
  |  |  117|      4|        }                                           \
  |  |  118|      4|    } while (0)
  |  |  ------------------
  |  |  |  Branch (118:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2025|      4|  }
 2026|   289k|  int32_t nitems = destsize / typesize;
 2027|   289k|  if (nitems == 0) {
  ------------------
  |  Branch (2027:7): [True: 0, False: 289k]
  ------------------
 2028|      0|    return 0;
 2029|      0|  }
 2030|       |
 2031|   289k|  if (typesize == 4) {
  ------------------
  |  Branch (2031:7): [True: 261k, False: 27.7k]
  ------------------
 2032|   261k|    float* dest_ = (float*)dest;
 2033|   261k|    float val = nanf("");
 2034|  8.11M|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2034:21): [True: 7.85M, False: 261k]
  ------------------
 2035|  7.85M|      dest_[i] = val;
 2036|  7.85M|    }
 2037|   261k|    return nitems;
 2038|   261k|  }
 2039|  27.7k|  else if (typesize == 8) {
  ------------------
  |  Branch (2039:12): [True: 27.7k, False: 6]
  ------------------
 2040|  27.7k|    double* dest_ = (double*)dest;
 2041|  27.7k|    double val = nan("");
 2042|   380k|    for (int i = 0; i < nitems; i++) {
  ------------------
  |  Branch (2042:21): [True: 353k, False: 27.7k]
  ------------------
 2043|   353k|      dest_[i] = val;
 2044|   353k|    }
 2045|  27.7k|    return nitems;
 2046|  27.7k|  }
 2047|       |
 2048|      6|  BLOSC_TRACE_ERROR("Unsupported typesize for NaN");
  ------------------
  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2049|      6|  return BLOSC2_ERROR_DATA;
 2050|   289k|}
blosc2.c:getitem_read_header:
 5177|  77.7k|static int getitem_read_header(const void* src, int32_t srcsize, blosc_header* header) {
 5178|  77.7k|  int result = read_chunk_header((uint8_t *) src, srcsize, true, header);
 5179|  77.7k|  if (result < 0) {
  ------------------
  |  Branch (5179:7): [True: 0, False: 77.7k]
  ------------------
 5180|      0|    return result;
 5181|      0|  }
 5182|  77.7k|  if (header->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (5182:7): [True: 0, False: 77.7k]
  ------------------
 5183|      0|    BLOSC_TRACE_ERROR("getitem is not supported for VL-block chunks.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5184|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 5185|      0|  }
 5186|  77.7k|  return 0;
 5187|  77.7k|}
blosc2.c:getitem_with_header:
 5193|  77.7k|                               int start, int nitems, void* dest, int32_t destsize) {
 5194|       |  /* Minimally populate the context */
 5195|  77.7k|  context->src = src;
 5196|  77.7k|  context->srcsize = srcsize;
 5197|  77.7k|  context->dest = dest;
 5198|  77.7k|  context->destsize = destsize;
 5199|       |
 5200|  77.7k|  int result = blosc2_initialize_context_from_header(context, header);
 5201|  77.7k|  if (result < 0) {
  ------------------
  |  Branch (5201:7): [True: 0, False: 77.7k]
  ------------------
 5202|      0|    return result;
 5203|      0|  }
 5204|       |
 5205|       |  /* Call the actual getitem function */
 5206|  77.7k|  return _blosc_getitem(context, header, src, srcsize, start, nitems, dest, destsize);
 5207|  77.7k|}
blosc2.c:blosc2_initialize_context_from_header:
 1050|   186k|static int blosc2_initialize_context_from_header(blosc2_context* context, blosc_header* header) {
 1051|   186k|  context->header_flags = header->flags;
 1052|   186k|  context->typesize = header->typesize;
 1053|   186k|  context->sourcesize = header->nbytes;
 1054|   186k|  context->header_blocksize = header->blocksize;
 1055|   186k|  context->blocksize = header->blocksize;
 1056|   186k|  context->blosc2_flags2 = header->blosc2_flags2;
 1057|   186k|  context->blosc2_flags = header->blosc2_flags;
 1058|   186k|  context->compcode = header->flags >> 5;
 1059|   186k|  if (context->compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (1059:7): [True: 61.8k, False: 124k]
  ------------------
 1060|  61.8k|    context->compcode = header->udcompcode;
 1061|  61.8k|  }
 1062|   186k|  if (context->blosc2_flags2 & BLOSC2_VL_BLOCKS) {
  ------------------
  |  Branch (1062:7): [True: 40, False: 186k]
  ------------------
 1063|     40|    context->nblocks = header->blocksize;
 1064|     40|    context->leftover = 0;
 1065|     40|    context->blocksize = 0;
 1066|     40|  }
 1067|   186k|  else {
 1068|   186k|    blosc2_calculate_blocks(context);
 1069|   186k|  }
 1070|       |
 1071|   186k|  bool is_lazy = false;
 1072|   186k|  if ((context->header_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (1072:7): [True: 185k, False: 427]
  ------------------
 1073|   185k|      (context->header_flags & BLOSC_DOBITSHUFFLE)) {
  ------------------
  |  Branch (1073:7): [True: 185k, False: 272]
  ------------------
 1074|       |    /* Extended header */
 1075|   185k|    context->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 1076|       |
 1077|   185k|    memcpy(context->filters, header->filters, BLOSC2_MAX_FILTERS);
 1078|   185k|    memcpy(context->filters_meta, header->filters_meta, BLOSC2_MAX_FILTERS);
 1079|   185k|    context->compcode_meta = header->compcode_meta;
 1080|       |
 1081|   185k|    context->filter_flags = filters_to_flags(header->filters);
 1082|   185k|    context->special_type = (header->blosc2_flags >> 4) & BLOSC2_SPECIAL_MASK;
 1083|       |
 1084|       |    // Chunks with special values cannot be lazy (as in blosc_d()), and their
 1085|       |    // value is read from the buffer, so the cbytes check below must apply
 1086|   185k|    is_lazy = (context->blosc2_flags & 0x08u) && !context->special_type;
  ------------------
  |  Branch (1086:15): [True: 5.14k, False: 180k]
  |  Branch (1086:50): [True: 119, False: 5.02k]
  ------------------
 1087|   185k|  }
 1088|    699|  else {
 1089|    699|    context->header_overhead = BLOSC_MIN_HEADER_LENGTH;
 1090|    699|    context->filter_flags = get_filter_flags(context->header_flags, context->typesize);
 1091|    699|    flags_to_filters(context->header_flags, context->filters);
 1092|    699|  }
 1093|       |
 1094|       |  // Some checks for malformed headers
 1095|   186k|  if (!is_lazy && header->cbytes > context->srcsize) {
  ------------------
  |  Branch (1095:7): [True: 186k, False: 119]
  |  Branch (1095:19): [True: 0, False: 186k]
  ------------------
 1096|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1097|      0|  }
 1098|       |
 1099|   186k|  return 0;
 1100|   186k|}
blosc2.c:get_filter_flags:
  890|    699|                                const int32_t typesize) {
  891|    699|  uint8_t flags = 0;
  892|       |
  893|    699|  if ((header_flags & BLOSC_DOSHUFFLE) && (typesize > 1)) {
  ------------------
  |  Branch (893:7): [True: 272, False: 427]
  |  Branch (893:43): [True: 195, False: 77]
  ------------------
  894|    195|    flags |= BLOSC_DOSHUFFLE;
  895|    195|  }
  896|    699|  if (header_flags & BLOSC_DOBITSHUFFLE) {
  ------------------
  |  Branch (896:7): [True: 111, False: 588]
  ------------------
  897|    111|    flags |= BLOSC_DOBITSHUFFLE;
  898|    111|  }
  899|    699|  if (header_flags & BLOSC_DODELTA) {
  ------------------
  |  Branch (899:7): [True: 373, False: 326]
  ------------------
  900|    373|    flags |= BLOSC_DODELTA;
  901|    373|  }
  902|    699|  if (header_flags & BLOSC_MEMCPYED) {
  ------------------
  |  Branch (902:7): [True: 25, False: 674]
  ------------------
  903|     25|    flags |= BLOSC_MEMCPYED;
  904|     25|  }
  905|    699|  return flags;
  906|    699|}
blosc2.c:clear_context_decompression_dict:
 3049|   108k|static void clear_context_decompression_dict(blosc2_context* context) {
 3050|   108k|  context->use_dict = 0;
 3051|   108k|  release_context_dict_buffer(context);
 3052|   108k|#if defined(HAVE_ZSTD)
 3053|   108k|  if (context->dict_ddict != NULL) {
  ------------------
  |  Branch (3053:7): [True: 4.52k, False: 104k]
  ------------------
 3054|  4.52k|    ZSTD_freeDDict(context->dict_ddict);
 3055|  4.52k|    context->dict_ddict = NULL;
 3056|  4.52k|  }
 3057|       |#else
 3058|       |  context->dict_ddict = NULL;
 3059|       |#endif
 3060|   108k|}
blosc2.c:check_nthreads:
 2714|   107k|static int check_nthreads(blosc2_context* context, bool start_backend) {
 2715|   107k|  if (context->new_nthreads != context->nthreads && context->new_nthreads <= 0) {
  ------------------
  |  Branch (2715:7): [True: 25.5k, False: 82.4k]
  |  Branch (2715:53): [True: 25.5k, False: 0]
  ------------------
 2716|  25.5k|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  ------------------
  |  |   93|  25.5k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  25.5k|    do {                                            \
  |  |  |  |   98|  25.5k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  25.5k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 25.5k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  25.5k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2716|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2717|  25.5k|    return BLOSC2_ERROR_INVALID_PARAM;
 2718|  25.5k|  }
 2719|  82.4k|  if (context->nthreads <= 0) {
  ------------------
  |  Branch (2719:7): [True: 0, False: 82.4k]
  ------------------
 2720|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2720|      0|    BLOSC_TRACE_ERROR("nthreads must be >= 1 and <= %d", INT16_MAX);
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2721|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2722|      0|  }
 2723|       |
 2724|       |  /* Detect a pool that was torn down by blosc2_destroy() while this context
 2725|       |   * was still alive, or that belongs to the parent of a forked process.  The
 2726|       |   * epoch mismatch tells us the pool pointer is dangling or has no threads;
 2727|       |   * clear it so the re-attach logic below creates a fresh one. */
 2728|  82.4k|  if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL &&
  ------------------
  |  |   34|   164k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (2728:7): [True: 0, False: 82.4k]
  ------------------
 2729|      0|      context->pool_epoch != load_acquire_int(&g_destroy_count)) {
  ------------------
  |  |  142|      0|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (2729:7): [True: 0, False: 0]
  ------------------
 2730|      0|    context->thread_pool = NULL;
 2731|      0|    context->threads_started = 0;
 2732|      0|    context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|      0|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 2733|      0|  }
 2734|       |
 2735|  82.4k|  if (context->new_nthreads != context->nthreads) {
  ------------------
  |  Branch (2735:7): [True: 0, False: 82.4k]
  ------------------
 2736|      0|    release_thread_backend(context);
 2737|      0|    context->nthreads = context->new_nthreads;
 2738|      0|  }
 2739|  82.4k|  if (start_backend && context->nthreads > 1 && context->threads_started == 0) {
  ------------------
  |  Branch (2739:7): [True: 0, False: 82.4k]
  |  Branch (2739:24): [True: 0, False: 0]
  |  Branch (2739:49): [True: 0, False: 0]
  ------------------
 2740|      0|    int rc;
 2741|      0|    if (threads_callback) {
  ------------------
  |  Branch (2741:9): [True: 0, False: 0]
  ------------------
 2742|      0|      rc = init_callback_threads(context);
 2743|      0|    }
 2744|      0|    else {
 2745|       |#if defined(_WIN32)
 2746|       |      rc = init_threadpool(context);
 2747|       |#else
 2748|      0|      rc = attach_shared_pool(context);
 2749|      0|#endif
 2750|      0|    }
 2751|      0|    if (rc < 0) {
  ------------------
  |  Branch (2751:9): [True: 0, False: 0]
  ------------------
 2752|      0|      return rc;
 2753|      0|    }
 2754|      0|  }
 2755|  82.4k|  if (context->nthreads <= 1) {
  ------------------
  |  Branch (2755:7): [True: 82.4k, False: 0]
  ------------------
 2756|  82.4k|    context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|  82.4k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 2757|  82.4k|  }
 2758|       |
 2759|  82.4k|  return context->nthreads;
 2760|  82.4k|}
blosc2.c:register_atfork:
  311|      1|static void register_atfork(void) {
  312|      1|  if (pthread_atfork(atfork_prepare, atfork_parent, atfork_child) != 0) {
  ------------------
  |  Branch (312:7): [True: 0, False: 1]
  ------------------
  313|       |    BLOSC_TRACE_WARNING("pthread_atfork() failed: a fork()ed child may hang or crash with more than one thread");
  ------------------
  |  |   94|      0|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  314|      0|  }
  315|      1|}
blosc2.c:blosc2_init_locked:
 6696|  7.08k|static void blosc2_init_locked(void) {
 6697|  7.08k|  BLOSC2_IO_CB_DEFAULTS.id = BLOSC2_IO_FILESYSTEM;
 6698|  7.08k|  BLOSC2_IO_CB_DEFAULTS.name = "filesystem";
 6699|  7.08k|  BLOSC2_IO_CB_DEFAULTS.is_allocation_necessary = true;
 6700|  7.08k|  BLOSC2_IO_CB_DEFAULTS.open = (blosc2_open_cb) blosc2_stdio_open;
 6701|  7.08k|  BLOSC2_IO_CB_DEFAULTS.close = (blosc2_close_cb) blosc2_stdio_close;
 6702|  7.08k|  BLOSC2_IO_CB_DEFAULTS.size = (blosc2_size_cb) blosc2_stdio_size;
 6703|  7.08k|  BLOSC2_IO_CB_DEFAULTS.write = (blosc2_write_cb) blosc2_stdio_write;
 6704|  7.08k|  BLOSC2_IO_CB_DEFAULTS.read = (blosc2_read_cb) blosc2_stdio_read;
 6705|  7.08k|  BLOSC2_IO_CB_DEFAULTS.truncate = (blosc2_truncate_cb) blosc2_stdio_truncate;
 6706|  7.08k|  BLOSC2_IO_CB_DEFAULTS.destroy = (blosc2_destroy_cb) blosc2_stdio_destroy;
 6707|       |
 6708|  7.08k|  _blosc2_register_io_cb(&BLOSC2_IO_CB_DEFAULTS);
 6709|       |
 6710|  7.08k|  BLOSC2_IO_CB_MMAP.id = BLOSC2_IO_FILESYSTEM_MMAP;
 6711|  7.08k|  BLOSC2_IO_CB_MMAP.name = "filesystem_mmap";
 6712|  7.08k|  BLOSC2_IO_CB_MMAP.is_allocation_necessary = false;
 6713|  7.08k|  BLOSC2_IO_CB_MMAP.open = (blosc2_open_cb) blosc2_stdio_mmap_open;
 6714|  7.08k|  BLOSC2_IO_CB_MMAP.close = (blosc2_close_cb) blosc2_stdio_mmap_close;
 6715|  7.08k|  BLOSC2_IO_CB_MMAP.read = (blosc2_read_cb) blosc2_stdio_mmap_read;
 6716|  7.08k|  BLOSC2_IO_CB_MMAP.size = (blosc2_size_cb) blosc2_stdio_mmap_size;
 6717|  7.08k|  BLOSC2_IO_CB_MMAP.write = (blosc2_write_cb) blosc2_stdio_mmap_write;
 6718|  7.08k|  BLOSC2_IO_CB_MMAP.truncate = (blosc2_truncate_cb) blosc2_stdio_mmap_truncate;
 6719|  7.08k|  BLOSC2_IO_CB_MMAP.destroy = (blosc2_destroy_cb) blosc2_stdio_mmap_destroy;
 6720|       |
 6721|  7.08k|  _blosc2_register_io_cb(&BLOSC2_IO_CB_MMAP);
 6722|       |
 6723|       |  // BLOSC_PREFETCH=<nthreads> turns read-ahead on without touching the sources (see blosc2_set_prefetch())
 6724|  7.08k|  const char *prefetch_env = getenv("BLOSC_PREFETCH");
 6725|  7.08k|  if (prefetch_env != NULL && prefetch_env[0] != '\0') {
  ------------------
  |  Branch (6725:7): [True: 0, False: 7.08k]
  |  Branch (6725:31): [True: 0, False: 0]
  ------------------
 6726|      0|    long nthreads = strtol(prefetch_env, NULL, 10);
 6727|      0|    if (nthreads > 0 && nthreads <= BLOSC2_PREFETCH_MAX_NTHREADS) {
  ------------------
  |  |  786|      0|#define BLOSC2_PREFETCH_MAX_NTHREADS 256
  ------------------
  |  Branch (6727:9): [True: 0, False: 0]
  |  Branch (6727:25): [True: 0, False: 0]
  ------------------
 6728|      0|      blosc2_set_prefetch((int) nthreads, 0, 0);
 6729|      0|    }
 6730|      0|  }
 6731|       |  // BLOSC_PREFETCH_POPULATE: of which memory-mapped frames read-ahead populates the mapping: of all (1), of none (0),
 6732|       |  // or, if unset or empty, of those on GPFS
 6733|  7.08k|  const char *populate_env = getenv("BLOSC_PREFETCH_POPULATE");
 6734|  7.08k|  prefetch_set_populate(populate_env != NULL && populate_env[0] != '\0' ? strtol(populate_env, NULL, 10) != 0 : -1);
  ------------------
  |  Branch (6734:25): [True: 0, False: 7.08k]
  |  Branch (6734:49): [True: 0, False: 0]
  ------------------
 6735|       |
 6736|  7.08k|  g_ncodecs = 0;
 6737|  7.08k|  g_nfilters = 0;
 6738|  7.08k|  g_ntuners = 0;
 6739|       |
 6740|  7.08k|#if defined(HAVE_PLUGINS)
 6741|  7.08k|  #include "blosc2/blosc2-common.h"
 6742|  7.08k|  #include "blosc2/blosc2-stdio.h"
 6743|  7.08k|  register_codecs();
 6744|  7.08k|  register_filters();
 6745|  7.08k|  register_tuners();
 6746|  7.08k|#endif
 6747|  7.08k|  blosc2_pthread_mutex_init(&global_comp_mutex, NULL);
  ------------------
  |  |   90|  7.08k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6748|       |  /* Create a global context */
 6749|  7.08k|  g_global_context = (blosc2_context*)my_malloc(sizeof(blosc2_context));
 6750|  7.08k|  memset(g_global_context, 0, sizeof(blosc2_context));
 6751|  7.08k|  g_global_context->nthreads = g_nthreads;
 6752|  7.08k|  g_global_context->new_nthreads = g_nthreads;
 6753|  7.08k|  blosc2_pthread_mutex_init(&g_global_context->nchunk_mutex, NULL);
  ------------------
  |  |   90|  7.08k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
 6754|  7.08k|  store_release_int(&g_initlib, BLOSC_STATE_INITIALIZED);
  ------------------
  |  |  143|  7.08k|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 6755|  7.08k|}
blosc2.c:blosc2_free_resources_locked:
 6784|  7.08k|static int blosc2_free_resources_locked(void) {
 6785|       |  /* The calling thread's temporaries (other threads free theirs at exit) */
 6786|  7.08k|  blosc2_tmp_cache_clear();
 6787|  7.08k|  int rc = release_thread_backend(g_global_context);
 6788|       |  /* The thread pools that no context uses (kept for reuse) */
 6789|  7.08k|  static_lock(&pool_registry_mutex);
  ------------------
  |  |  132|  7.08k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6790|  7.08k|  struct blosc_shared_pool *unused = unlink_unused_pools_locked(0);
 6791|  7.08k|  static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|  7.08k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6792|  7.08k|  destroy_shared_pools(unused);
 6793|  7.08k|  return rc;
 6794|  7.08k|}
blosc2.c:unlink_unused_pools_locked:
 6013|  7.08k|static struct blosc_shared_pool *unlink_unused_pools_locked(int keep) {
 6014|  7.08k|  struct blosc_shared_pool *unused = NULL;
 6015|  7.08k|  struct blosc_shared_pool **prev = &shared_pools;
 6016|  7.08k|  while (*prev != NULL) {
  ------------------
  |  Branch (6016:10): [True: 0, False: 7.08k]
  ------------------
 6017|      0|    struct blosc_shared_pool *pool = *prev;
 6018|      0|    if (pool->context_refs == 0) {
  ------------------
  |  Branch (6018:9): [True: 0, False: 0]
  ------------------
 6019|      0|      if (keep == 0) {
  ------------------
  |  Branch (6019:11): [True: 0, False: 0]
  ------------------
 6020|      0|        *prev = pool->next;
 6021|      0|        pool->next = unused;
 6022|      0|        unused = pool;
 6023|      0|        continue;
 6024|      0|      }
 6025|      0|      keep--;
 6026|      0|    }
 6027|      0|    prev = &pool->next;
 6028|      0|  }
 6029|  7.08k|  return unused;
 6030|  7.08k|}
blosc2.c:destroy_shared_pools:
 6000|  14.1k|static void destroy_shared_pools(struct blosc_shared_pool *pool) {
 6001|  14.1k|  while (pool != NULL) {
  ------------------
  |  Branch (6001:10): [True: 0, False: 14.1k]
  ------------------
 6002|      0|    struct blosc_shared_pool *next = pool->next;
 6003|      0|    destroy_shared_pool(pool);
 6004|      0|    pool = next;
 6005|      0|  }
 6006|  14.1k|}
blosc2.c:serial_context_put:
 6921|   151k|static void serial_context_put(struct thread_context* thread_context) {
 6922|   151k|#if !defined(_WIN32)
 6923|   151k|  tmp_cache_t *cache = tmp_cache_get(false);
 6924|   151k|  if (cache != NULL && cache->serial == thread_context) {
  ------------------
  |  Branch (6924:7): [True: 151k, False: 0]
  |  Branch (6924:24): [True: 150k, False: 921]
  ------------------
 6925|   150k|    blosc2_context* context = thread_context->parent_context;
 6926|   150k|    if (context->serial_context == NULL &&
  ------------------
  |  Branch (6926:9): [True: 150k, False: 0]
  ------------------
 6927|   150k|        thread_context_nbytes(thread_context) > BLOSC2_SERIAL_TLS_MAX) {
  ------------------
  |  | 6817|   150k|#define BLOSC2_SERIAL_TLS_MAX (16 * 1024 * 1024)
  ------------------
  |  Branch (6927:9): [True: 3, False: 150k]
  ------------------
 6928|       |      /* Grown too large to keep per thread (e.g. ZSTD compression state for
 6929|       |         large blocks at high levels): the context that needed it keeps it, as
 6930|       |         if it had always been its own, and the thread starts a new one */
 6931|      3|      thread_context->tmp_blocksize = context->blocksize;
 6932|      3|      context->serial_context = thread_context;
 6933|      3|      cache->serial = NULL;
 6934|      3|    }
 6935|   150k|    else {
 6936|   150k|      thread_context->parent_context = NULL;
 6937|   150k|    }
 6938|   150k|    cache->serial_busy = false;
 6939|   150k|  }
 6940|       |#else
 6941|       |  BLOSC_UNUSED_PARAM(thread_context);
 6942|       |#endif
 6943|   151k|}
blosc2.c:thread_context_nbytes:
 6867|   150k|static size_t thread_context_nbytes(const struct thread_context* thread_context) {
 6868|   150k|  size_t nbytes = thread_context->tmp_nbytes +
 6869|   150k|                  (thread_context->blosclz_state != NULL ? sizeof(blosclz_state) : 0);
  ------------------
  |  Branch (6869:20): [True: 0, False: 150k]
  ------------------
 6870|   150k|#if defined(HAVE_ZSTD)
 6871|   150k|  if (thread_context->zstd_cctx != NULL) {
  ------------------
  |  Branch (6871:7): [True: 0, False: 150k]
  ------------------
 6872|      0|    nbytes += ZSTD_sizeof_CCtx(thread_context->zstd_cctx);
 6873|      0|  }
 6874|   150k|  if (thread_context->zstd_dctx != NULL) {
  ------------------
  |  Branch (6874:7): [True: 3.24k, False: 146k]
  ------------------
 6875|  3.24k|    nbytes += ZSTD_sizeof_DCtx(thread_context->zstd_dctx);
 6876|  3.24k|  }
 6877|   150k|#endif
 6878|   150k|  if (thread_context->lz4_cstream != NULL) {
  ------------------
  |  Branch (6878:7): [True: 0, False: 150k]
  ------------------
 6879|      0|    nbytes += sizeof(LZ4_stream_t);
 6880|      0|  }
 6881|   150k|  if (thread_context->lz4hc_cstream != NULL) {
  ------------------
  |  Branch (6881:7): [True: 0, False: 150k]
  ------------------
 6882|      0|    nbytes += sizeof(LZ4_streamHC_t);
 6883|      0|  }
 6884|   150k|  return nbytes;
 6885|   150k|}
blosc2.c:tmp_cache_get:
 6848|   315k|static tmp_cache_t *tmp_cache_get(bool create) {
 6849|   315k|  pthread_once(&tmp_cache_once, tmp_cache_init);
 6850|   315k|  if (!tmp_cache_ready) {
  ------------------
  |  Branch (6850:7): [True: 0, False: 315k]
  ------------------
 6851|      0|    return NULL;
 6852|      0|  }
 6853|   315k|  tmp_cache_t *cache = pthread_getspecific(tmp_cache_key);
 6854|   315k|  if (cache == NULL && create) {
  ------------------
  |  Branch (6854:7): [True: 1, False: 315k]
  |  Branch (6854:24): [True: 1, False: 0]
  ------------------
 6855|      1|    cache = calloc(1, sizeof(tmp_cache_t));
 6856|      1|    if (cache != NULL && pthread_setspecific(tmp_cache_key, cache) != 0) {
  ------------------
  |  Branch (6856:9): [True: 1, False: 0]
  |  Branch (6856:26): [True: 0, False: 1]
  ------------------
 6857|      0|      free(cache);
 6858|       |      cache = NULL;
 6859|      0|    }
 6860|      1|  }
 6861|   315k|  return cache;
 6862|   315k|}
blosc2.c:tmp_cache_init:
 6844|      1|static void tmp_cache_init(void) {
 6845|      1|  tmp_cache_ready = pthread_key_create(&tmp_cache_key, tmp_cache_release) == 0;
 6846|      1|}
blosc2.c:blosc2_destroy_locked:
 7045|  7.08k|static void blosc2_destroy_locked(void) {
 7046|  7.08k|  blosc2_free_resources_locked();
 7047|  7.08k|  blosc2_free_ctx(g_global_context);
 7048|  7.08k|  blosc2_tmp_cache_clear();
 7049|       |
 7050|       |  /* Atomically invalidate outstanding context pointers and detach the registry.
 7051|       |   * A release either finishes its refcount update before this, or observes the
 7052|       |   * new epoch without dereferencing its stale pool.  Join outside the lock. */
 7053|  7.08k|  static_lock(&pool_registry_mutex);
  ------------------
  |  |  132|  7.08k|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 7054|  7.08k|  store_release_int(&g_destroy_count, load_acquire_int(&g_destroy_count) + 1);
  ------------------
  |  |  143|  7.08k|#define store_release_int(p, v) __atomic_store_n((p), (v), __ATOMIC_RELEASE)
  ------------------
 7055|  7.08k|  struct blosc_shared_pool *pools = shared_pools;
 7056|  7.08k|  shared_pools = NULL;
 7057|  7.08k|  static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|  7.08k|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 7058|  7.08k|  destroy_shared_pools(pools);
 7059|       |
 7060|  7.08k|  blosc2_pthread_mutex_destroy(&global_comp_mutex);
  ------------------
  |  |   91|  7.08k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 7061|  7.08k|}
blosc2.c:my_malloc:
  383|  72.9k|static uint8_t* my_malloc(size_t size) {
  384|  72.9k|  void* block = NULL;
  385|  72.9k|  int res = 0;
  386|       |  /* Keep aligned allocations valid under Valgrind and POSIX wrappers. */
  387|  72.9k|  if (size == 0) {
  ------------------
  |  Branch (387:7): [True: 0, False: 72.9k]
  ------------------
  388|      0|    size = 1;
  389|      0|  }
  390|       |
  391|       |/* Do an alignment to 32 bytes because AVX2 is supported */
  392|       |#if defined(_WIN32)
  393|       |  /* A (void *) cast needed for avoiding a warning with MINGW :-/ */
  394|       |  block = (void *)_aligned_malloc(size, 32);
  395|       |#elif _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
  396|       |  /* Platform does have an implementation of posix_memalign */
  397|  72.9k|  res = posix_memalign(&block, 32, size);
  398|       |#else
  399|       |  block = malloc(size);
  400|       |#endif  /* _WIN32 */
  401|       |
  402|  72.9k|  if (block == NULL || res != 0) {
  ------------------
  |  Branch (402:7): [True: 0, False: 72.9k]
  |  Branch (402:24): [True: 0, False: 72.9k]
  ------------------
  403|      0|    BLOSC_TRACE_ERROR("Error allocating memory!");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  404|      0|    return NULL;
  405|      0|  }
  406|       |
  407|  72.9k|  return (uint8_t*)block;
  408|  72.9k|}
blosc2.c:release_thread_backend:
 6178|  59.1k|static int release_thread_backend(blosc2_context *context) {
 6179|  59.1k|  if (context->thread_backend == BLOSC_BACKEND_CALLBACK && context->threads_started > 0) {
  ------------------
  |  |   35|   118k|#define BLOSC_BACKEND_CALLBACK 2
  ------------------
  |  Branch (6179:7): [True: 0, False: 59.1k]
  |  Branch (6179:60): [True: 0, False: 0]
  ------------------
 6180|      0|    for (int32_t t = 0; t < context->threads_started; t++) {
  ------------------
  |  Branch (6180:25): [True: 0, False: 0]
  ------------------
 6181|      0|      destroy_thread_context(context->thread_contexts + t);
 6182|      0|    }
 6183|      0|    my_free(context->thread_contexts);
 6184|      0|    context->thread_contexts = NULL;
 6185|      0|    blosc2_pthread_mutex_destroy(&context->count_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6186|      0|    blosc2_pthread_mutex_destroy(&context->delta_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 6187|      0|    blosc2_pthread_cond_destroy(&context->delta_cv);
  ------------------
  |  |   97|      0|#define blosc2_pthread_cond_destroy(a) pthread_cond_destroy((a))
  ------------------
 6188|      0|  }
 6189|       |#if defined(_WIN32)
 6190|       |  else if (context->thread_backend == BLOSC_BACKEND_PER_CONTEXT && context->threads_started > 0) {
 6191|       |    /* Signal all workers to exit. */
 6192|       |    blosc2_pthread_mutex_lock(&context->jobs_mutex);
 6193|       |    context->end_threads = 1;
 6194|       |    blosc2_pthread_cond_broadcast(&context->jobs_ready);
 6195|       |    blosc2_pthread_mutex_unlock(&context->jobs_mutex);
 6196|       |
 6197|       |    for (int32_t t = 0; t < context->threads_started; t++) {
 6198|       |      blosc2_pthread_join(context->threads[t], NULL);
 6199|       |    }
 6200|       |    my_free(context->threads);
 6201|       |    context->threads = NULL;
 6202|       |    blosc2_pthread_cond_destroy(&context->jobs_done);
 6203|       |    blosc2_pthread_cond_destroy(&context->jobs_ready);
 6204|       |    blosc2_pthread_mutex_destroy(&context->jobs_mutex);
 6205|       |    blosc2_pthread_cond_destroy(&context->delta_cv);
 6206|       |    blosc2_pthread_mutex_destroy(&context->delta_mutex);
 6207|       |    blosc2_pthread_mutex_destroy(&context->count_mutex);
 6208|       |  }
 6209|       |#endif  /* _WIN32 */
 6210|  59.1k|  else if (context->thread_backend == BLOSC_BACKEND_SHARED_POOL && context->thread_pool != NULL) {
  ------------------
  |  |   34|   118k|#define BLOSC_BACKEND_SHARED_POOL 1
  ------------------
  |  Branch (6210:12): [True: 0, False: 59.1k]
  |  Branch (6210:68): [True: 0, False: 0]
  ------------------
 6211|      0|    struct blosc_shared_pool *pool = context->thread_pool;
 6212|       |
 6213|      0|    static_lock(&pool_registry_mutex);
  ------------------
  |  |  132|      0|#define static_lock(l) pthread_mutex_lock(l)
  ------------------
 6214|      0|    if (context->pool_epoch != load_acquire_int(&g_destroy_count)) {
  ------------------
  |  |  142|      0|#define load_acquire_int(p) __atomic_load_n((p), __ATOMIC_ACQUIRE)
  ------------------
  |  Branch (6214:9): [True: 0, False: 0]
  ------------------
 6215|       |      /* Check under the process-lifetime registry lock: destruction cannot
 6216|       |       * invalidate the pool between this check and the refcount update. */
 6217|      0|      static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|      0|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6218|      0|      context->thread_pool = NULL;
 6219|      0|      context->threads_started = 0;
 6220|      0|      context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|      0|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 6221|      0|      return 0;
 6222|      0|    }
 6223|       |
 6224|       |    /* A pool that no context uses any more stays registered for the next
 6225|       |     * contexts with the same nthreads: contexts that live for one call
 6226|       |     * (python-blosc2's compress2()/decompress2(), BLOSC_NOLOCK) would otherwise
 6227|       |     * start and join all of its threads every time.  The most recently
 6228|       |     * released unused pools are kept, the others destroyed (the pool moves to
 6229|       |     * the front of the registry); blosc2_free_resources() destroys all. */
 6230|      0|    struct blosc_shared_pool *unused = NULL;
 6231|      0|    pool->context_refs--;
 6232|      0|    if (pool->context_refs == 0) {
  ------------------
  |  Branch (6232:9): [True: 0, False: 0]
  ------------------
 6233|      0|      struct blosc_shared_pool **prev = &shared_pools;
 6234|      0|      while (*prev != NULL && *prev != pool) {
  ------------------
  |  Branch (6234:14): [True: 0, False: 0]
  |  Branch (6234:31): [True: 0, False: 0]
  ------------------
 6235|      0|        prev = &(*prev)->next;
 6236|      0|      }
 6237|      0|      if (*prev == pool) {
  ------------------
  |  Branch (6237:11): [True: 0, False: 0]
  ------------------
 6238|      0|        *prev = pool->next;
 6239|      0|        pool->next = shared_pools;
 6240|      0|        shared_pools = pool;
 6241|      0|      }
 6242|      0|      unused = unlink_unused_pools_locked(BLOSC2_UNUSED_POOLS_MAX);
  ------------------
  |  |  197|      0|#define BLOSC2_UNUSED_POOLS_MAX 2
  ------------------
 6243|      0|    }
 6244|      0|    static_unlock(&pool_registry_mutex);
  ------------------
  |  |  133|      0|#define static_unlock(l) pthread_mutex_unlock(l)
  ------------------
 6245|      0|    destroy_shared_pools(unused);
 6246|      0|    context->thread_pool = NULL;
 6247|      0|  }
 6248|       |
 6249|  59.1k|  context->threads_started = 0;
 6250|  59.1k|  context->thread_backend = BLOSC_BACKEND_SERIAL;
  ------------------
  |  |   33|  59.1k|#define BLOSC_BACKEND_SERIAL 0
  ------------------
 6251|  59.1k|  return 0;
 6252|  59.1k|}
blosc2.c:release_context_dict_buffer:
 3039|   167k|static void release_context_dict_buffer(blosc2_context* context) {
 3040|   167k|  if (context->dict_buffer_owned && context->dict_buffer != NULL) {
  ------------------
  |  Branch (3040:7): [True: 0, False: 167k]
  |  Branch (3040:37): [True: 0, False: 0]
  ------------------
 3041|      0|    free(context->dict_buffer);
 3042|      0|  }
 3043|   167k|  context->dict_buffer = NULL;
 3044|       |  context->dict_buffer_owned = false;
 3045|   167k|  context->dict_size = 0;
 3046|   167k|}

blosclz_decompress:
 2120|    434|int blosclz_decompress(const void* input, int length, void* output, int maxout) {
 2121|    434|#if defined(BLOSCLZ_AVX2_ENABLED) && !defined(__AVX2__)
 2122|    434|  if (blosc_cpu_has_avx2()) {
  ------------------
  |  Branch (2122:7): [True: 434, False: 0]
  ------------------
 2123|    434|    return blosclz_decompress_avx2(input, length, output, maxout);
 2124|    434|  }
 2125|      0|#endif
 2126|      0|  return blosclz_decompress_impl(input, length, output, maxout);
 2127|    434|}
blosclz_decompress_avx2:
 2089|    434|int blosclz_decompress_avx2(const void* input, int length, void* output, int maxout) {
 2090|    434|  return blosclz_decompress_impl(input, length, output, maxout);
 2091|    434|}
blosclz-avx2.c:blosclz_decompress_impl:
 1949|    434|static inline int blosclz_decompress_impl(const void* input, int length, void* output, int maxout) {
 1950|    434|  const uint8_t* ip = (const uint8_t*)input;
 1951|    434|  const uint8_t* ip_limit = ip + length;
 1952|    434|  uint8_t* op = (uint8_t*)output;
 1953|    434|  uint32_t ctrl;
 1954|    434|  uint8_t* op_limit = op + maxout;
 1955|    434|  if (BLOSCLZ_UNLIKELY(length == 0)) {
  ------------------
  |  |   52|    434|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 0, False: 434]
  |  |  ------------------
  ------------------
 1956|      0|    return 0;
 1957|      0|  }
 1958|    434|  ctrl = (*ip++) & 31U;
 1959|       |
 1960|  63.5k|  while (1) {
  ------------------
  |  Branch (1960:10): [True: 63.5k, Folded]
  ------------------
 1961|  63.5k|    if (ctrl >= 32) {
  ------------------
  |  Branch (1961:9): [True: 31.1k, False: 32.4k]
  ------------------
 1962|       |      // match
 1963|  31.1k|      int32_t len = (int32_t)(ctrl >> 5U) - 1 ;
 1964|  31.1k|      int32_t ofs = (int32_t)(ctrl & 31U) << 8U;
 1965|  31.1k|      uint8_t code;
 1966|  31.1k|      const uint8_t* ref;
 1967|       |
 1968|  31.1k|      if (len == 7 - 1) {
  ------------------
  |  Branch (1968:11): [True: 22.8k, False: 8.33k]
  ------------------
 1969|  22.8k|#ifdef BLOSCLZ_WIDE_DECODE
 1970|       |        /* Long runs encode their lengths as consecutive 255-byte extensions.
 1971|       |         * Consume eight together, keeping an offset byte in reserve. */
 1972|  25.8k|        while (ip_limit - ip >= 9) {
  ------------------
  |  Branch (1972:16): [True: 25.7k, False: 101]
  ------------------
 1973|  25.7k|          uint64_t extensions;
 1974|  25.7k|          memcpy(&extensions, ip, sizeof(extensions));
 1975|  25.7k|          if (extensions != UINT64_MAX) {
  ------------------
  |  Branch (1975:15): [True: 22.7k, False: 3.06k]
  ------------------
 1976|  22.7k|            break;
 1977|  22.7k|          }
 1978|  3.06k|          if (BLOSCLZ_UNLIKELY(len > maxout - 8 * 255)) {
  ------------------
  |  |   52|  3.06k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 6, False: 3.06k]
  |  |  ------------------
  ------------------
 1979|      6|            return 0;
 1980|      6|          }
 1981|  3.06k|          len += 8 * 255;
 1982|  3.06k|          ip += 8;
 1983|  3.06k|        }
 1984|  22.8k|#endif
 1985|  31.2k|        do {
 1986|  31.2k|          if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   52|  31.2k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 8, False: 31.2k]
  |  |  ------------------
  ------------------
 1987|      8|            return 0;
 1988|      8|          }
 1989|  31.2k|          code = *ip++;
 1990|       |          /* Guard before the addition so that `len` can never wrap past
 1991|       |             INT32_MAX.  The subsequent `len += 3` adds at most 3 more,
 1992|       |             so capping at maxout here is safe and sufficient. */
 1993|  31.2k|          if (BLOSCLZ_UNLIKELY(len > maxout - code)) {
  ------------------
  |  |   52|  31.2k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 5, False: 31.2k]
  |  |  ------------------
  ------------------
 1994|      5|            return 0;
 1995|      5|          }
 1996|  31.2k|          len += code;
 1997|  31.2k|        } while (code == 255);
  ------------------
  |  Branch (1997:18): [True: 8.44k, False: 22.8k]
  ------------------
 1998|  22.8k|      }
 1999|  8.33k|      else {
 2000|  8.33k|        if (BLOSCLZ_UNLIKELY(ip + 1 >= ip_limit)) {
  ------------------
  |  |   52|  8.33k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 22, False: 8.30k]
  |  |  ------------------
  ------------------
 2001|     22|          return 0;
 2002|     22|        }
 2003|  8.33k|      }
 2004|  31.1k|      code = *ip++;
 2005|  31.1k|      len += 3;
 2006|  31.1k|      ofs += code;
 2007|       |
 2008|       |      /* match from 16-bit distance: ofs == (31 << 8) && code == 255 iff ofs + code == MAX_DISTANCE */
 2009|  31.1k|      if (BLOSCLZ_UNLIKELY(ofs == MAX_DISTANCE)) {
  ------------------
  |  |   52|  31.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 4.07k, False: 27.0k]
  |  |  ------------------
  ------------------
 2010|  4.07k|        if (ip + 1 >= ip_limit) {
  ------------------
  |  Branch (2010:13): [True: 2, False: 4.07k]
  ------------------
 2011|      2|          return 0;
 2012|      2|        }
 2013|  4.07k|        ofs = (*ip++) << 8U;
 2014|  4.07k|        ofs += *ip++;
 2015|  4.07k|        ofs += MAX_DISTANCE;
  ------------------
  |  |   63|  4.07k|#define MAX_DISTANCE 8191
  ------------------
 2016|  4.07k|      }
 2017|  31.1k|      ref = op - ofs;
 2018|       |
 2019|  31.1k|      if (BLOSCLZ_UNLIKELY(len > op_limit - op)) {
  ------------------
  |  |   52|  31.1k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 59, False: 31.0k]
  |  |  ------------------
  ------------------
 2020|     59|        return 0;
 2021|     59|      }
 2022|       |
 2023|  31.0k|      if (BLOSCLZ_UNLIKELY(ref <= (uint8_t*)output)) {
  ------------------
  |  |   52|  31.0k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 125, False: 30.9k]
  |  |  ------------------
  ------------------
 2024|    125|        return 0;
 2025|    125|      }
 2026|       |
 2027|  30.9k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   52|  30.9k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 15, False: 30.9k]
  |  |  ------------------
  ------------------
 2028|  30.9k|      ctrl = *ip++;
 2029|       |
 2030|  30.9k|      ref--;
 2031|  30.9k|#if defined(__aarch64__) || defined(_M_ARM64) || defined(__AVX2__) || defined(__SSSE3__)
 2032|  30.9k|      if (len <= 32 && op_limit - op >= 32) {
  ------------------
  |  Branch (2032:11): [True: 10.1k, False: 20.7k]
  |  Branch (2032:24): [True: 9.96k, False: 201]
  ------------------
 2033|  9.96k|        blosclz_copy_short_match(op, ref, len);
 2034|  9.96k|        op += len;
 2035|  9.96k|        continue;
 2036|  9.96k|      }
 2037|  20.9k|#endif
 2038|  20.9k|#if defined(__AVX2__)
 2039|  20.9k|      op = blosclz_copy_match_avx2(op, ref, len, op_limit);
 2040|       |#elif defined(__SSE2__) || defined(__x86_64__) || defined(_M_X64)
 2041|       |      op = blosclz_copy_match_sse2(op, ref, len, op_limit);
 2042|       |#elif defined(__aarch64__) || defined(_M_ARM64)
 2043|       |      op = blosclz_copy_match_neon(op, ref, len, op_limit);
 2044|       |#else
 2045|       |      if (ref == op - 1) {
 2046|       |        /* optimized copy for a run */
 2047|       |        memset(op, *ref, len);
 2048|       |        op += len;
 2049|       |      }
 2050|       |      else if ((op - ref >= 8) && (op_limit - op - len >= 8)) {
 2051|       |        // copy with an overlap not larger than 8
 2052|       |        wild_copy(op, ref, op + len);
 2053|       |        op += len;
 2054|       |      }
 2055|       |      else {
 2056|       |        op = copy_match(op, ref, (unsigned) len);
 2057|       |      }
 2058|       |#endif
 2059|  20.9k|    }
 2060|  32.4k|    else {
 2061|       |      // literal
 2062|  32.4k|      ctrl++;
 2063|  32.4k|#ifdef BLOSCLZ_WIDE_DECODE
 2064|       |      /* All literal lengths fit in one fixed-size copy when both buffers have room. */
 2065|  32.4k|      if (op_limit - op >= 32 && ip_limit - ip >= 32) {
  ------------------
  |  Branch (2065:11): [True: 32.0k, False: 376]
  |  Branch (2065:34): [True: 31.4k, False: 640]
  ------------------
 2066|  31.4k|        memcpy(op, ip, 32);
 2067|  31.4k|      }
 2068|  1.01k|      else
 2069|  1.01k|#endif
 2070|  1.01k|      {
 2071|  1.01k|        if (BLOSCLZ_UNLIKELY(ctrl > op_limit - op || ctrl > ip_limit - ip)) {
  ------------------
  |  |   52|  2.00k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:31): [True: 27, False: 989]
  |  |  |  Branch (52:31): [True: 47, False: 942]
  |  |  ------------------
  ------------------
 2072|     74|          return 0;
 2073|     74|        }
 2074|    942|        memcpy(op, ip, ctrl);
 2075|    942|      }
 2076|  32.3k|      op += ctrl; ip += ctrl;
 2077|       |
 2078|  32.3k|      if (BLOSCLZ_UNLIKELY(ip >= ip_limit)) break;
  ------------------
  |  |   52|  32.3k|#define BLOSCLZ_UNLIKELY(c)  (c)
  |  |  ------------------
  |  |  |  Branch (52:30): [True: 118, False: 32.2k]
  |  |  ------------------
  ------------------
 2079|  32.2k|      ctrl = *ip++;
 2080|  32.2k|    }
 2081|  63.5k|  }
 2082|       |
 2083|    133|  return (int)(op - (uint8_t*)output);
 2084|    434|}
blosclz-avx2.c:blosclz_copy_short_match:
 1308|  9.96k|BLOSCLZ_ALWAYS_INLINE void blosclz_copy_short_match(uint8_t *op, const uint8_t *ref, int32_t len) {
 1309|  9.96k|  ptrdiff_t dist = op - ref;
 1310|       |  /* Row d repeats the first d bytes. Row zero is the identity for distances
 1311|       |   * of at least 16, where each vector load already contains the next 16 bytes. */
 1312|  9.96k|  static const uint8_t repeat[16][16] = {
 1313|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
 1314|  9.96k|    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 1315|  9.96k|    {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
 1316|  9.96k|    {0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0},
 1317|  9.96k|    {0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3},
 1318|  9.96k|    {0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0},
 1319|  9.96k|    {0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3},
 1320|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1},
 1321|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7},
 1322|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6},
 1323|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5},
 1324|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4},
 1325|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3},
 1326|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2},
 1327|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 1},
 1328|  9.96k|    {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0},
 1329|  9.96k|  };
 1330|       |
 1331|       |  /* Compute the repeat-table row branchlessly (row 0 is identity for dist >= 16)
 1332|       |   * so GCC does not emit a mispredicting branch on dist < 16. */
 1333|  9.96k|  size_t row = (size_t)dist & ((size_t)0 - (size_t)(dist < 16));
 1334|       |#if defined(__aarch64__) || defined(_M_ARM64)
 1335|       |  uint8x16_t index = vld1q_u8(repeat[row]);
 1336|       |  vst1q_u8(op, vqtbl1q_u8(vld1q_u8(ref), index));
 1337|       |  if (len > 16) {
 1338|       |    vst1q_u8(op + 16, vqtbl1q_u8(vld1q_u8(ref + 16), index));
 1339|       |  }
 1340|       |#else
 1341|  9.96k|  __m128i index = _mm_loadu_si128((const __m128i *)repeat[row]);
 1342|  9.96k|  _mm_storeu_si128((__m128i *)op, _mm_shuffle_epi8(_mm_loadu_si128((const __m128i *)ref), index));
 1343|  9.96k|  if (len > 16) {
  ------------------
  |  Branch (1343:7): [True: 818, False: 9.14k]
  ------------------
 1344|    818|    _mm_storeu_si128((__m128i *)(op + 16), _mm_shuffle_epi8(_mm_loadu_si128((const __m128i *)(ref + 16)), index));
 1345|    818|  }
 1346|  9.96k|#endif
 1347|  9.96k|}
blosclz-avx2.c:blosclz_copy_match_avx2:
 1356|  20.9k|    uint8_t *op, const uint8_t *ref, int32_t len, uint8_t *op_limit) {
 1357|  20.9k|  ptrdiff_t dist = op - ref;
 1358|  20.9k|  uint8_t *end = op + len;
 1359|       |
 1360|  20.9k|  if (dist >= 32) {
  ------------------
  |  Branch (1360:7): [True: 7.98k, False: 12.9k]
  ------------------
 1361|       |    /* Short match overcopies when output slack permits (subsequent tokens overwrite excess). */
 1362|  7.98k|    if (len <= 16 && op_limit - op >= 16) {
  ------------------
  |  Branch (1362:9): [True: 112, False: 7.87k]
  |  Branch (1362:22): [True: 49, False: 63]
  ------------------
 1363|     49|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1364|     49|      return end;
 1365|     49|    }
 1366|  7.93k|    if (len <= 32 && op_limit - op >= 32) {
  ------------------
  |  Branch (1366:9): [True: 68, False: 7.87k]
  |  Branch (1366:22): [True: 0, False: 68]
  ------------------
 1367|      0|      _mm256_storeu_si256((__m256i *)op, _mm256_loadu_si256((const __m256i *)ref));
 1368|      0|      return end;
 1369|      0|    }
 1370|  7.93k|    if (len <= 64 && op_limit - op >= 64) {
  ------------------
  |  Branch (1370:9): [True: 1.53k, False: 6.40k]
  |  Branch (1370:22): [True: 1.46k, False: 71]
  ------------------
 1371|  1.46k|      _mm256_storeu_si256((__m256i *)op, _mm256_loadu_si256((const __m256i *)ref));
 1372|  1.46k|      _mm256_storeu_si256((__m256i *)(op + 32), _mm256_loadu_si256((const __m256i *)(ref + 32)));
 1373|  1.46k|      return end;
 1374|  1.46k|    }
 1375|  6.47k|    if (len >= 32) {
  ------------------
  |  Branch (1375:9): [True: 6.40k, False: 68]
  ------------------
 1376|  6.40k|      uint8_t *cur = op;
 1377|  6.40k|      const uint8_t *src = ref;
 1378|  6.40k|      if (dist >= 128) {
  ------------------
  |  Branch (1378:11): [True: 6.10k, False: 302]
  ------------------
 1379|       |        /* Non-overlapping 128B blocks: batch 4x32B loads before stores in 256B/128B steps. */
 1380|  22.0k|        while (cur + 256 <= end) {
  ------------------
  |  Branch (1380:16): [True: 15.9k, False: 6.10k]
  ------------------
 1381|  15.9k|          __m256i v0 = _mm256_loadu_si256((const __m256i *)src);
 1382|  15.9k|          __m256i v1 = _mm256_loadu_si256((const __m256i *)(src + 32));
 1383|  15.9k|          __m256i v2 = _mm256_loadu_si256((const __m256i *)(src + 64));
 1384|  15.9k|          __m256i v3 = _mm256_loadu_si256((const __m256i *)(src + 96));
 1385|  15.9k|          _mm256_storeu_si256((__m256i *)cur, v0);
 1386|  15.9k|          _mm256_storeu_si256((__m256i *)(cur + 32), v1);
 1387|  15.9k|          _mm256_storeu_si256((__m256i *)(cur + 64), v2);
 1388|  15.9k|          _mm256_storeu_si256((__m256i *)(cur + 96), v3);
 1389|  15.9k|          __m256i v4 = _mm256_loadu_si256((const __m256i *)(src + 128));
 1390|  15.9k|          __m256i v5 = _mm256_loadu_si256((const __m256i *)(src + 160));
 1391|  15.9k|          __m256i v6 = _mm256_loadu_si256((const __m256i *)(src + 192));
 1392|  15.9k|          __m256i v7 = _mm256_loadu_si256((const __m256i *)(src + 224));
 1393|  15.9k|          _mm256_storeu_si256((__m256i *)(cur + 128), v4);
 1394|  15.9k|          _mm256_storeu_si256((__m256i *)(cur + 160), v5);
 1395|  15.9k|          _mm256_storeu_si256((__m256i *)(cur + 192), v6);
 1396|  15.9k|          _mm256_storeu_si256((__m256i *)(cur + 224), v7);
 1397|  15.9k|          cur += 256;
 1398|  15.9k|          src += 256;
 1399|  15.9k|        }
 1400|  6.10k|        if (cur + 128 <= end) {
  ------------------
  |  Branch (1400:13): [True: 2.60k, False: 3.50k]
  ------------------
 1401|  2.60k|          __m256i v0 = _mm256_loadu_si256((const __m256i *)src);
 1402|  2.60k|          __m256i v1 = _mm256_loadu_si256((const __m256i *)(src + 32));
 1403|  2.60k|          __m256i v2 = _mm256_loadu_si256((const __m256i *)(src + 64));
 1404|  2.60k|          __m256i v3 = _mm256_loadu_si256((const __m256i *)(src + 96));
 1405|  2.60k|          _mm256_storeu_si256((__m256i *)cur, v0);
 1406|  2.60k|          _mm256_storeu_si256((__m256i *)(cur + 32), v1);
 1407|  2.60k|          _mm256_storeu_si256((__m256i *)(cur + 64), v2);
 1408|  2.60k|          _mm256_storeu_si256((__m256i *)(cur + 96), v3);
 1409|  2.60k|          cur += 128;
 1410|  2.60k|          src += 128;
 1411|  2.60k|        }
 1412|  6.10k|      }
 1413|    302|      else {
 1414|       |        /* Keep each 32B load/store ordered so distances in [32, 128) propagate safely. */
 1415|  6.47k|        while (cur + 128 <= end) {
  ------------------
  |  Branch (1415:16): [True: 6.17k, False: 302]
  ------------------
 1416|  6.17k|          _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1417|  6.17k|          _mm256_storeu_si256((__m256i *)(cur + 32), _mm256_loadu_si256((const __m256i *)(src + 32)));
 1418|  6.17k|          _mm256_storeu_si256((__m256i *)(cur + 64), _mm256_loadu_si256((const __m256i *)(src + 64)));
 1419|  6.17k|          _mm256_storeu_si256((__m256i *)(cur + 96), _mm256_loadu_si256((const __m256i *)(src + 96)));
 1420|  6.17k|          cur += 128;
 1421|  6.17k|          src += 128;
 1422|  6.17k|        }
 1423|    302|      }
 1424|       |      /* Finish remaining <128B using 64B/32B steps and an exact overlapping 32B tail. */
 1425|  6.40k|      if (cur + 64 <= end) {
  ------------------
  |  Branch (1425:11): [True: 3.86k, False: 2.54k]
  ------------------
 1426|  3.86k|        _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1427|  3.86k|        _mm256_storeu_si256((__m256i *)(cur + 32), _mm256_loadu_si256((const __m256i *)(src + 32)));
 1428|  3.86k|        cur += 64;
 1429|  3.86k|        src += 64;
 1430|  3.86k|      }
 1431|  6.40k|      if (cur + 32 <= end) {
  ------------------
  |  Branch (1431:11): [True: 2.43k, False: 3.97k]
  ------------------
 1432|  2.43k|        _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1433|  2.43k|        cur += 32;
 1434|  2.43k|      }
 1435|  6.40k|      if (cur < end) {
  ------------------
  |  Branch (1435:11): [True: 6.09k, False: 316]
  ------------------
 1436|  6.09k|        _mm256_storeu_si256((__m256i *)(end - 32), _mm256_loadu_si256((const __m256i *)(ref + len - 32)));
 1437|  6.09k|      }
 1438|  6.40k|      return end;
 1439|  6.40k|    }
 1440|       |    /* Exact 16..31-byte copy near end of buffer using two overlapping 16B stores. */
 1441|     68|    if (len >= 16) {
  ------------------
  |  Branch (1441:9): [True: 5, False: 63]
  ------------------
 1442|      5|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1443|      5|      _mm_storeu_si128((__m128i *)(end - 16), _mm_loadu_si128((const __m128i *)(ref + len - 16)));
 1444|      5|      return end;
 1445|      5|    }
 1446|     63|    return copy_match(op, ref, (unsigned)len);
 1447|     68|  }
 1448|       |
 1449|  12.9k|  if (dist >= 16) {
  ------------------
  |  Branch (1449:7): [True: 244, False: 12.7k]
  ------------------
 1450|       |    /* 16..31-byte overlap distance: single 16B overcopy for short matches. */
 1451|    244|    if (len <= 16 && op_limit - op >= 16) {
  ------------------
  |  Branch (1451:9): [True: 14, False: 230]
  |  Branch (1451:22): [True: 6, False: 8]
  ------------------
 1452|      6|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1453|      6|      return end;
 1454|      6|    }
 1455|    238|    if (len >= 32) {
  ------------------
  |  Branch (1455:9): [True: 229, False: 9]
  ------------------
 1456|       |      /* Seed first dist bytes so wide_dist = 2 * dist >= 32, enabling 32B AVX2 copies. */
 1457|    229|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1458|    229|      _mm_storeu_si128((__m128i *)(op + dist - 16), _mm_loadu_si128((const __m128i *)(ref + dist - 16)));
 1459|    229|      uint8_t *cur = op + dist;
 1460|    229|      const uint8_t *src = ref;
 1461|    229|      ptrdiff_t wide_dist = dist * 2;
 1462|  2.55k|      while (cur + 64 <= end) {
  ------------------
  |  Branch (1462:14): [True: 2.32k, False: 229]
  ------------------
 1463|  2.32k|        _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1464|  2.32k|        _mm256_storeu_si256((__m256i *)(cur + 32), _mm256_loadu_si256((const __m256i *)(src + 32)));
 1465|  2.32k|        cur += 64;
 1466|  2.32k|        src += 64;
 1467|  2.32k|      }
 1468|    229|      if (cur + 32 <= end) {
  ------------------
  |  Branch (1468:11): [True: 93, False: 136]
  ------------------
 1469|     93|        _mm256_storeu_si256((__m256i *)cur, _mm256_loadu_si256((const __m256i *)src));
 1470|     93|        cur += 32;
 1471|     93|        src += 32;
 1472|     93|      }
 1473|       |      /* Overlapping 32B tail if the wide loop ran; otherwise finish safely with 16B ops. */
 1474|    229|      if (cur < end) {
  ------------------
  |  Branch (1474:11): [True: 193, False: 36]
  ------------------
 1475|    193|        if (cur > op + dist) {
  ------------------
  |  Branch (1475:13): [True: 92, False: 101]
  ------------------
 1476|     92|          _mm256_storeu_si256((__m256i *)(end - 32), _mm256_loadu_si256((const __m256i *)(end - 32 - wide_dist)));
 1477|     92|        }
 1478|    101|        else {
 1479|    101|          if (cur + 16 <= end) {
  ------------------
  |  Branch (1479:15): [True: 46, False: 55]
  ------------------
 1480|     46|            _mm_storeu_si128((__m128i *)cur, _mm_loadu_si128((const __m128i *)src));
 1481|     46|            cur += 16;
 1482|     46|          }
 1483|    101|          if (cur < end) {
  ------------------
  |  Branch (1483:15): [True: 76, False: 25]
  ------------------
 1484|     76|            _mm_storeu_si128((__m128i *)(end - 16), _mm_loadu_si128((const __m128i *)(end - 16 - dist)));
 1485|     76|          }
 1486|    101|        }
 1487|    193|      }
 1488|    229|      return end;
 1489|    229|    }
 1490|       |    /* Exact 16..31-byte copy with two overlapping 16B stores. */
 1491|      9|    if (len >= 16) {
  ------------------
  |  Branch (1491:9): [True: 1, False: 8]
  ------------------
 1492|      1|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1493|      1|      if (len > 16) {
  ------------------
  |  Branch (1493:11): [True: 1, False: 0]
  ------------------
 1494|      1|        _mm_storeu_si128((__m128i *)(end - 16), _mm_loadu_si128((const __m128i *)(ref + len - 16)));
 1495|      1|      }
 1496|      1|      return end;
 1497|      1|    }
 1498|      8|    return copy_match(op, ref, (unsigned)len);
 1499|      9|  }
 1500|       |
 1501|  12.7k|  if (dist == 1) {
  ------------------
  |  Branch (1501:7): [True: 11.0k, False: 1.67k]
  ------------------
 1502|       |    /* Inline AVX2 RLE fills up to 256B to avoid memset call overhead; longer runs use memset. */
 1503|  11.0k|    if (len <= 32 && op_limit - op >= 32) {
  ------------------
  |  Branch (1503:9): [True: 13, False: 11.0k]
  |  Branch (1503:22): [True: 0, False: 13]
  ------------------
 1504|      0|      _mm256_storeu_si256((__m256i *)op, _mm256_set1_epi8((char)*ref));
 1505|      0|      return end;
 1506|      0|    }
 1507|  11.0k|    if (len <= 64 && op_limit - op >= 64) {
  ------------------
  |  Branch (1507:9): [True: 3.82k, False: 7.22k]
  |  Branch (1507:22): [True: 3.80k, False: 14]
  ------------------
 1508|  3.80k|      __m256i v = _mm256_set1_epi8((char)*ref);
 1509|  3.80k|      _mm256_storeu_si256((__m256i *)op, v);
 1510|  3.80k|      _mm256_storeu_si256((__m256i *)(op + 32), v);
 1511|  3.80k|      return end;
 1512|  3.80k|    }
 1513|  7.23k|    if (len >= 32 && len <= 256) {
  ------------------
  |  Branch (1513:9): [True: 7.22k, False: 13]
  |  Branch (1513:22): [True: 6.70k, False: 515]
  ------------------
 1514|  6.70k|      __m256i v = _mm256_set1_epi8((char)*ref);
 1515|  6.70k|      uint8_t *cur = op;
 1516|  18.6k|      while (cur + 64 <= end) {
  ------------------
  |  Branch (1516:14): [True: 11.9k, False: 6.70k]
  ------------------
 1517|  11.9k|        _mm256_storeu_si256((__m256i *)cur, v);
 1518|  11.9k|        _mm256_storeu_si256((__m256i *)(cur + 32), v);
 1519|  11.9k|        cur += 64;
 1520|  11.9k|      }
 1521|  6.70k|      if (cur + 32 <= end) {
  ------------------
  |  Branch (1521:11): [True: 4.84k, False: 1.86k]
  ------------------
 1522|  4.84k|        _mm256_storeu_si256((__m256i *)cur, v);
 1523|  4.84k|        cur += 32;
 1524|  4.84k|      }
 1525|  6.70k|      if (cur < end) {
  ------------------
  |  Branch (1525:11): [True: 6.68k, False: 20]
  ------------------
 1526|  6.68k|        _mm256_storeu_si256((__m256i *)(end - 32), v);
 1527|  6.68k|      }
 1528|  6.70k|      return end;
 1529|  6.70k|    }
 1530|    528|    memset(op, *ref, (size_t)len);
 1531|    528|    return end;
 1532|  7.23k|  }
 1533|       |
 1534|  1.67k|  if (dist >= 8) {
  ------------------
  |  Branch (1534:7): [True: 202, False: 1.47k]
  ------------------
 1535|       |    /* 8..15-byte overlap distance: fast short copies, or double distance to >=16B for loops. */
 1536|    202|    if (len <= dist && op_limit - op >= 16) {
  ------------------
  |  Branch (1536:9): [True: 17, False: 185]
  |  Branch (1536:24): [True: 8, False: 9]
  ------------------
 1537|      8|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1538|      8|      return end;
 1539|      8|    }
 1540|    194|    if (len <= 16 && op_limit - op >= 16) {
  ------------------
  |  Branch (1540:9): [True: 11, False: 183]
  |  Branch (1540:22): [True: 1, False: 10]
  ------------------
 1541|      1|      memcpy(op, ref, 8);
 1542|      1|      memcpy(op + 8, ref + 8, 8);
 1543|      1|      return end;
 1544|      1|    }
 1545|    193|    if (len > 16) {
  ------------------
  |  Branch (1545:9): [True: 183, False: 10]
  ------------------
 1546|       |      /* Seed first dist bytes so wide_dist = 2 * dist >= 16. */
 1547|    183|      _mm_storeu_si128((__m128i *)op, _mm_loadu_si128((const __m128i *)ref));
 1548|    183|      uint8_t *cur = op + dist;
 1549|    183|      const uint8_t *src = ref;
 1550|    183|      ptrdiff_t wide_dist = dist * 2;
 1551|  16.1k|      while (cur + 16 <= end) {
  ------------------
  |  Branch (1551:14): [True: 15.9k, False: 183]
  ------------------
 1552|  15.9k|        _mm_storeu_si128((__m128i *)cur, _mm_loadu_si128((const __m128i *)src));
 1553|  15.9k|        cur += 16;
 1554|  15.9k|        src += 16;
 1555|  15.9k|      }
 1556|       |      /* Finish tail via overlapping 16B copy if wide loop ran, else bytewise fallback. */
 1557|    183|      if (cur < end) {
  ------------------
  |  Branch (1557:11): [True: 148, False: 35]
  ------------------
 1558|    148|        if (cur > op + dist) {
  ------------------
  |  Branch (1558:13): [True: 143, False: 5]
  ------------------
 1559|    143|          _mm_storeu_si128((__m128i *)(end - 16), _mm_loadu_si128((const __m128i *)(end - 16 - wide_dist)));
 1560|    143|        }
 1561|      5|        else {
 1562|     31|          while (cur < end) {
  ------------------
  |  Branch (1562:18): [True: 26, False: 5]
  ------------------
 1563|     26|            *cur++ = *src++;
 1564|     26|          }
 1565|      5|        }
 1566|    148|      }
 1567|    183|      return end;
 1568|    183|    }
 1569|     10|    return copy_match(op, ref, (unsigned)len);
 1570|    193|  }
 1571|       |
 1572|  1.47k|  if ((dist == 2 || dist == 4) && len >= 16) {
  ------------------
  |  Branch (1572:8): [True: 360, False: 1.11k]
  |  Branch (1572:21): [True: 592, False: 521]
  |  Branch (1572:35): [True: 931, False: 21]
  ------------------
 1573|    931|    __m256i v256;
 1574|    931|    if (dist == 2) {
  ------------------
  |  Branch (1574:9): [True: 349, False: 582]
  ------------------
 1575|    349|      int16_t pat2;
 1576|    349|      memcpy(&pat2, ref, sizeof(pat2));
 1577|    349|      v256 = _mm256_set1_epi16(pat2);
 1578|    349|    }
 1579|    582|    else {
 1580|    582|      int32_t pat4;
 1581|    582|      memcpy(&pat4, ref, sizeof(pat4));
 1582|    582|      v256 = _mm256_set1_epi32(pat4);
 1583|    582|    }
 1584|    931|    __m128i v128 = _mm256_castsi256_si128(v256);
 1585|    931|    uint8_t *cur = op;
 1586|  18.6k|    while (cur + 64 <= end) {
  ------------------
  |  Branch (1586:12): [True: 17.6k, False: 931]
  ------------------
 1587|  17.6k|      _mm256_storeu_si256((__m256i *)cur, v256);
 1588|  17.6k|      _mm256_storeu_si256((__m256i *)(cur + 32), v256);
 1589|  17.6k|      cur += 64;
 1590|  17.6k|    }
 1591|    931|    if (cur + 32 <= end) {
  ------------------
  |  Branch (1591:9): [True: 713, False: 218]
  ------------------
 1592|    713|      _mm256_storeu_si256((__m256i *)cur, v256);
 1593|    713|      cur += 32;
 1594|    713|    }
 1595|    931|    if (cur + 16 <= end) {
  ------------------
  |  Branch (1595:9): [True: 693, False: 238]
  ------------------
 1596|    693|      _mm_storeu_si128((__m128i *)cur, v128);
 1597|    693|      cur += 16;
 1598|    693|    }
 1599|    931|    if (cur < end) {
  ------------------
  |  Branch (1599:9): [True: 871, False: 60]
  ------------------
 1600|    871|      if (op_limit - cur >= 16) {
  ------------------
  |  Branch (1600:11): [True: 864, False: 7]
  ------------------
 1601|    864|        _mm_storeu_si128((__m128i *)cur, v128);
 1602|    864|      }
 1603|      7|      else {
 1604|      7|        const uint8_t *tail_src = ref;
 1605|     52|        while (cur < end) {
  ------------------
  |  Branch (1605:16): [True: 45, False: 7]
  ------------------
 1606|     45|          *cur++ = *tail_src++;
 1607|     45|        }
 1608|      7|      }
 1609|    871|    }
 1610|    931|    return end;
 1611|    931|  }
 1612|       |
 1613|    542|  return copy_match(op, ref, (unsigned)len);
 1614|  1.47k|}

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

delta_decoder:
   97|   158k|                   int32_t typesize, uint8_t* dest) {
   98|   158k|  int32_t i;
   99|       |
  100|   158k|  if (offset == 0) {
  ------------------
  |  Branch (100:7): [True: 84.1k, False: 74.5k]
  ------------------
  101|       |    /* Decode delta for the reference block */
  102|  84.1k|    switch (typesize) {
  103|  33.2k|      case 1:
  ------------------
  |  Branch (103:7): [True: 33.2k, False: 50.9k]
  ------------------
  104|  6.60G|        for (i = 1; i < nbytes; i++) {
  ------------------
  |  Branch (104:21): [True: 6.60G, False: 33.2k]
  ------------------
  105|  6.60G|          dest[i] ^= dref[i-1];
  106|  6.60G|        }
  107|  33.2k|        break;
  108|    109|      case 2:
  ------------------
  |  Branch (108:7): [True: 109, False: 84.0k]
  ------------------
  109|  69.7k|        for (i = 1; i < nbytes / 2; i++) {
  ------------------
  |  Branch (109:21): [True: 69.6k, False: 109]
  ------------------
  110|  69.6k|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i-1];
  111|  69.6k|        }
  112|    109|        break;
  113|     92|      case 4:
  ------------------
  |  Branch (113:7): [True: 92, False: 84.0k]
  ------------------
  114|   124k|        for (i = 1; i < nbytes / 4; i++) {
  ------------------
  |  Branch (114:21): [True: 124k, False: 92]
  ------------------
  115|   124k|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i-1];
  116|   124k|        }
  117|     92|        break;
  118|  17.4k|      case 8:
  ------------------
  |  Branch (118:7): [True: 17.4k, False: 66.6k]
  ------------------
  119|  1.55G|        for (i = 1; i < nbytes / 8; i++) {
  ------------------
  |  Branch (119:21): [True: 1.55G, False: 17.4k]
  ------------------
  120|  1.55G|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i-1];
  121|  1.55G|        }
  122|  17.4k|        break;
  123|  33.2k|      default:
  ------------------
  |  Branch (123:7): [True: 33.2k, False: 50.9k]
  ------------------
  124|  33.2k|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (124:13): [True: 82, False: 33.1k]
  ------------------
  125|     82|          delta_decoder(dref, offset, nbytes, 8, dest);
  126|  33.1k|        } else {
  127|  33.1k|          delta_decoder(dref, offset, nbytes, 1, dest);
  128|  33.1k|        }
  129|  84.1k|    }
  130|  84.1k|  } else {
  131|       |    /* Decode delta for the non-reference blocks */
  132|  74.5k|    switch (typesize) {
  133|  29.4k|      case 1:
  ------------------
  |  Branch (133:7): [True: 29.4k, False: 45.0k]
  ------------------
  134|  4.44G|        for (i = 0; i < nbytes; i++) {
  ------------------
  |  Branch (134:21): [True: 4.44G, False: 29.4k]
  ------------------
  135|  4.44G|          dest[i] ^= dref[i];
  136|  4.44G|        }
  137|  29.4k|        break;
  138|     94|      case 2:
  ------------------
  |  Branch (138:7): [True: 94, False: 74.4k]
  ------------------
  139|  3.88k|        for (i = 0; i < nbytes / 2; i++) {
  ------------------
  |  Branch (139:21): [True: 3.78k, False: 94]
  ------------------
  140|  3.78k|          ((uint16_t *)dest)[i] ^= ((uint16_t *)dref)[i];
  141|  3.78k|        }
  142|     94|        break;
  143|     58|      case 4:
  ------------------
  |  Branch (143:7): [True: 58, False: 74.4k]
  ------------------
  144|  1.57k|        for (i = 0; i < nbytes / 4; i++) {
  ------------------
  |  Branch (144:21): [True: 1.51k, False: 58]
  ------------------
  145|  1.51k|          ((uint32_t *)dest)[i] ^= ((uint32_t *)dref)[i];
  146|  1.51k|        }
  147|     58|        break;
  148|  15.5k|      case 8:
  ------------------
  |  Branch (148:7): [True: 15.5k, False: 59.0k]
  ------------------
  149|   898M|        for (i = 0; i < nbytes / 8; i++) {
  ------------------
  |  Branch (149:21): [True: 898M, False: 15.5k]
  ------------------
  150|   898M|          ((uint64_t *)dest)[i] ^= ((uint64_t *)dref)[i];
  151|   898M|        }
  152|  15.5k|        break;
  153|  29.4k|      default:
  ------------------
  |  Branch (153:7): [True: 29.4k, False: 45.1k]
  ------------------
  154|  29.4k|        if ((typesize % 8) == 0) {
  ------------------
  |  Branch (154:13): [True: 51, False: 29.3k]
  ------------------
  155|     51|          delta_decoder(dref, offset, nbytes, 8, dest);
  156|  29.3k|        } else {
  157|  29.3k|          delta_decoder(dref, offset, nbytes, 1, dest);
  158|  29.3k|        }
  159|  74.5k|    }
  160|  74.5k|  }
  161|   158k|}

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

frame_reader_acquire:
  318|     20|void* frame_reader_acquire(blosc2_frame_s* frame, const blosc2_io* io) {
  319|     20|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
  320|     20|  if (io_cb == NULL) {
  ------------------
  |  Branch (320:7): [True: 0, False: 20]
  ------------------
  321|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  322|      0|    return NULL;
  323|      0|  }
  324|     20|  if (!reader_cacheable(io)) {
  ------------------
  |  Branch (324:7): [True: 0, False: 20]
  ------------------
  325|      0|    return io_cb->open(frame->urlpath, "rb", io->params);
  326|      0|  }
  327|       |#if defined(_WIN32)
  328|       |  // No handle caching on Windows.  The CRT opens files without
  329|       |  // FILE_SHARE_DELETE, so a cached handle turns every unlink or rename of the
  330|       |  // frame file into a sharing violation.  Callers that replace a frame rather
  331|       |  // than rewrite it in place -- python-blosc2 does, both via os.replace and via
  332|       |  // remove-then-recreate for mode="w" -- would get hard errors instead of the
  333|       |  // stale read that frame_reader_revalidate() handles elsewhere.  Caching here
  334|       |  // needs CreateFileW(..., FILE_SHARE_DELETE) plus POSIX-semantics deletion
  335|       |  // (Win10 1709+), which is only worth its cost once measured on Windows.
  336|       |  return io_cb->open(frame->urlpath, "rb", io->params);
  337|       |#else
  338|       |  // The cached handle pins the inode it was opened on, so a frame file that is
  339|       |  // replaced instead of rewritten in place would keep serving the old bytes.
  340|       |  // frame_reader_revalidate() catches that ahead of each header read.
  341|       |  //
  342|       |  // No unlocked fast path on read_fp: reading it outside the mutex races the
  343|       |  // store below (C11 data race, and TSan says so).  An uncontended lock is a
  344|       |  // handful of ns against the ~600 ns pread this hands a handle to.
  345|     20|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|     20|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  346|     20|  if (cache_slot_claim(frame->read_fp, &frame->read_fp_nocache)) {
  ------------------
  |  Branch (346:7): [True: 20, False: 0]
  ------------------
  347|     20|    cache_install(&frame->read_fp, &frame->read_fp_dev, &frame->read_fp_ino,
  348|     20|                  io_cb->open(frame->urlpath, "rb", io->params));
  349|     20|  }
  350|     20|  void* fp = frame->read_fp;
  351|     20|  if (fp != NULL) {
  ------------------
  |  Branch (351:7): [True: 0, False: 20]
  ------------------
  352|       |    // Held until the matching release, so nothing can close it underneath a
  353|       |    // caller that keeps it across several reads (frame_to_schunk does)
  354|      0|    frame->read_fp_refs++;
  355|      0|  }
  356|     20|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|     20|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  357|     20|  if (fp == NULL) {
  ------------------
  |  Branch (357:7): [True: 20, False: 0]
  ------------------
  358|       |    // Cache full (or the cached open failed): hand out a private handle, which
  359|       |    // the matching frame_reader_release() closes since it is not frame->read_fp
  360|     20|    fp = io_cb->open(frame->urlpath, "rb", io->params);
  361|     20|  }
  362|     20|  return fp;
  363|     20|#endif
  364|     20|}
frame_reader_invalidate:
  495|  7.02k|int frame_reader_invalidate(blosc2_frame_s* frame) {
  496|  7.02k|  blosc2_pthread_mutex_lock(&frame->read_fp_mutex);
  ------------------
  |  |   92|  7.02k|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  497|  7.02k|  int w_rc = frame_writer_close_locked(frame);
  498|  7.02k|  int r_rc = frame_reader_close_locked(frame, true);
  499|  7.02k|  blosc2_pthread_mutex_unlock(&frame->read_fp_mutex);
  ------------------
  |  |   93|  7.02k|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  500|  7.02k|  if (w_rc < 0) {
  ------------------
  |  Branch (500:7): [True: 0, False: 7.02k]
  ------------------
  501|      0|    return w_rc;
  502|      0|  }
  503|  7.02k|  return r_rc < 0 ? r_rc : BLOSC2_ERROR_SUCCESS;
  ------------------
  |  Branch (503:10): [True: 0, False: 7.02k]
  ------------------
  504|  7.02k|}
frame_lock:
  938|  76.4k|int frame_lock(blosc2_frame_s* frame, bool exclusive) {
  939|  76.4k|  if (frame == NULL || !frame->locking) {
  ------------------
  |  Branch (939:7): [True: 0, False: 76.4k]
  |  Branch (939:24): [True: 76.4k, False: 0]
  ------------------
  940|  76.4k|    return BLOSC2_ERROR_SUCCESS;
  941|  76.4k|  }
  942|      0|  if (frame->lock_depth > 0) {
  ------------------
  |  Branch (942:7): [True: 0, False: 0]
  ------------------
  943|       |    // Already held by this handle (a nested call); the outer lock covers us
  944|      0|    frame->lock_depth++;
  945|      0|    return BLOSC2_ERROR_SUCCESS;
  946|      0|  }
  947|      0|  if (frame->lock_fd == -1) {
  ------------------
  |  Branch (947:7): [True: 0, False: 0]
  ------------------
  948|       |    // Lazily open the sidecar, kept for the frame's lifetime
  949|      0|    char* path = frame_lock_path(frame);
  950|      0|    if (path == NULL) {
  ------------------
  |  Branch (950:9): [True: 0, False: 0]
  ------------------
  951|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
  952|      0|    }
  953|       |#if defined(_WIN32)
  954|       |    HANDLE h = CreateFileA(path, GENERIC_READ | GENERIC_WRITE,
  955|       |                           FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
  956|       |                           NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
  957|       |    if (h == INVALID_HANDLE_VALUE) {
  958|       |      BLOSC_TRACE_ERROR("Cannot open the lock file in: %s", path);
  959|       |      free(path);
  960|       |      return BLOSC2_ERROR_LOCK;
  961|       |    }
  962|       |    frame->lock_fd = (intptr_t)h;
  963|       |#else
  964|      0|    int fd = open(path, O_CREAT | O_RDWR | O_CLOEXEC, 0666);
  965|      0|    if (fd < 0) {
  ------------------
  |  Branch (965:9): [True: 0, False: 0]
  ------------------
  966|      0|      BLOSC_TRACE_ERROR("Cannot open the lock file in: %s", path);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  967|      0|      free(path);
  968|      0|      return BLOSC2_ERROR_LOCK;
  969|      0|    }
  970|      0|    frame->lock_fd = fd;
  971|      0|#endif
  972|      0|    free(path);
  973|      0|  }
  974|      0|  if (frame_os_lock(frame, exclusive) < 0) {
  ------------------
  |  Branch (974:7): [True: 0, False: 0]
  ------------------
  975|      0|    BLOSC_TRACE_ERROR("Cannot lock the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  976|      0|    return BLOSC2_ERROR_LOCK;
  977|      0|  }
  978|       |  // Generation counter: writers bump it, everyone compares it with the last
  979|       |  // value it saw.  This detects mutations by other handles exactly, even when
  980|       |  // the frame length on disk ends up unchanged (which the length-based
  981|       |  // staleness check in frame_refresh_if_stale() cannot see).
  982|      0|  uint64_t seq;
  983|      0|  if (frame_lock_read_seq(frame, &seq) < 0 ||
  ------------------
  |  Branch (983:7): [True: 0, False: 0]
  ------------------
  984|      0|      (exclusive && frame_lock_write_seq(frame, seq + 1) < 0)) {
  ------------------
  |  Branch (984:8): [True: 0, False: 0]
  |  Branch (984:21): [True: 0, False: 0]
  ------------------
  985|      0|    BLOSC_TRACE_ERROR("Cannot access the frame lock generation counter.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  986|      0|    frame_os_unlock(frame);
  987|      0|    return BLOSC2_ERROR_LOCK;
  988|      0|  }
  989|      0|  if (seq != frame->lock_seq) {
  ------------------
  |  Branch (989:7): [True: 0, False: 0]
  ------------------
  990|      0|    frame->force_refresh = true;
  991|      0|  }
  992|      0|  if (exclusive) {
  ------------------
  |  Branch (992:7): [True: 0, False: 0]
  ------------------
  993|      0|    seq++;
  994|      0|  }
  995|      0|  frame->lock_seq = seq;
  996|      0|  frame->lock_depth = 1;
  997|      0|  return BLOSC2_ERROR_SUCCESS;
  998|      0|}
frame_unlock:
 1001|  76.4k|int frame_unlock(blosc2_frame_s* frame) {
 1002|  76.4k|  if (frame == NULL || !frame->locking || frame->lock_depth == 0) {
  ------------------
  |  Branch (1002:7): [True: 0, False: 76.4k]
  |  Branch (1002:24): [True: 76.4k, False: 0]
  |  Branch (1002:43): [True: 0, False: 0]
  ------------------
 1003|  76.4k|    return BLOSC2_ERROR_SUCCESS;
 1004|  76.4k|  }
 1005|      0|  if (--frame->lock_depth > 0) {
  ------------------
  |  Branch (1005:7): [True: 0, False: 0]
  ------------------
 1006|      0|    return BLOSC2_ERROR_SUCCESS;
 1007|      0|  }
 1008|       |  // Hand our writes over before the next lock holder looks: closing the cached
 1009|       |  // writer is what pushes them to the server on NFS (close-to-open consistency).
 1010|       |  // A no-op unless this handle wrote since it last let go of the lock.
 1011|      0|  int close_rc = frame_writer_close(frame);
 1012|      0|  if (frame_os_unlock(frame) < 0) {
  ------------------
  |  Branch (1012:7): [True: 0, False: 0]
  ------------------
 1013|      0|    BLOSC_TRACE_ERROR("Cannot unlock the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1014|      0|    return BLOSC2_ERROR_LOCK;
 1015|      0|  }
 1016|      0|  return close_rc;
 1017|      0|}
frame_free:
 1021|  7.02k|int frame_free(blosc2_frame_s* frame) {
 1022|       |
 1023|  7.02k|  int rc = frame_reader_invalidate(frame);
 1024|  7.02k|  blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|  7.02k|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 1025|       |
 1026|  7.02k|  if (frame->locking && frame->lock_fd != -1) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 7.02k]
  |  Branch (1026:25): [True: 0, False: 0]
  ------------------
 1027|       |#if defined(_WIN32)
 1028|       |    CloseHandle((HANDLE)frame->lock_fd);
 1029|       |#else
 1030|      0|    close((int)frame->lock_fd);
 1031|      0|#endif
 1032|      0|  }
 1033|       |
 1034|  7.02k|  if (frame->cframe != NULL && !frame->avoid_cframe_free) {
  ------------------
  |  Branch (1034:7): [True: 7.02k, False: 0]
  |  Branch (1034:32): [True: 0, False: 7.02k]
  ------------------
 1035|      0|    free(frame->cframe);
 1036|      0|  }
 1037|       |
 1038|  7.02k|  if (frame->coffsets != NULL && frame->coffsets_needs_free) {
  ------------------
  |  Branch (1038:7): [True: 0, False: 7.02k]
  |  Branch (1038:34): [True: 0, False: 0]
  ------------------
 1039|      0|    free(frame->coffsets);
 1040|      0|  }
 1041|       |
 1042|  7.02k|  if (frame->urlpath != NULL) {
  ------------------
  |  Branch (1042:7): [True: 0, False: 7.02k]
  ------------------
 1043|      0|    free(frame->urlpath);
 1044|      0|  }
 1045|  7.02k|  free(frame->holes);
 1046|       |
 1047|  7.02k|  free(frame);
 1048|       |
 1049|  7.02k|  return rc;
 1050|  7.02k|}
get_header_info:
 1374|  86.7k|                    uint8_t *splitmode, uint8_t *use_dict, const blosc2_io *io) {
 1375|  86.7k|  uint8_t* framep = frame->cframe;
 1376|  86.7k|  uint8_t* header_ptr;
 1377|  86.7k|  uint8_t header[FRAME_HEADER_MINLEN];
 1378|       |
 1379|  86.7k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
 1380|  86.7k|  if (io_cb == NULL) {
  ------------------
  |  Branch (1380:7): [True: 0, False: 86.7k]
  ------------------
 1381|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1382|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1383|      0|  }
 1384|       |
 1385|  86.7k|  if (frame->len <= 0) {
  ------------------
  |  Branch (1385:7): [True: 0, False: 86.7k]
  ------------------
 1386|      0|    return BLOSC2_ERROR_READ_BUFFER;
 1387|      0|  }
 1388|       |
 1389|  86.7k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (1389:7): [True: 0, False: 86.7k]
  ------------------
 1390|      0|    int64_t rbytes = 0;
 1391|      0|    void* fp = NULL;
 1392|      0|    int64_t io_pos = 0;
 1393|      0|    if (frame->sframe) {
  ------------------
  |  Branch (1393:9): [True: 0, False: 0]
  ------------------
 1394|      0|      fp = sframe_open_index(frame->urlpath, "rb", io);
 1395|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1395:11): [True: 0, False: 0]
  ------------------
 1396|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1397|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1398|      0|      }
 1399|      0|    }
 1400|      0|    else {
 1401|       |      /* Ahead of the header read, not after it: everything downstream (and
 1402|       |         frame_refresh_if_stale in particular) trusts the length this read
 1403|       |         returns, so a stale handle here would pair old metadata with the
 1404|       |         replacement's bytes. */
 1405|      0|      frame_reader_revalidate(frame);
 1406|      0|      fp = frame_reader_acquire(frame, io);
 1407|      0|      if (fp == NULL) {
  ------------------
  |  Branch (1407:11): [True: 0, False: 0]
  ------------------
 1408|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1409|      0|        return BLOSC2_ERROR_FILE_OPEN;
 1410|      0|      }
 1411|      0|      io_pos = frame->file_offset;
 1412|      0|    }
 1413|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (1413:9): [True: 0, False: 0]
  ------------------
 1414|      0|      header_ptr = header;
 1415|      0|    rbytes = io_cb->read((void**)&header_ptr, 1, FRAME_HEADER_MINLEN, io_pos, fp);
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1416|      0|    frame_reader_release(frame, io_cb, fp);
 1417|      0|    if (rbytes != FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1417:9): [True: 0, False: 0]
  ------------------
 1418|      0|      return BLOSC2_ERROR_FILE_READ;
 1419|      0|    }
 1420|      0|    framep = header_ptr;
 1421|      0|  }
 1422|       |
 1423|       |  // Consistency check for frame type
 1424|  86.7k|  uint8_t frame_type = framep[FRAME_TYPE];
  ------------------
  |  |   33|  86.7k|#define FRAME_TYPE (FRAME_FLAGS + 1)  // 26
  |  |  ------------------
  |  |  |  |   32|  86.7k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  86.7k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  86.7k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  86.7k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1425|  86.7k|  uint8_t frame_version = framep[FRAME_FLAGS] & 0x0fu;
  ------------------
  |  |   32|  86.7k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  ------------------
  |  |  |  |   31|  86.7k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|  86.7k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   29|  86.7k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1426|  86.7k|  if (frame_version > BLOSC2_VERSION_FRAME_FORMAT) {
  ------------------
  |  Branch (1426:7): [True: 0, False: 86.7k]
  ------------------
 1427|      0|    BLOSC_TRACE_ERROR("Unsupported cframe version: %u", frame_version);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1428|      0|    return BLOSC2_ERROR_VERSION_SUPPORT;
 1429|      0|  }
 1430|  86.7k|  if (frame->sframe) {
  ------------------
  |  Branch (1430:7): [True: 0, False: 86.7k]
  ------------------
 1431|      0|    if (frame_type != FRAME_DIRECTORY_TYPE) {
  ------------------
  |  |   22|      0|#define FRAME_DIRECTORY_TYPE 1
  ------------------
  |  Branch (1431:9): [True: 0, False: 0]
  ------------------
 1432|      0|      return BLOSC2_ERROR_FRAME_TYPE;
 1433|      0|    }
 1434|  86.7k|  } else {
 1435|  86.7k|    if (frame_type != FRAME_CONTIGUOUS_TYPE) {
  ------------------
  |  |   21|  86.7k|#define FRAME_CONTIGUOUS_TYPE 0
  ------------------
  |  Branch (1435:9): [True: 0, False: 86.7k]
  ------------------
 1436|      0|      return BLOSC2_ERROR_FRAME_TYPE;
 1437|      0|    }
 1438|  86.7k|  }
 1439|       |
 1440|       |  // Fetch some internal lengths
 1441|  86.7k|  from_big(header_len, framep + FRAME_HEADER_LEN, sizeof(*header_len));
  ------------------
  |  |   38|  86.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1442|  86.7k|  if (*header_len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  86.7k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  86.7k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  86.7k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  86.7k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  86.7k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  86.7k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  86.7k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  86.7k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  86.7k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  86.7k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  86.7k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  86.7k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  86.7k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  86.7k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1442:7): [True: 0, False: 86.7k]
  ------------------
 1443|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1444|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1445|      0|  }
 1446|  86.7k|  from_big(frame_len, framep + FRAME_LEN, sizeof(*frame_len));
  ------------------
  |  |   38|  86.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1447|  86.7k|  if (*header_len > *frame_len) {
  ------------------
  |  Branch (1447:7): [True: 1, False: 86.7k]
  ------------------
 1448|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1449|      1|    return BLOSC2_ERROR_INVALID_HEADER;
 1450|      1|  }
 1451|  86.7k|  from_big(nbytes, framep + FRAME_NBYTES, sizeof(*nbytes));
  ------------------
  |  |   38|  86.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1452|  86.7k|  from_big(cbytes, framep + FRAME_CBYTES, sizeof(*cbytes));
  ------------------
  |  |   38|  86.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1453|  86.7k|  from_big(blocksize, framep + FRAME_BLOCKSIZE, sizeof(*blocksize));
  ------------------
  |  |   38|  86.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1454|  86.7k|  if (chunksize != NULL) {
  ------------------
  |  Branch (1454:7): [True: 86.7k, False: 0]
  ------------------
 1455|  86.7k|    from_big(chunksize, framep + FRAME_CHUNKSIZE, sizeof(*chunksize));
  ------------------
  |  |   38|  86.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1456|  86.7k|  }
 1457|  86.7k|  if (typesize != NULL) {
  ------------------
  |  Branch (1457:7): [True: 84.7k, False: 2.00k]
  ------------------
 1458|  84.7k|    from_big(typesize, framep + FRAME_TYPESIZE, sizeof(*typesize));
  ------------------
  |  |   38|  84.7k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1459|  84.7k|    if (*typesize <= 0) {
  ------------------
  |  Branch (1459:9): [True: 2, False: 84.7k]
  ------------------
 1460|      2|      BLOSC_TRACE_ERROR("`typesize` cannot be zero or negative.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1461|      2|      return BLOSC2_ERROR_INVALID_HEADER;
 1462|      2|    }
 1463|  84.7k|  }
 1464|       |
 1465|       |  // Codecs
 1466|  86.7k|  uint8_t frame_codecs = framep[FRAME_CODECS];
  ------------------
  |  |   34|  86.7k|#define FRAME_CODECS (FRAME_FLAGS + 2)  // 27
  |  |  ------------------
  |  |  |  |   32|  86.7k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  86.7k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  86.7k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  86.7k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1467|  86.7k|  if (clevel != NULL) {
  ------------------
  |  Branch (1467:7): [True: 7.01k, False: 79.7k]
  ------------------
 1468|  7.01k|    *clevel = frame_codecs >> 4u;
 1469|  7.01k|  }
 1470|  86.7k|  if (compcode != NULL) {
  ------------------
  |  Branch (1470:7): [True: 7.01k, False: 79.7k]
  ------------------
 1471|  7.01k|    *compcode = frame_codecs & 0xFu;
 1472|  7.01k|    if (*compcode == BLOSC_UDCODEC_FORMAT) {
  ------------------
  |  Branch (1472:9): [True: 170, False: 6.84k]
  ------------------
 1473|    170|      from_big(compcode, framep + FRAME_UDCODEC, sizeof(*compcode));
  ------------------
  |  |   38|    170|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1474|    170|    }
 1475|  7.01k|  }
 1476|       |
 1477|       |  // Other flags
 1478|  86.7k|  uint8_t other_flags = framep[FRAME_OTHER_FLAGS];
  ------------------
  |  |   35|  86.7k|#define FRAME_OTHER_FLAGS (FRAME_FLAGS + 3)  // 28
  |  |  ------------------
  |  |  |  |   32|  86.7k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  ------------------
  |  |  |  |  |  |   31|  86.7k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  86.7k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   29|  86.7k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1479|  86.7k|  if (splitmode != NULL) {
  ------------------
  |  Branch (1479:7): [True: 7.01k, False: 79.7k]
  ------------------
 1480|  7.01k|    *splitmode = (other_flags & 0x03u) + 1;
 1481|  7.01k|  }
 1482|       |
 1483|       |  // Other flags 2: bit 0 = use_dict
 1484|  86.7k|  if (use_dict != NULL) {
  ------------------
  |  Branch (1484:7): [True: 7.01k, False: 79.7k]
  ------------------
 1485|  7.01k|    *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   47|  7.01k|#define FRAME_OTHER_FLAGS2 (FRAME_FILTER_PIPELINE + 1 + 14)  // 85
  |  |  ------------------
  |  |  |  |   44|  7.01k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  7.01k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  7.01k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  7.01k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  7.01k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  7.01k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  7.01k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  7.01k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  7.01k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  7.01k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  7.01k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  7.01k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  7.01k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  *use_dict = (framep[FRAME_OTHER_FLAGS2] & FRAME_USE_DICT) ? 1 : 0;
  ------------------
  |  |   48|  7.01k|#define FRAME_USE_DICT (1U << 0)   //!< bit 0 of other_flags2: use dictionary compression
  ------------------
  |  Branch (1485:17): [True: 2.88k, False: 4.13k]
  ------------------
 1486|  7.01k|  }
 1487|       |
 1488|  86.7k|  if (compcode_meta != NULL) {
  ------------------
  |  Branch (1488:7): [True: 7.01k, False: 79.7k]
  ------------------
 1489|  7.01k|    from_big(compcode_meta, framep + FRAME_CODEC_META, sizeof(*compcode_meta));
  ------------------
  |  |   38|  7.01k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1490|  7.01k|  }
 1491|       |
 1492|       |  // Filters
 1493|  86.7k|  if (filters != NULL && filters_meta != NULL) {
  ------------------
  |  Branch (1493:7): [True: 7.01k, False: 79.7k]
  |  Branch (1493:26): [True: 7.01k, False: 0]
  ------------------
 1494|  7.01k|    uint8_t nfilters = framep[FRAME_FILTER_PIPELINE];
  ------------------
  |  |   44|  7.01k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  7.01k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  7.01k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  7.01k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  7.01k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  7.01k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  7.01k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  7.01k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  7.01k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  7.01k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  7.01k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  7.01k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  7.01k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1495|  7.01k|    if (nfilters > BLOSC2_MAX_FILTERS) {
  ------------------
  |  Branch (1495:9): [True: 1, False: 7.01k]
  ------------------
 1496|      1|      BLOSC_TRACE_ERROR("The number of filters in frame header are too large for Blosc2.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1497|      1|      return BLOSC2_ERROR_INVALID_HEADER;
 1498|      1|    }
 1499|  7.01k|    uint8_t *filters_ = framep + FRAME_FILTER_PIPELINE + 1;
  ------------------
  |  |   44|  7.01k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  7.01k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  7.01k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  7.01k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  7.01k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  7.01k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  7.01k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  7.01k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  7.01k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  7.01k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  7.01k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  7.01k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  7.01k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1500|  7.01k|    uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   44|  7.01k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  ------------------
  |  |  |  |   43|  7.01k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|  7.01k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   41|  7.01k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   40|  7.01k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   39|  7.01k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  7.01k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  7.01k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  7.01k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  7.01k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  7.01k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  7.01k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  7.01k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  uint8_t *filters_meta_ = framep + FRAME_FILTER_PIPELINE + 1 + FRAME_FILTER_PIPELINE_MAX;
  ------------------
  |  |   53|  7.01k|#define FRAME_FILTER_PIPELINE_MAX (8)  // the maximum number of filters that can be stored in header
  ------------------
 1501|  15.9k|    for (int i = 0; i < nfilters; i++) {
  ------------------
  |  Branch (1501:21): [True: 8.97k, False: 7.01k]
  ------------------
 1502|  8.97k|      filters[i] = filters_[i];
 1503|  8.97k|      filters_meta[i] = filters_meta_[i];
 1504|  8.97k|    }
 1505|  7.01k|  }
 1506|       |
 1507|  86.7k|  if (*nbytes > 0) {
  ------------------
  |  Branch (1507:7): [True: 86.6k, False: 80]
  ------------------
 1508|  86.6k|    if (*chunksize > 0) {
  ------------------
  |  Branch (1508:9): [True: 82.9k, False: 3.70k]
  ------------------
 1509|       |      // We can compute the number of chunks directly when there is a fixed chunk size.
 1510|  82.9k|      *nchunks = *nbytes / *chunksize;
 1511|  82.9k|      if (*nbytes % *chunksize > 0) {
  ------------------
  |  Branch (1511:11): [True: 78.9k, False: 3.97k]
  ------------------
 1512|  78.9k|        *nchunks += 1;
 1513|  78.9k|      }
 1514|       |
 1515|       |      // Sanity check for compressed sizes
 1516|  82.9k|      if ((*cbytes < 0) || ((int64_t)*nchunks * *chunksize < *nbytes)) {
  ------------------
  |  Branch (1516:11): [True: 2, False: 82.9k]
  |  Branch (1516:28): [True: 0, False: 82.9k]
  ------------------
 1517|      2|        BLOSC_TRACE_ERROR("Invalid compressed size 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1518|      2|        return BLOSC2_ERROR_INVALID_HEADER;
 1519|      2|      }
 1520|  82.9k|    }
 1521|  3.70k|    else if (*chunksize == 0) {
  ------------------
  |  Branch (1521:14): [True: 3.70k, False: 0]
  ------------------
 1522|  3.70k|      int32_t coffsets_nbytes;
 1523|  3.70k|      int rc2 = get_coffsets_nbytes(frame, *header_len, *cbytes, &coffsets_nbytes, io);
 1524|  3.70k|      if (rc2 < 0) {
  ------------------
  |  Branch (1524:11): [True: 8, False: 3.69k]
  ------------------
 1525|      8|        return rc2;
 1526|      8|      }
 1527|  3.69k|      if (coffsets_nbytes < 0 || coffsets_nbytes % (int32_t)sizeof(int64_t) != 0) {
  ------------------
  |  Branch (1527:11): [True: 0, False: 3.69k]
  |  Branch (1527:34): [True: 0, False: 3.69k]
  ------------------
 1528|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1529|      0|        return BLOSC2_ERROR_INVALID_HEADER;
 1530|      0|      }
 1531|  3.69k|      *nchunks = coffsets_nbytes / (int32_t)sizeof(int64_t);
 1532|  3.69k|    }
 1533|      0|    else {
 1534|      0|      BLOSC_TRACE_ERROR("Invalid chunk size in frame header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1535|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 1536|      0|    }
 1537|  86.6k|  } else {
 1538|     80|    *nchunks = 0;
 1539|     80|  }
 1540|       |
 1541|  86.7k|  if (*nchunks > 0) {
  ------------------
  |  Branch (1541:7): [True: 86.6k, False: 80]
  ------------------
 1542|  86.6k|    int32_t off_nbytes;
 1543|  86.6k|    if (!blosc2_nchunks_to_offsets_nbytes(*nchunks, &off_nbytes)) {
  ------------------
  |  Branch (1543:9): [True: 1, False: 86.6k]
  ------------------
 1544|      1|      BLOSC_TRACE_ERROR("Invalid number of chunks 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1545|      1|      return BLOSC2_ERROR_INVALID_HEADER;
 1546|      1|    }
 1547|  86.6k|  }
 1548|       |
 1549|  86.7k|  return 0;
 1550|  86.7k|}
get_trailer_offset:
 1553|    968|int64_t get_trailer_offset(blosc2_frame_s *frame, int32_t header_len, bool has_coffsets) {
 1554|    968|  if (!has_coffsets) {
  ------------------
  |  Branch (1554:7): [True: 7, False: 961]
  ------------------
 1555|       |    // No data chunks yet
 1556|      7|    return header_len;
 1557|      7|  }
 1558|    961|  return frame->len - frame->trailer_len;
 1559|    968|}
frame_from_cframe:
 2394|  7.03k|blosc2_frame_s* frame_from_cframe(uint8_t *cframe, int64_t len, bool copy) {
 2395|       |  // Get the length of the frame
 2396|  7.03k|  const uint8_t* header = cframe;
 2397|  7.03k|  int64_t frame_len;
 2398|  7.03k|  if (len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  7.03k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  7.03k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  7.03k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  7.03k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  7.03k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  7.03k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  7.03k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  7.03k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  7.03k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  7.03k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  7.03k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  7.03k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  7.03k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  7.03k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2398:7): [True: 0, False: 7.03k]
  ------------------
 2399|      0|    return NULL;
 2400|      0|  }
 2401|       |
 2402|  7.03k|  from_big(&frame_len, header + FRAME_LEN, sizeof(frame_len));
  ------------------
  |  |   38|  7.03k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2403|  7.03k|  if (frame_len != len) {   // sanity check
  ------------------
  |  Branch (2403:7): [True: 9, False: 7.02k]
  ------------------
 2404|      9|    return NULL;
 2405|      9|  }
 2406|       |
 2407|  7.02k|  blosc2_frame_s* frame = frame_alloc();
 2408|  7.02k|  if (frame == NULL) {
  ------------------
  |  Branch (2408:7): [True: 0, False: 7.02k]
  ------------------
 2409|      0|    return NULL;
 2410|      0|  }
 2411|  7.02k|  frame->len = frame_len;
 2412|  7.02k|  frame->file_offset = 0;
 2413|       |
 2414|       |  // Now, the trailer length
 2415|  7.02k|  const uint8_t* trailer = cframe + frame_len - FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|  7.02k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 2416|  7.02k|  int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   58|  7.02k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
                int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   59|  7.02k|#define FRAME_TRAILER_LEN_OFFSET (22)  // offset to trailer length (counting from the end)
  ------------------
 2417|  7.02k|  if (trailer[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (2417:7): [True: 0, False: 7.02k]
  ------------------
 2418|      0|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|      0|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 2419|      0|    free(frame);
 2420|      0|    return NULL;
 2421|      0|  }
 2422|  7.02k|  uint32_t trailer_len;
 2423|  7.02k|  from_big(&trailer_len, trailer + trailer_offset, sizeof(trailer_len));
  ------------------
  |  |   38|  7.02k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2424|  7.02k|  if (trailer_len < FRAME_TRAILER_MINLEN || trailer_len > INT32_MAX ||
  ------------------
  |  |   58|  14.0k|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (2424:7): [True: 0, False: 7.02k]
  |  Branch (2424:45): [True: 0, False: 7.02k]
  ------------------
 2425|  7.02k|      (int64_t)trailer_len > frame_len ||
  ------------------
  |  Branch (2425:7): [True: 1, False: 7.02k]
  ------------------
 2426|  7.02k|      (int64_t)trailer_len > frame_len - FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  7.02k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  7.02k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  7.02k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  7.02k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  7.02k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  7.02k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  7.02k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  7.02k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  7.02k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  7.02k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  7.02k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  7.02k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  7.02k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  7.02k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2426:7): [True: 0, False: 7.02k]
  ------------------
 2427|      1|    blosc2_pthread_mutex_destroy(&frame->read_fp_mutex);
  ------------------
  |  |   91|      1|#define blosc2_pthread_mutex_destroy(a) pthread_mutex_destroy((a))
  ------------------
 2428|      1|    free(frame);
 2429|      1|    return NULL;
 2430|      1|  }
 2431|  7.02k|  frame->trailer_len = trailer_len;
 2432|       |
 2433|  7.02k|  if (copy) {
  ------------------
  |  Branch (2433:7): [True: 0, False: 7.02k]
  ------------------
 2434|      0|    frame->cframe = malloc((size_t)len);
 2435|      0|    memcpy(frame->cframe, cframe, (size_t)len);
 2436|      0|  }
 2437|  7.02k|  else {
 2438|  7.02k|    frame->cframe = cframe;
 2439|  7.02k|    frame->avoid_cframe_free = true;
 2440|  7.02k|  }
 2441|       |
 2442|  7.02k|  return frame;
 2443|  7.02k|}
get_coffsets:
 2657|  84.6k|                      int64_t nchunks, int32_t *off_cbytes) {
 2658|  84.6k|  int32_t chunk_cbytes;
 2659|  84.6k|  int rc;
 2660|       |
 2661|  84.6k|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (2661:7): [True: 0, False: 84.6k]
  ------------------
 2662|      0|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2662:9): [True: 0, False: 0]
  ------------------
 2663|      0|      rc = blosc2_cbuffer_sizes(frame->coffsets, NULL, &chunk_cbytes, NULL);
 2664|      0|      if (rc < 0) {
  ------------------
  |  Branch (2664:11): [True: 0, False: 0]
  ------------------
 2665|      0|        return NULL;
 2666|      0|      }
 2667|      0|      *off_cbytes = (int32_t)chunk_cbytes;
 2668|      0|    }
 2669|      0|    return frame->coffsets;
 2670|      0|  }
 2671|  84.6k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (2671:7): [True: 84.6k, False: 0]
  ------------------
 2672|  84.6k|    int64_t off_pos = header_len;
 2673|  84.6k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (2673:9): [True: 2.83k, False: 81.8k]
  ------------------
 2674|  2.83k|      off_pos += cbytes;
 2675|  2.83k|    }
 2676|       |    // Check that there is enough room to read Blosc header
 2677|  84.6k|    if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (2677:9): [True: 0, False: 84.6k]
  |  Branch (2677:24): [True: 0, False: 84.6k]
  ------------------
 2678|  84.6k|        off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (2678:9): [True: 8, False: 84.6k]
  ------------------
 2679|      8|      BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|      8|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      8|    do {                                            \
  |  |  |  |   98|      8|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      8|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 8, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      8|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2680|      8|      return NULL;
 2681|      8|    }
 2682|       |    // For in-memory frames, the coffset is just one pointer away
 2683|  84.6k|    uint8_t* off_start = frame->cframe + off_pos;
 2684|  84.6k|    if (off_cbytes != NULL) {
  ------------------
  |  Branch (2684:9): [True: 84.6k, False: 0]
  ------------------
 2685|  84.6k|      int32_t chunk_nbytes;
 2686|  84.6k|      int32_t chunk_blocksize;
 2687|  84.6k|      rc = blosc2_cbuffer_sizes(off_start, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 2688|  84.6k|      if (rc < 0) {
  ------------------
  |  Branch (2688:11): [True: 8, False: 84.6k]
  ------------------
 2689|      8|        return NULL;
 2690|      8|      }
 2691|  84.6k|      *off_cbytes = (int32_t)chunk_cbytes;
 2692|  84.6k|      if (*off_cbytes < 0 || off_pos + *off_cbytes > frame->len) {
  ------------------
  |  Branch (2692:11): [True: 0, False: 84.6k]
  |  Branch (2692:30): [True: 4, False: 84.6k]
  ------------------
 2693|      4|        BLOSC_TRACE_ERROR("Cannot read the cbytes 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2694|      4|        return NULL;
 2695|      4|      }
 2696|  84.6k|      int32_t expected_off_nbytes;
 2697|  84.6k|      if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &expected_off_nbytes)) {
  ------------------
  |  Branch (2697:11): [True: 0, False: 84.6k]
  ------------------
 2698|      0|        BLOSC_TRACE_ERROR("Too many chunks for offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2699|      0|        return NULL;
 2700|      0|      }
 2701|  84.6k|      if (chunk_nbytes != expected_off_nbytes) {
  ------------------
  |  Branch (2701:11): [True: 6, False: 84.6k]
  ------------------
 2702|      6|        BLOSC_TRACE_ERROR("The number of chunks in offset idx "
  ------------------
  |  |   93|      6|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      6|    do {                                            \
  |  |  |  |   98|      6|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      6|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 6, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      6|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2703|      6|                          "does not match the ones in the header frame.");
 2704|      6|        return NULL;
 2705|      6|      }
 2706|       |
 2707|  84.6k|    }
 2708|  84.6k|    return off_start;
 2709|  84.6k|  }
 2710|       |
 2711|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 2712|       |
 2713|      0|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + FRAME_TRAILER_MINLEN > frame->len) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (2713:7): [True: 0, False: 0]
  |  Branch (2713:56): [True: 0, False: 0]
  ------------------
 2714|      0|    BLOSC_TRACE_ERROR("Cannot read the trailer out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2715|      0|    return NULL;
 2716|      0|  }
 2717|       |
 2718|      0|  int64_t coffsets_cbytes64;
 2719|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2719:7): [True: 0, False: 0]
  ------------------
 2720|      0|    coffsets_cbytes64 = trailer_offset - header_len;
 2721|      0|  }
 2722|      0|  else {
 2723|      0|    coffsets_cbytes64 = trailer_offset - (header_len + cbytes);
 2724|      0|  }
 2725|      0|  if (coffsets_cbytes64 <= 0 || coffsets_cbytes64 > INT32_MAX) {
  ------------------
  |  Branch (2725:7): [True: 0, False: 0]
  |  Branch (2725:33): [True: 0, False: 0]
  ------------------
 2726|      0|    BLOSC_TRACE_ERROR("Offsets chunk size is out of bounds.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2727|      0|    return NULL;
 2728|      0|  }
 2729|      0|  int32_t coffsets_cbytes = (int32_t)coffsets_cbytes64;
 2730|       |
 2731|      0|  if (off_cbytes != NULL) {
  ------------------
  |  Branch (2731:7): [True: 0, False: 0]
  ------------------
 2732|      0|    *off_cbytes = coffsets_cbytes;
 2733|      0|  }
 2734|       |
 2735|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 2736|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (2736:7): [True: 0, False: 0]
  ------------------
 2737|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2738|      0|    return NULL;
 2739|      0|  }
 2740|       |
 2741|      0|  void* fp = NULL;
 2742|      0|  uint8_t* coffsets;
 2743|      0|  if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (2743:7): [True: 0, False: 0]
  ------------------
 2744|      0|    coffsets = malloc((size_t)coffsets_cbytes);
 2745|      0|    frame->coffsets_needs_free = true;
 2746|      0|  }
 2747|      0|  else {
 2748|      0|    frame->coffsets_needs_free = false;
 2749|      0|  }
 2750|       |
 2751|      0|  int64_t io_pos = 0;
 2752|      0|  if (frame->sframe) {
  ------------------
  |  Branch (2752:7): [True: 0, False: 0]
  ------------------
 2753|      0|    fp = sframe_open_index(frame->urlpath, "rb",
 2754|      0|                           frame->schunk->storage->io);
 2755|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2755:9): [True: 0, False: 0]
  ------------------
 2756|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2757|      0|      return NULL;
 2758|      0|    }
 2759|      0|    io_pos = header_len + 0;
 2760|      0|  }
 2761|      0|  else {
 2762|      0|    fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 2763|      0|    if (fp == NULL) {
  ------------------
  |  Branch (2763:9): [True: 0, False: 0]
  ------------------
 2764|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2765|      0|      return NULL;
 2766|      0|    }
 2767|      0|    io_pos = frame->file_offset + header_len + cbytes;
 2768|      0|  }
 2769|      0|  int64_t rbytes = io_cb->read((void**)&coffsets, 1, coffsets_cbytes, io_pos, fp);
 2770|      0|  frame_reader_release(frame, io_cb, fp);
 2771|      0|  if (rbytes != coffsets_cbytes) {
  ------------------
  |  Branch (2771:7): [True: 0, False: 0]
  ------------------
 2772|      0|    BLOSC_TRACE_ERROR("Cannot read the offsets out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2773|      0|    if (frame->coffsets_needs_free)
  ------------------
  |  Branch (2773:9): [True: 0, False: 0]
  ------------------
 2774|      0|      free(coffsets);
 2775|      0|    return NULL;
 2776|      0|  }
 2777|      0|  frame->coffsets = coffsets;
 2778|      0|  return coffsets;
 2779|      0|}
frame_get_metalayers:
 3088|  1.03k|int frame_get_metalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 3089|  1.03k|  int32_t header_len;
 3090|  1.03k|  int64_t frame_len;
 3091|  1.03k|  int64_t nbytes;
 3092|  1.03k|  int64_t cbytes;
 3093|  1.03k|  int32_t blocksize;
 3094|  1.03k|  int32_t chunksize;
 3095|  1.03k|  int64_t nchunks;
 3096|  1.03k|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3097|  1.03k|                            &blocksize, &chunksize, &nchunks,
 3098|  1.03k|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3099|  1.03k|                            schunk->storage->io);
 3100|  1.03k|  if (ret < 0) {
  ------------------
  |  Branch (3100:7): [True: 0, False: 1.03k]
  ------------------
 3101|      0|    BLOSC_TRACE_ERROR("Unable to get the header info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3102|      0|    return ret;
 3103|      0|  }
 3104|       |
 3105|       |  // Get the header
 3106|  1.03k|  uint8_t* header = NULL;
 3107|  1.03k|  bool needs_free = false;
 3108|  1.03k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (3108:7): [True: 1.03k, False: 0]
  ------------------
 3109|  1.03k|    header = frame->cframe;
 3110|  1.03k|  } else {
 3111|      0|    int64_t rbytes = 0;
 3112|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3113|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (3113:9): [True: 0, False: 0]
  ------------------
 3114|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3115|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 3116|      0|    }
 3117|       |
 3118|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3118:9): [True: 0, False: 0]
  ------------------
 3119|      0|      header = malloc(header_len);
 3120|      0|      needs_free = true;
 3121|      0|    }
 3122|      0|    else {
 3123|      0|      needs_free = false;
 3124|      0|    }
 3125|       |
 3126|      0|    void* fp = NULL;
 3127|      0|    int64_t io_pos = 0;
 3128|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3128:9): [True: 0, False: 0]
  ------------------
 3129|      0|      fp = sframe_open_index(frame->urlpath, "rb",
 3130|      0|                             frame->schunk->storage->io);
 3131|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3131:11): [True: 0, False: 0]
  ------------------
 3132|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3133|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3134|      0|      }
 3135|      0|    }
 3136|      0|    else {
 3137|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 3138|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3138:11): [True: 0, False: 0]
  ------------------
 3139|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3140|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3141|      0|      }
 3142|      0|      io_pos = frame->file_offset;
 3143|      0|    }
 3144|      0|    if (fp != NULL) {
  ------------------
  |  Branch (3144:9): [True: 0, False: 0]
  ------------------
 3145|      0|      rbytes = io_cb->read((void**)&header, 1, header_len, io_pos, fp);
 3146|      0|      frame_reader_release(frame, io_cb, fp);
 3147|      0|    }
 3148|      0|    if (rbytes != header_len) {
  ------------------
  |  Branch (3148:9): [True: 0, False: 0]
  ------------------
 3149|      0|      BLOSC_TRACE_ERROR("Cannot access the header out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3150|      0|      if (needs_free)
  ------------------
  |  Branch (3150:11): [True: 0, False: 0]
  ------------------
 3151|      0|        free(header);
 3152|      0|      return BLOSC2_ERROR_FILE_READ;
 3153|      0|    }
 3154|      0|  }
 3155|       |
 3156|  1.03k|  ret = get_meta_from_header(frame, schunk, header, header_len);
 3157|       |
 3158|  1.03k|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (3158:7): [True: 0, False: 1.03k]
  |  Branch (3158:32): [True: 0, False: 0]
  ------------------
 3159|      0|    free(header);
 3160|      0|  }
 3161|       |
 3162|  1.03k|  return ret;
 3163|  1.03k|}
frame_get_vlmetalayers:
 3299|    968|int frame_get_vlmetalayers(blosc2_frame_s* frame, blosc2_schunk* schunk) {
 3300|    968|  int32_t header_len;
 3301|    968|  int64_t frame_len;
 3302|    968|  int64_t nbytes;
 3303|    968|  int64_t cbytes;
 3304|    968|  int32_t blocksize;
 3305|    968|  int32_t chunksize;
 3306|    968|  int64_t nchunks;
 3307|    968|  int ret = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 3308|    968|                            &blocksize, &chunksize, &nchunks,
 3309|    968|                            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 3310|    968|                            schunk->storage->io);
 3311|    968|  if (ret < 0) {
  ------------------
  |  Branch (3311:7): [True: 0, False: 968]
  ------------------
 3312|      0|    BLOSC_TRACE_ERROR("Unable to get the trailer info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3313|      0|    return ret;
 3314|      0|  }
 3315|       |
 3316|    968|  int64_t trailer_offset = get_trailer_offset(frame, header_len, nbytes > 0);
 3317|    968|  int32_t trailer_len = (int32_t) frame->trailer_len;
 3318|       |
 3319|    968|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + trailer_len > frame->len) {
  ------------------
  |  Branch (3319:7): [True: 0, False: 968]
  |  Branch (3319:56): [True: 1, False: 967]
  ------------------
 3320|      1|    BLOSC_TRACE_ERROR("Cannot access the trailer out 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3321|      1|    return BLOSC2_ERROR_READ_BUFFER;
 3322|      1|  }
 3323|       |
 3324|       |  // Get the trailer
 3325|    967|  uint8_t* trailer = NULL;
 3326|    967|  bool needs_free = false;
 3327|    967|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (3327:7): [True: 967, False: 0]
  ------------------
 3328|    967|    trailer = frame->cframe + trailer_offset;
 3329|    967|  } else {
 3330|      0|    int64_t rbytes = 0;
 3331|       |
 3332|      0|    blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 3333|      0|    if (io_cb == NULL) {
  ------------------
  |  Branch (3333:9): [True: 0, False: 0]
  ------------------
 3334|      0|      BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3335|      0|      return BLOSC2_ERROR_PLUGIN_IO;
 3336|      0|    }
 3337|       |
 3338|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3338:9): [True: 0, False: 0]
  ------------------
 3339|      0|      trailer = malloc(trailer_len);
 3340|      0|      needs_free = true;
 3341|      0|    }
 3342|      0|    else {
 3343|      0|      needs_free = false;
 3344|      0|    }
 3345|       |
 3346|      0|    void* fp = NULL;
 3347|      0|    int64_t io_pos = 0;
 3348|      0|    if (frame->sframe) {
  ------------------
  |  Branch (3348:9): [True: 0, False: 0]
  ------------------
 3349|       |      // Check for overflow before calculating length
 3350|      0|      if (strlen(frame->urlpath) > SIZE_MAX - strlen("/chunks.b2frame") - 1) {
  ------------------
  |  Branch (3350:11): [True: 0, False: 0]
  ------------------
 3351|      0|        BLOSC_TRACE_ERROR("Path too long for frame filename.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3352|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (3352:13): [True: 0, False: 0]
  ------------------
 3353|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 3354|      0|      }
 3355|      0|      size_t _len = strlen(frame->urlpath) + strlen("/chunks.b2frame") + 1;
 3356|      0|      char* eframe_name = malloc(_len);
 3357|      0|      if (eframe_name == NULL) {
  ------------------
  |  Branch (3357:11): [True: 0, False: 0]
  ------------------
 3358|      0|        BLOSC_TRACE_ERROR("Unable to allocate memory for frame filename.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3359|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (3359:13): [True: 0, False: 0]
  ------------------
 3360|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 3361|      0|      }
 3362|      0|      int _w = snprintf(eframe_name, _len, "%s/chunks.b2frame", frame->urlpath);
 3363|      0|      if (_w < 0 || (size_t)_w >= _len) {
  ------------------
  |  Branch (3363:11): [True: 0, False: 0]
  |  Branch (3363:21): [True: 0, False: 0]
  ------------------
 3364|      0|        BLOSC_TRACE_ERROR("Error building frame filename");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3365|      0|        free(eframe_name);
 3366|      0|        if (needs_free) free(trailer);
  ------------------
  |  Branch (3366:13): [True: 0, False: 0]
  ------------------
 3367|      0|        return BLOSC2_ERROR_INVALID_PARAM;
 3368|      0|      }
 3369|      0|      fp = io_cb->open(eframe_name, "rb", frame->schunk->storage->io->params);
 3370|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3370:11): [True: 0, False: 0]
  ------------------
 3371|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", eframe_name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3372|      0|        free(eframe_name);
 3373|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3374|      0|      }
 3375|      0|      free(eframe_name);
 3376|      0|      io_pos = trailer_offset;
 3377|      0|    }
 3378|      0|    else {
 3379|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 3380|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3380:11): [True: 0, False: 0]
  ------------------
 3381|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3382|      0|        return BLOSC2_ERROR_FILE_OPEN;
 3383|      0|      }
 3384|      0|      io_pos = frame->file_offset + trailer_offset;
 3385|      0|    }
 3386|      0|    if (fp != NULL) {
  ------------------
  |  Branch (3386:9): [True: 0, False: 0]
  ------------------
 3387|      0|      rbytes = io_cb->read((void**)&trailer, 1, trailer_len, io_pos, fp);
 3388|      0|      frame_reader_release(frame, io_cb, fp);
 3389|      0|    }
 3390|      0|    if (rbytes != trailer_len) {
  ------------------
  |  Branch (3390:9): [True: 0, False: 0]
  ------------------
 3391|      0|      BLOSC_TRACE_ERROR("Cannot access the trailer out of the fileframe.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3392|      0|      if (needs_free)
  ------------------
  |  Branch (3392:11): [True: 0, False: 0]
  ------------------
 3393|      0|        free(trailer);
 3394|      0|      return BLOSC2_ERROR_FILE_READ;
 3395|      0|    }
 3396|      0|  }
 3397|       |
 3398|    967|  ret = get_vlmeta_from_trailer(frame, schunk, trailer, trailer_len);
 3399|       |
 3400|    967|  if (frame->cframe == NULL && needs_free) {
  ------------------
  |  Branch (3400:7): [True: 0, False: 967]
  |  Branch (3400:32): [True: 0, False: 0]
  ------------------
 3401|      0|    free(trailer);
 3402|      0|  }
 3403|       |
 3404|    967|  return ret;
 3405|    967|}
get_new_storage:
 3411|  7.00k|                                const blosc2_io* iodefaults) {
 3412|       |
 3413|  7.00k|  blosc2_storage* new_storage = (blosc2_storage*)calloc(1, sizeof(blosc2_storage));
 3414|  7.00k|  memcpy(new_storage, storage, sizeof(blosc2_storage));
 3415|  7.00k|  if (storage->urlpath != NULL) {
  ------------------
  |  Branch (3415:7): [True: 0, False: 7.00k]
  ------------------
 3416|      0|    char* urlpath = normalize_urlpath(storage->urlpath);
 3417|      0|    new_storage->urlpath = malloc(strlen(urlpath) + 1);
 3418|      0|    strcpy(new_storage->urlpath, urlpath);
 3419|      0|  }
 3420|       |
 3421|       |  // cparams
 3422|  7.00k|  blosc2_cparams* cparams = malloc(sizeof(blosc2_cparams));
 3423|  7.00k|  if (storage->cparams != NULL) {
  ------------------
  |  Branch (3423:7): [True: 0, False: 7.00k]
  ------------------
 3424|      0|    memcpy(cparams, storage->cparams, sizeof(blosc2_cparams));
 3425|  7.00k|  } else {
 3426|  7.00k|    memcpy(cparams, cdefaults, sizeof(blosc2_cparams));
 3427|  7.00k|  }
 3428|  7.00k|  new_storage->cparams = cparams;
 3429|       |
 3430|       |  // dparams
 3431|  7.00k|  blosc2_dparams* dparams = malloc(sizeof(blosc2_dparams));
 3432|  7.00k|  if (storage->dparams != NULL) {
  ------------------
  |  Branch (3432:7): [True: 0, False: 7.00k]
  ------------------
 3433|      0|    memcpy(dparams, storage->dparams, sizeof(blosc2_dparams));
 3434|      0|  }
 3435|  7.00k|  else {
 3436|  7.00k|    memcpy(dparams, ddefaults, sizeof(blosc2_dparams));
 3437|  7.00k|  }
 3438|  7.00k|  new_storage->dparams = dparams;
 3439|       |
 3440|       |  // iodefaults
 3441|  7.00k|  blosc2_io* udio = malloc(sizeof(blosc2_io));
 3442|  7.00k|  if (storage->io != NULL) {
  ------------------
  |  Branch (3442:7): [True: 0, False: 7.00k]
  ------------------
 3443|      0|    memcpy(udio, storage->io, sizeof(blosc2_io));
 3444|      0|  }
 3445|  7.00k|  else {
 3446|  7.00k|    memcpy(udio, iodefaults, sizeof(blosc2_io));
 3447|  7.00k|  }
 3448|  7.00k|  new_storage->io = udio;
 3449|       |
 3450|  7.00k|  return new_storage;
 3451|  7.00k|}
frame_to_schunk:
 3515|  7.02k|blosc2_schunk* frame_to_schunk(blosc2_frame_s* frame, bool copy, const blosc2_io *udio) {
 3516|  7.02k|  int32_t header_len;
 3517|  7.02k|  int64_t frame_len;
 3518|  7.02k|  int rc;
 3519|  7.02k|  bool frame_attached = true;
 3520|  7.02k|  blosc2_schunk* schunk = calloc(1, sizeof(blosc2_schunk));
 3521|  7.02k|  blosc2_cparams *cparams = NULL;
 3522|  7.02k|  blosc2_dparams *dparams = NULL;
 3523|  7.02k|  int64_t *offsets = NULL;
 3524|  7.02k|  if (schunk == NULL) {
  ------------------
  |  Branch (3524:7): [True: 0, False: 7.02k]
  ------------------
 3525|      0|    return NULL;
 3526|      0|  }
 3527|  7.02k|  schunk->frame = (blosc2_frame*)frame;
 3528|  7.02k|  frame->schunk = schunk;
 3529|       |
 3530|  7.02k|  rc = get_header_info(frame, &header_len, &frame_len, &schunk->nbytes,
 3531|  7.02k|                       &schunk->cbytes, &schunk->blocksize,
 3532|  7.02k|                       &schunk->chunksize, &schunk->nchunks, &schunk->typesize,
 3533|  7.02k|                       &schunk->compcode, &schunk->compcode_meta, &schunk->clevel, schunk->filters,
 3534|  7.02k|                       schunk->filters_meta, &schunk->splitmode, &schunk->use_dict, udio);
 3535|  7.02k|  if (rc < 0) {
  ------------------
  |  Branch (3535:7): [True: 15, False: 7.00k]
  ------------------
 3536|     15|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3537|     15|    goto error;
 3538|     15|  }
 3539|  7.00k|  int64_t nchunks = schunk->nchunks;
 3540|  7.00k|  int64_t nbytes = schunk->nbytes;
 3541|  7.00k|  (void) nbytes;
 3542|  7.00k|  int64_t cbytes = schunk->cbytes;
 3543|       |
 3544|       |  // Compression and decompression contexts
 3545|  7.00k|  blosc2_schunk_get_cparams(schunk, &cparams);
 3546|  7.00k|  schunk->cctx = blosc2_create_cctx(*cparams);
 3547|  7.00k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (3547:7): [True: 5, False: 7.00k]
  ------------------
 3548|      5|    BLOSC_TRACE_ERROR("Error while creating the compression context");
  ------------------
  |  |   93|      5|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      5|    do {                                            \
  |  |  |  |   98|      5|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      5|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 5, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      5|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3549|      5|    goto error;
 3550|      5|  }
 3551|  7.00k|  blosc2_schunk_get_dparams(schunk, &dparams);
 3552|  7.00k|  schunk->dctx = blosc2_create_dctx(*dparams);
 3553|  7.00k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (3553:7): [True: 0, False: 7.00k]
  ------------------
 3554|      0|    BLOSC_TRACE_ERROR("Error while creating the decompression context");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3555|      0|    goto error;
 3556|      0|  }
 3557|  7.00k|  blosc2_storage storage = {.contiguous = copy ? false : true};
  ------------------
  |  Branch (3557:43): [True: 0, False: 7.00k]
  ------------------
 3558|  7.00k|  schunk->storage = get_new_storage(&storage, cparams, dparams, udio);
 3559|  7.00k|  free(cparams);
 3560|  7.00k|  cparams = NULL;
 3561|  7.00k|  free(dparams);
 3562|  7.00k|  dparams = NULL;
 3563|  7.00k|  if (nchunks > 0) {
  ------------------
  |  Branch (3563:7): [True: 6.96k, False: 36]
  ------------------
 3564|  6.96k|    rc = validate_offsets_chunk(frame, header_len, cbytes, nchunks);
 3565|  6.96k|    if (rc < 0) {
  ------------------
  |  Branch (3565:9): [True: 5.72k, False: 1.23k]
  ------------------
 3566|  5.72k|      BLOSC_TRACE_ERROR("Cannot validate frame offsets.");
  ------------------
  |  |   93|  5.72k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  5.72k|    do {                                            \
  |  |  |  |   98|  5.72k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  5.72k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 5.72k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  5.72k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3567|  5.72k|      goto error;
 3568|  5.72k|    }
 3569|  6.96k|  }
 3570|  1.27k|  if (nchunks > 0) {
  ------------------
  |  Branch (3570:7): [True: 1.23k, False: 36]
  ------------------
 3571|  1.23k|    uint8_t *chunk;
 3572|  1.23k|    bool needs_free;
 3573|       |    // A lazy chunk is enough here: only the header is needed for the flags2 byte
 3574|  1.23k|    rc = frame_get_lazychunk(frame, 0, &chunk, &needs_free);
 3575|  1.23k|    if (rc < 0) {
  ------------------
  |  Branch (3575:9): [True: 238, False: 998]
  ------------------
 3576|    238|      BLOSC_TRACE_ERROR("Cannot inspect the first chunk in frame.");
  ------------------
  |  |   93|    238|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    238|    do {                                            \
  |  |  |  |   98|    238|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    238|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 238, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    238|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3577|    238|      goto error;
 3578|    238|    }
 3579|    998|    schunk->flags2 = (rc >= BLOSC_EXTENDED_HEADER_LENGTH) ? chunk[BLOSC2_CHUNK_BLOSC2_FLAGS2] : 0;
  ------------------
  |  Branch (3579:22): [True: 998, False: 0]
  ------------------
 3580|    998|    if (needs_free) {
  ------------------
  |  Branch (3580:9): [True: 525, False: 473]
  ------------------
 3581|    525|      free(chunk);
 3582|    525|    }
 3583|    998|  }
 3584|  1.03k|  if (!copy) {
  ------------------
  |  Branch (3584:7): [True: 1.03k, False: 0]
  ------------------
 3585|  1.03k|    goto out;
 3586|  1.03k|  }
 3587|       |
 3588|       |  // We are not attached to a frame anymore
 3589|      0|  schunk->frame = NULL;
 3590|      0|  frame_attached = false;
 3591|       |
 3592|      0|  if (nchunks == 0) {
  ------------------
  |  Branch (3592:7): [True: 0, False: 0]
  ------------------
 3593|      0|    frame->schunk = NULL;
 3594|      0|    goto out;
 3595|      0|  }
 3596|       |
 3597|       |  // Get the compressed offsets
 3598|      0|  int32_t coffsets_cbytes = 0;
 3599|      0|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 3600|      0|  if (coffsets == NULL) {
  ------------------
  |  Branch (3600:7): [True: 0, False: 0]
  ------------------
 3601|      0|    BLOSC_TRACE_ERROR("Cannot get the offsets for the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3602|      0|    goto error;
 3603|      0|  }
 3604|       |
 3605|       |  // Decompress offsets
 3606|      0|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 3607|      0|  blosc2_context *dctx = blosc2_create_dctx(off_dparams);
 3608|      0|  if (dctx == NULL) {
  ------------------
  |  Branch (3608:7): [True: 0, False: 0]
  ------------------
 3609|      0|    BLOSC_TRACE_ERROR("Error while creating the decompression context");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3610|      0|    goto error;
 3611|      0|  }
 3612|      0|  int32_t offsets_nbytes;
 3613|      0|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (3613:7): [True: 0, False: 0]
  ------------------
 3614|      0|    blosc2_free_ctx(dctx);
 3615|      0|    BLOSC_TRACE_ERROR("Too many chunks for offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3616|      0|    goto error;
 3617|      0|  }
 3618|      0|  offsets = (int64_t *) malloc((size_t)offsets_nbytes);
 3619|      0|  if (offsets == NULL) {
  ------------------
  |  Branch (3619:7): [True: 0, False: 0]
  ------------------
 3620|      0|    blosc2_free_ctx(dctx);
 3621|      0|    BLOSC_TRACE_ERROR("Cannot allocate memory for offsets.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3622|      0|    goto error;
 3623|      0|  }
 3624|      0|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 3625|      0|                                             offsets, offsets_nbytes);
 3626|      0|  blosc2_free_ctx(dctx);
 3627|      0|  if (off_nbytes < 0) {
  ------------------
  |  Branch (3627:7): [True: 0, False: 0]
  ------------------
 3628|      0|    BLOSC_TRACE_ERROR("Cannot decompress the offsets chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3629|      0|    goto error;
 3630|      0|  }
 3631|       |
 3632|       |  // We want the contiguous schunk, so create the actual data chunks (and, while doing this,
 3633|       |  // get a guess at the blocksize used in this frame)
 3634|      0|  int64_t acc_nbytes = 0;
 3635|      0|  int64_t acc_cbytes = 0;
 3636|      0|  int32_t blocksize = 0;
 3637|      0|  int32_t chunk_nbytes;
 3638|      0|  int32_t chunk_cbytes;
 3639|      0|  int32_t chunk_blocksize;
 3640|      0|  size_t prev_alloc = BLOSC_EXTENDED_HEADER_LENGTH;
 3641|      0|  uint8_t* data_chunk = NULL;
 3642|      0|  bool needs_free = false;
 3643|      0|  const blosc2_io_cb *io_cb = blosc2_get_io_cb(udio->id);
 3644|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (3644:7): [True: 0, False: 0]
  ------------------
 3645|      0|    blosc2_schunk_free(schunk);
 3646|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3647|      0|    return NULL;
 3648|      0|  }
 3649|       |
 3650|      0|  void* fp = NULL;
 3651|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3651:7): [True: 0, False: 0]
  ------------------
 3652|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (3652:9): [True: 0, False: 0]
  ------------------
 3653|      0|      data_chunk = malloc((size_t)prev_alloc);
 3654|      0|      needs_free = true;
 3655|      0|    }
 3656|      0|    else {
 3657|      0|      needs_free = false;
 3658|      0|    }
 3659|       |
 3660|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3660:9): [True: 0, False: 0]
  ------------------
 3661|       |      // If not the chunks won't be in the frame
 3662|      0|      fp = frame_reader_acquire(frame, udio);
 3663|      0|      if (fp == NULL) {
  ------------------
  |  Branch (3663:11): [True: 0, False: 0]
  ------------------
 3664|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3665|      0|        rc = BLOSC2_ERROR_FILE_OPEN;
 3666|      0|        goto end;
 3667|      0|      }
 3668|      0|    }
 3669|      0|  }
 3670|       |  /* calloc(): the loop below can stop at a bad chunk, and the error path frees
 3671|       |     every data[i] with i < nchunks, also the ones never set */
 3672|      0|  schunk->data = calloc(nchunks, sizeof(void*));
 3673|      0|  if (schunk->data == NULL && nchunks > 0) {
  ------------------
  |  Branch (3673:7): [True: 0, False: 0]
  |  Branch (3673:31): [True: 0, False: 0]
  ------------------
 3674|      0|    BLOSC_TRACE_ERROR("Cannot allocate the chunk pointers.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3675|      0|    rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3676|      0|    goto end;
 3677|      0|  }
 3678|      0|  for (int64_t i = 0; i < nchunks; i++) {
  ------------------
  |  Branch (3678:23): [True: 0, False: 0]
  ------------------
 3679|      0|    if (frame->cframe != NULL) {
  ------------------
  |  Branch (3679:9): [True: 0, False: 0]
  ------------------
 3680|      0|      if (needs_free) {
  ------------------
  |  Branch (3680:11): [True: 0, False: 0]
  ------------------
 3681|      0|        free(data_chunk);
 3682|      0|      }
 3683|      0|      if (offsets[i] < 0) {
  ------------------
  |  Branch (3683:11): [True: 0, False: 0]
  ------------------
 3684|      0|        int64_t rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3685|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3685:13): [True: 0, False: 0]
  ------------------
 3686|      0|          break;
 3687|      0|        }
 3688|      0|      }
 3689|      0|      else {
 3690|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3690:13): [True: 0, False: 0]
  ------------------
 3691|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3691:13): [True: 0, False: 0]
  ------------------
 3692|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3692:13): [True: 0, False: 0]
  ------------------
 3693|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3694|      0|          break;
 3695|      0|        }
 3696|      0|        data_chunk = frame->cframe + header_len + offsets[i];
 3697|      0|        needs_free = false;
 3698|      0|      }
 3699|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3700|      0|      if (rc < 0) {
  ------------------
  |  Branch (3700:11): [True: 0, False: 0]
  ------------------
 3701|      0|        break;
 3702|      0|      }
 3703|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3703:11): [True: 0, False: 0]
  ------------------
 3704|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3704:12): [True: 0, False: 0]
  ------------------
 3705|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3705:12): [True: 0, False: 0]
  ------------------
 3706|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3706:12): [True: 0, False: 0]
  ------------------
 3707|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3708|      0|        break;
 3709|      0|      }
 3710|      0|    }
 3711|      0|    else {
 3712|      0|      int64_t rbytes;
 3713|      0|      if (offsets[i] < 0 || frame->sframe) {
  ------------------
  |  Branch (3713:11): [True: 0, False: 0]
  |  Branch (3713:29): [True: 0, False: 0]
  ------------------
 3714|      0|        if (needs_free) {
  ------------------
  |  Branch (3714:13): [True: 0, False: 0]
  ------------------
 3715|      0|          free(data_chunk);
 3716|      0|        }
 3717|      0|        rbytes = frame_get_chunk(frame, i, &data_chunk, &needs_free);
 3718|      0|        if (rbytes < 0) {
  ------------------
  |  Branch (3718:13): [True: 0, False: 0]
  ------------------
 3719|      0|          break;
 3720|      0|        }
 3721|      0|      }
 3722|      0|      else {
 3723|      0|        if (offsets[i] > INT64_MAX - header_len ||
  ------------------
  |  Branch (3723:13): [True: 0, False: 0]
  ------------------
 3724|      0|            header_len + offsets[i] > frame->len - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3724:13): [True: 0, False: 0]
  ------------------
 3725|      0|            offsets[i] > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3725:13): [True: 0, False: 0]
  ------------------
 3726|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 3727|      0|          break;
 3728|      0|        }
 3729|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3730|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 3731|      0|      }
 3732|      0|      if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3732:11): [True: 0, False: 0]
  ------------------
 3733|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 3734|      0|        break;
 3735|      0|      }
 3736|      0|      rc = blosc2_cbuffer_sizes(data_chunk, NULL, &chunk_cbytes, NULL);
 3737|      0|      if (rc < 0) {
  ------------------
  |  Branch (3737:11): [True: 0, False: 0]
  ------------------
 3738|      0|        break;
 3739|      0|      }
 3740|      0|      if (offsets[i] >= 0 &&
  ------------------
  |  Branch (3740:11): [True: 0, False: 0]
  ------------------
 3741|      0|          (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3741:12): [True: 0, False: 0]
  ------------------
 3742|      0|           offsets[i] > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (3742:12): [True: 0, False: 0]
  ------------------
 3743|      0|           offsets[i] + chunk_cbytes > cbytes)) {
  ------------------
  |  Branch (3743:12): [True: 0, False: 0]
  ------------------
 3744|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 3745|      0|        break;
 3746|      0|      }
 3747|      0|      if (chunk_cbytes > (int32_t)prev_alloc) {
  ------------------
  |  Branch (3747:11): [True: 0, False: 0]
  ------------------
 3748|      0|        if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (3748:13): [True: 0, False: 0]
  ------------------
 3749|      0|          data_chunk = realloc(data_chunk, chunk_cbytes);
 3750|      0|        if (data_chunk == NULL) {
  ------------------
  |  Branch (3750:13): [True: 0, False: 0]
  ------------------
 3751|      0|          BLOSC_TRACE_ERROR("Cannot realloc space for the data_chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3752|      0|          rc = BLOSC2_ERROR_MEMORY_ALLOC;
 3753|      0|          break;
 3754|      0|        }
 3755|      0|        prev_alloc = chunk_cbytes;
 3756|      0|      }
 3757|      0|      if (!frame->sframe) {
  ------------------
  |  Branch (3757:11): [True: 0, False: 0]
  ------------------
 3758|      0|        int64_t io_pos = frame->file_offset + header_len + offsets[i];
 3759|      0|        rbytes = io_cb->read((void**)&data_chunk, 1, chunk_cbytes, io_pos, fp);
 3760|      0|        if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (3760:13): [True: 0, False: 0]
  ------------------
 3761|      0|          rc = BLOSC2_ERROR_READ_BUFFER;
 3762|      0|          break;
 3763|      0|        }
 3764|      0|      }
 3765|      0|    }
 3766|      0|    uint8_t* new_chunk = malloc(chunk_cbytes);
 3767|      0|    memcpy(new_chunk, data_chunk, chunk_cbytes);
 3768|      0|    schunk->data[i] = new_chunk;
 3769|      0|    rc = blosc2_cbuffer_sizes(data_chunk, &chunk_nbytes, NULL, &chunk_blocksize);
 3770|      0|    if (rc < 0) {
  ------------------
  |  Branch (3770:9): [True: 0, False: 0]
  ------------------
 3771|      0|      break;
 3772|      0|    }
 3773|      0|    acc_nbytes += chunk_nbytes;
 3774|      0|    acc_cbytes += chunk_cbytes;
 3775|      0|    if (i == 0) {
  ------------------
  |  Branch (3775:9): [True: 0, False: 0]
  ------------------
 3776|      0|      blocksize = chunk_blocksize;
 3777|      0|    }
 3778|      0|    else if (blocksize != chunk_blocksize) {
  ------------------
  |  Branch (3778:14): [True: 0, False: 0]
  ------------------
 3779|       |      // Blocksize varies
 3780|      0|      blocksize = 0;
 3781|      0|    }
 3782|      0|  }
 3783|       |
 3784|       |  // We are not attached to a schunk anymore
 3785|      0|  frame->schunk = NULL;
 3786|       |
 3787|      0|  end:
 3788|      0|  if (needs_free) {
  ------------------
  |  Branch (3788:7): [True: 0, False: 0]
  ------------------
 3789|      0|    free(data_chunk);
 3790|      0|  }
 3791|      0|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (3791:7): [True: 0, False: 0]
  ------------------
 3792|      0|    if (!frame->sframe) {
  ------------------
  |  Branch (3792:9): [True: 0, False: 0]
  ------------------
 3793|      0|      frame_reader_release(frame, io_cb, fp);
 3794|      0|    }
 3795|      0|  }
 3796|      0|  free(offsets);
 3797|       |  // Avoid a double-free in the `error:` cleanup below, which is reached
 3798|       |  // when frame_get_metalayers / frame_get_vlmetalayers reject a malformed
 3799|       |  // metalayer index after we've already freed `offsets` here.
 3800|      0|  offsets = NULL;
 3801|       |
 3802|       |  // cframes and sframes have different ways to store chunks with special values:
 3803|       |  // 1) cframes represent special chunks as negative offsets
 3804|       |  // 2) sframes does not have the concept of offsets, but rather of data pointers (.data)
 3805|       |  //    so they always have a pointer to a special chunk
 3806|       |  // This is why cframes and sframes have different cbytes and hence, we cannot enforce acc_bytes == schunk->cbytes
 3807|       |  // In the future, maybe we could provide special meanings for .data[i] > 0x7FFFFFFF, but not there yet
 3808|       |  // if (rc < 0 || acc_nbytes != nbytes || acc_cbytes != cbytes) {
 3809|      0|  if (rc < 0 || acc_nbytes != nbytes) {
  ------------------
  |  Branch (3809:7): [True: 0, False: 0]
  |  Branch (3809:17): [True: 0, False: 0]
  ------------------
 3810|      0|    goto error;
 3811|      0|  }
 3812|       |  // Update counters
 3813|      0|  schunk->cbytes = acc_cbytes;
 3814|      0|  schunk->blocksize = blocksize;
 3815|       |
 3816|  1.03k|  out:
 3817|  1.03k|  rc = frame_get_metalayers(frame, schunk);
 3818|  1.03k|  if (rc < 0) {
  ------------------
  |  Branch (3818:7): [True: 66, False: 968]
  ------------------
 3819|     66|    BLOSC_TRACE_ERROR("Cannot access the metalayers.");
  ------------------
  |  |   93|     66|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     66|    do {                                            \
  |  |  |  |   98|     66|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     66|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 66, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     66|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3820|     66|    goto error;
 3821|     66|  }
 3822|       |
 3823|    968|  rc = frame_get_vlmetalayers(frame, schunk);
 3824|    968|  if (rc < 0) {
  ------------------
  |  Branch (3824:7): [True: 96, False: 872]
  ------------------
 3825|     96|    BLOSC_TRACE_ERROR("Cannot access the vlmetalayers.");
  ------------------
  |  |   93|     96|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     96|    do {                                            \
  |  |  |  |   98|     96|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     96|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 96, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     96|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3826|     96|    goto error;
 3827|     96|  }
 3828|       |
 3829|    872|  return schunk;
 3830|       |
 3831|  6.14k|error:
 3832|  6.14k|  free(cparams);
 3833|  6.14k|  free(dparams);
 3834|  6.14k|  free(offsets);
 3835|  6.14k|  if (schunk != NULL) {
  ------------------
  |  Branch (3835:7): [True: 6.14k, False: 0]
  ------------------
 3836|  6.14k|    blosc2_schunk_free(schunk);
 3837|  6.14k|  }
 3838|  6.14k|  if (!frame_attached) {
  ------------------
  |  Branch (3838:7): [True: 0, False: 6.14k]
  ------------------
 3839|      0|    frame->schunk = NULL;
 3840|      0|    frame_free(frame);
 3841|      0|  }
 3842|       |  return NULL;
 3843|    968|}
get_coffset:
 3865|  77.7k|                int64_t nchunk, int64_t nchunks, int64_t *offset) {
 3866|  77.7k|  int32_t off_cbytes;
 3867|       |  // Get the offset to nchunk
 3868|  77.7k|  uint8_t *coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &off_cbytes);
 3869|  77.7k|  if (coffsets == NULL) {
  ------------------
  |  Branch (3869:7): [True: 0, False: 77.7k]
  ------------------
 3870|      0|    BLOSC_TRACE_ERROR("Cannot get the offset for chunk %" PRId64 " for the frame.", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3871|      0|    return BLOSC2_ERROR_DATA;
 3872|      0|  }
 3873|       |
 3874|       |  // Get the 64-bit offset
 3875|  77.7k|  int rc = blosc2_getitem(coffsets, off_cbytes, (int32_t)nchunk, 1, offset, (int32_t)sizeof(int64_t));
 3876|  77.7k|  if (rc < 0) {
  ------------------
  |  Branch (3876:7): [True: 19, False: 77.6k]
  ------------------
 3877|     19|    BLOSC_TRACE_ERROR("Problems retrieving a chunk offset.");
  ------------------
  |  |   93|     19|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     19|    do {                                            \
  |  |  |  |   98|     19|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     19|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 19, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     19|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3878|  77.6k|  } else if (!frame->sframe && *offset >= 0) {
  ------------------
  |  Branch (3878:14): [True: 77.6k, False: 0]
  |  Branch (3878:32): [True: 46.4k, False: 31.2k]
  ------------------
 3879|  46.4k|    if (cbytes < 0 || cbytes > INT64_MAX - header_len) {
  ------------------
  |  Branch (3879:9): [True: 0, False: 46.4k]
  |  Branch (3879:23): [True: 38, False: 46.4k]
  ------------------
 3880|     38|      BLOSC_TRACE_ERROR("Invalid compressed size in frame header.");
  ------------------
  |  |   93|     38|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     38|    do {                                            \
  |  |  |  |   98|     38|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     38|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 38, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     38|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3881|     38|      return BLOSC2_ERROR_INVALID_HEADER;
 3882|     38|    }
 3883|  46.4k|    if (*offset > INT64_MAX - header_len) {
  ------------------
  |  Branch (3883:9): [True: 0, False: 46.4k]
  ------------------
 3884|      0|      BLOSC_TRACE_ERROR("Offset for chunk %" PRId64 " overflows frame position.", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3885|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 3886|      0|    }
 3887|  46.4k|    int64_t chunk_pos = header_len + *offset;
 3888|  46.4k|    int64_t data_limit = header_len + cbytes;
 3889|  46.4k|    if (chunk_pos < header_len ||
  ------------------
  |  Branch (3889:9): [True: 0, False: 46.4k]
  ------------------
 3890|  46.4k|        chunk_pos > data_limit - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (3890:9): [True: 3, False: 46.4k]
  ------------------
 3891|  46.4k|        chunk_pos > frame->len - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3891:9): [True: 262, False: 46.1k]
  ------------------
 3892|    265|      BLOSC_TRACE_ERROR("Cannot read chunk %" PRId64 " outside of frame boundary.", nchunk);
  ------------------
  |  |   93|    265|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    265|    do {                                            \
  |  |  |  |   98|    265|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    265|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 265, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    265|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3893|    265|      return BLOSC2_ERROR_INVALID_HEADER;
 3894|    265|    }
 3895|  46.4k|  }
 3896|       |
 3897|  77.4k|  return rc;
 3898|  77.7k|}
frame_special_chunk:
 4081|  31.2k|                        uint8_t** chunk, int32_t cbytes, bool *needs_free) {
 4082|  31.2k|  *chunk = malloc(cbytes);
 4083|  31.2k|  *needs_free = true;
 4084|  31.2k|  int rc = *chunk == NULL ? BLOSC2_ERROR_MEMORY_ALLOC
  ------------------
  |  Branch (4084:12): [True: 0, False: 31.2k]
  ------------------
 4085|  31.2k|                          : special_chunk_into(special_value, nbytes, typesize, blocksize, *chunk, cbytes);
 4086|  31.2k|  if (rc < 0) {
  ------------------
  |  Branch (4086:7): [True: 44, False: 31.1k]
  ------------------
 4087|     44|    free(*chunk);
 4088|     44|    *needs_free = false;
 4089|     44|    *chunk = NULL;
 4090|     44|  }
 4091|       |
 4092|  31.2k|  return rc;
 4093|  31.2k|}
frame_get_lazychunk:
 4290|  1.23k|int frame_get_lazychunk(blosc2_frame_s *frame, int64_t nchunk, uint8_t **chunk, bool *needs_free) {
 4291|  1.23k|  int32_t header_len;
 4292|  1.23k|  int64_t frame_len;
 4293|  1.23k|  int64_t nbytes;
 4294|  1.23k|  int64_t cbytes;
 4295|  1.23k|  int32_t blocksize;
 4296|  1.23k|  int32_t chunksize;
 4297|  1.23k|  int64_t nchunks;
 4298|  1.23k|  int32_t typesize;
 4299|  1.23k|  int32_t lazychunk_cbytes;
 4300|  1.23k|  int64_t offset;
 4301|  1.23k|  void* fp = NULL;
 4302|  1.23k|  int32_t* block_csizes = NULL;
 4303|  1.23k|  struct csize_idx *csize_idx = NULL;
 4304|       |
 4305|  1.23k|  *chunk = NULL;
 4306|  1.23k|  *needs_free = false;
 4307|  1.23k|  int rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 4308|  1.23k|                           &blocksize, &chunksize, &nchunks,
 4309|  1.23k|                           &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 4310|  1.23k|                           frame->schunk->storage->io);
 4311|  1.23k|  if (rc < 0) {
  ------------------
  |  Branch (4311:7): [True: 0, False: 1.23k]
  ------------------
 4312|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4313|      0|    return rc;
 4314|      0|  }
 4315|  1.23k|  rc = frame_refresh_if_stale(frame, frame_len);
 4316|  1.23k|  if (rc < 0) {
  ------------------
  |  Branch (4316:7): [True: 0, False: 1.23k]
  ------------------
 4317|      0|    BLOSC_TRACE_ERROR("Unable to refresh the frame state from disk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4318|      0|    return rc;
 4319|      0|  }
 4320|  1.23k|  if (rc > 0) {
  ------------------
  |  Branch (4320:7): [True: 0, False: 1.23k]
  ------------------
 4321|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state
 4322|       |    // (see frame_get_chunk).
 4323|      0|    frame->schunk->nbytes = nbytes;
 4324|      0|    frame->schunk->cbytes = cbytes;
 4325|      0|    frame->schunk->nchunks = nchunks;
 4326|      0|  }
 4327|       |
 4328|  1.23k|  if (nchunk >= nchunks) {
  ------------------
  |  Branch (4328:7): [True: 0, False: 1.23k]
  ------------------
 4329|      0|    BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') exceeds the number of chunks "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4330|      0|                      "('%" PRId64 "') in frame.", nchunk, nchunks);
 4331|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4332|      0|  }
 4333|       |
 4334|       |  // Get the offset to nchunk
 4335|  1.23k|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 4336|  1.23k|  if (rc < 0) {
  ------------------
  |  Branch (4336:7): [True: 193, False: 1.04k]
  ------------------
 4337|    193|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    193|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    193|    do {                                            \
  |  |  |  |   98|    193|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    193|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 193, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    193|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4338|    193|    return rc;
 4339|    193|  }
 4340|       |
 4341|  1.04k|  if (offset < 0) {
  ------------------
  |  Branch (4341:7): [True: 541, False: 502]
  ------------------
 4342|       |    // Special value
 4343|    541|    if (chunksize <= 0) {
  ------------------
  |  Branch (4343:9): [True: 3, False: 538]
  ------------------
 4344|      3|      BLOSC_TRACE_ERROR("Cannot synthesize special chunk with chunksize <= 0.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4345|      3|      return BLOSC2_ERROR_INVALID_HEADER;
 4346|      3|    }
 4347|    538|    lazychunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 4348|    538|    int32_t chunksize_ = chunksize;
 4349|    538|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (4349:9): [True: 27, False: 511]
  |  Branch (4349:36): [True: 26, False: 1]
  ------------------
 4350|       |      // Last chunk is incomplete.  Compute its actual size.
 4351|     26|      chunksize_ = (int32_t) (nbytes % chunksize);
 4352|     26|    }
 4353|    538|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk,
 4354|    538|                             (int32_t)lazychunk_cbytes, needs_free);
 4355|    538|    goto end;
 4356|    541|  }
 4357|       |
 4358|    502|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 4359|    502|  if (io_cb == NULL) {
  ------------------
  |  Branch (4359:7): [True: 0, False: 502]
  ------------------
 4360|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4361|      0|    rc = BLOSC2_ERROR_PLUGIN_IO;
 4362|      0|    goto end;
 4363|      0|  }
 4364|       |
 4365|    502|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (4365:7): [True: 0, False: 502]
  ------------------
 4366|       |    // TODO: make this portable across different endianness
 4367|       |    // Get info for building a lazy chunk
 4368|      0|    int32_t chunk_nbytes;
 4369|      0|    int32_t chunk_cbytes;
 4370|      0|    int32_t chunk_blocksize;
 4371|      0|    uint8_t* header_ptr;
 4372|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 4373|      0|    int64_t io_pos = 0;
 4374|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4374:9): [True: 0, False: 0]
  ------------------
 4375|       |      // The chunk is not in the frame
 4376|      0|      fp = sframe_open_chunk(frame->urlpath, offset, "rb",
 4377|      0|                             frame->schunk->storage->io);
 4378|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4378:11): [True: 0, False: 0]
  ------------------
 4379|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4380|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4381|      0|      }
 4382|      0|    }
 4383|      0|    else {
 4384|      0|      fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 4385|      0|      if (fp == NULL) {
  ------------------
  |  Branch (4385:11): [True: 0, False: 0]
  ------------------
 4386|      0|        BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4387|      0|        return BLOSC2_ERROR_FILE_OPEN;
 4388|      0|      }
 4389|      0|      io_pos = frame->file_offset + header_len + offset;
 4390|      0|    }
 4391|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (4391:9): [True: 0, False: 0]
  ------------------
 4392|      0|      header_ptr = header;
 4393|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 4394|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4394:9): [True: 0, False: 0]
  ------------------
 4395|      0|      BLOSC_TRACE_ERROR("Cannot read the header for chunk in the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4396|      0|      rc = BLOSC2_ERROR_FILE_READ;
 4397|      0|      goto end;
 4398|      0|    }
 4399|      0|    rc = blosc2_cbuffer_sizes(header_ptr, &chunk_nbytes, &chunk_cbytes, &chunk_blocksize);
 4400|      0|    if (rc < 0) {
  ------------------
  |  Branch (4400:9): [True: 0, False: 0]
  ------------------
 4401|      0|      goto end;
 4402|      0|    }
 4403|      0|    if (chunk_nbytes < 0 || chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH || chunk_blocksize <= 0) {
  ------------------
  |  Branch (4403:9): [True: 0, False: 0]
  |  Branch (4403:29): [True: 0, False: 0]
  |  Branch (4403:76): [True: 0, False: 0]
  ------------------
 4404|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4405|      0|      goto end;
 4406|      0|    }
 4407|      0|    bool vlblocks = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS2] & BLOSC2_VL_BLOCKS) != 0;
 4408|      0|    size_t nblocks;
 4409|      0|    size_t leftover_block = 0;
 4410|      0|    if (vlblocks) {
  ------------------
  |  Branch (4410:9): [True: 0, False: 0]
  ------------------
 4411|      0|      nblocks = (size_t)chunk_blocksize;
 4412|      0|    }
 4413|      0|    else {
 4414|      0|      nblocks = (size_t)chunk_nbytes / (size_t)chunk_blocksize;
 4415|      0|      leftover_block = (size_t)chunk_nbytes % (size_t)chunk_blocksize;
 4416|      0|      if (leftover_block) {
  ------------------
  |  Branch (4416:11): [True: 0, False: 0]
  ------------------
 4417|      0|        if (nblocks == SIZE_MAX) {
  ------------------
  |  Branch (4417:13): [True: 0, False: 0]
  ------------------
 4418|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4419|      0|          goto end;
 4420|      0|        }
 4421|      0|        nblocks += 1;
 4422|      0|      }
 4423|      0|    }
 4424|      0|    if (nblocks == 0 || nblocks > (size_t)INT_MAX) {
  ------------------
  |  Branch (4424:9): [True: 0, False: 0]
  |  Branch (4424:25): [True: 0, False: 0]
  ------------------
 4425|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4426|      0|      goto end;
 4427|      0|    }
 4428|       |    // Allocate space for the lazy chunk
 4429|      0|    int32_t special_type = (header_ptr[BLOSC2_CHUNK_BLOSC2_FLAGS] >> 4) & BLOSC2_SPECIAL_MASK;
 4430|      0|    int memcpyed = header_ptr[BLOSC2_CHUNK_FLAGS] & (uint8_t) BLOSC_MEMCPYED;
 4431|       |
 4432|      0|    int32_t trailer_offset;
 4433|      0|    size_t streams_offset = BLOSC_EXTENDED_HEADER_LENGTH;
 4434|      0|    size_t trailer_offset_sz = BLOSC_EXTENDED_HEADER_LENGTH;
 4435|      0|    size_t trailer_len_sz = 0;
 4436|      0|    size_t lazychunk_cbytes_sz = 0;
 4437|      0|    size_t bstarts_nbytes = 0;
 4438|      0|    if (special_type == 0) {
  ------------------
  |  Branch (4438:9): [True: 0, False: 0]
  ------------------
 4439|      0|      if (nblocks > SIZE_MAX / sizeof(int32_t)) {
  ------------------
  |  Branch (4439:11): [True: 0, False: 0]
  ------------------
 4440|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4441|      0|        goto end;
 4442|      0|      }
 4443|      0|      bstarts_nbytes = nblocks * sizeof(int32_t);
 4444|       |
 4445|      0|      if (!memcpyed) {
  ------------------
  |  Branch (4445:11): [True: 0, False: 0]
  ------------------
 4446|      0|        if ((size_t)chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4446:13): [True: 0, False: 0]
  ------------------
 4447|      0|            bstarts_nbytes > (size_t)chunk_cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4447:13): [True: 0, False: 0]
  ------------------
 4448|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4449|      0|          goto end;
 4450|      0|        }
 4451|      0|      }
 4452|       |
 4453|      0|      if (bstarts_nbytes > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (4453:11): [True: 0, False: 0]
  ------------------
 4454|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4455|      0|        goto end;
 4456|      0|      }
 4457|      0|      trailer_offset_sz += bstarts_nbytes;
 4458|       |      // Regular values have offsets for blocks
 4459|      0|      if (!memcpyed) {
  ------------------
  |  Branch (4459:11): [True: 0, False: 0]
  ------------------
 4460|      0|        if (bstarts_nbytes > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (4460:13): [True: 0, False: 0]
  ------------------
 4461|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4462|      0|          goto end;
 4463|      0|        }
 4464|      0|        streams_offset += bstarts_nbytes;
 4465|      0|      }
 4466|       |
 4467|      0|      if (bstarts_nbytes > SIZE_MAX - (sizeof(int32_t) + sizeof(int64_t))) {
  ------------------
  |  Branch (4467:11): [True: 0, False: 0]
  ------------------
 4468|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4469|      0|        goto end;
 4470|      0|      }
 4471|      0|      trailer_len_sz = sizeof(int32_t) + sizeof(int64_t) + bstarts_nbytes;
 4472|      0|      if (trailer_len_sz > SIZE_MAX - trailer_offset_sz) {
  ------------------
  |  Branch (4472:11): [True: 0, False: 0]
  ------------------
 4473|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4474|      0|        goto end;
 4475|      0|      }
 4476|      0|      lazychunk_cbytes_sz = trailer_offset_sz + trailer_len_sz;
 4477|      0|    }
 4478|      0|    else if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (4478:14): [True: 0, False: 0]
  ------------------
 4479|      0|      if (typesize <= 0) {
  ------------------
  |  Branch (4479:11): [True: 0, False: 0]
  ------------------
 4480|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4481|      0|        goto end;
 4482|      0|      }
 4483|      0|      if ((size_t)typesize > SIZE_MAX - trailer_offset_sz ||
  ------------------
  |  Branch (4483:11): [True: 0, False: 0]
  ------------------
 4484|      0|          (size_t)typesize > SIZE_MAX - streams_offset) {
  ------------------
  |  Branch (4484:11): [True: 0, False: 0]
  ------------------
 4485|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4486|      0|        goto end;
 4487|      0|      }
 4488|      0|      trailer_offset_sz += (size_t)typesize;
 4489|      0|      streams_offset += (size_t)typesize;
 4490|      0|      lazychunk_cbytes_sz = trailer_offset_sz;
 4491|      0|    }
 4492|      0|    else {
 4493|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4494|      0|      goto end;
 4495|      0|    }
 4496|       |
 4497|      0|    if (streams_offset > (size_t)chunk_cbytes ||
  ------------------
  |  Branch (4497:9): [True: 0, False: 0]
  ------------------
 4498|      0|        trailer_offset_sz > INT32_MAX ||
  ------------------
  |  Branch (4498:9): [True: 0, False: 0]
  ------------------
 4499|      0|        trailer_len_sz > INT32_MAX ||
  ------------------
  |  Branch (4499:9): [True: 0, False: 0]
  ------------------
 4500|      0|        lazychunk_cbytes_sz > INT32_MAX) {
  ------------------
  |  Branch (4500:9): [True: 0, False: 0]
  ------------------
 4501|      0|      rc = BLOSC2_ERROR_INVALID_HEADER;
 4502|      0|      goto end;
 4503|      0|    }
 4504|       |
 4505|      0|    trailer_offset = (int32_t)trailer_offset_sz;
 4506|      0|    lazychunk_cbytes = (int32_t)lazychunk_cbytes_sz;
 4507|       |
 4508|       |    // Read just the full header and bstarts section too (lazy partial length)
 4509|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4509:9): [True: 0, False: 0]
  ------------------
 4510|      0|      io_pos = 0;
 4511|      0|    }
 4512|      0|    else {
 4513|      0|      io_pos = frame->file_offset + header_len + offset;
 4514|      0|    }
 4515|       |
 4516|       |    // The case here is a bit special because more memory is allocated than read from the file
 4517|       |    // and the chunk is modified after reading. Due to the modification, we cannot directly use
 4518|       |    // the memory provided by the io
 4519|      0|    *chunk = malloc((size_t)lazychunk_cbytes);
 4520|      0|    if (*chunk == NULL) {
  ------------------
  |  Branch (4520:9): [True: 0, False: 0]
  ------------------
 4521|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 4522|      0|      goto end;
 4523|      0|    }
 4524|      0|    *needs_free = true;
 4525|       |
 4526|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (4526:9): [True: 0, False: 0]
  ------------------
 4527|      0|      rbytes = io_cb->read((void**)chunk, 1, (int64_t)streams_offset, io_pos, fp);
 4528|      0|    }
 4529|      0|    else {
 4530|       |      // The io hands out its own memory (mmap) and none at all for a read past
 4531|       |      // its end, which a damaged offset or header asks for: copy only after a
 4532|       |      // complete read
 4533|      0|      uint8_t* chunk_ptr = NULL;
 4534|      0|      rbytes = io_cb->read((void**)&chunk_ptr, 1, (int64_t)streams_offset, io_pos, fp);
 4535|      0|      if (rbytes == (int64_t)streams_offset && chunk_ptr != NULL) {
  ------------------
  |  Branch (4535:11): [True: 0, False: 0]
  |  Branch (4535:48): [True: 0, False: 0]
  ------------------
 4536|      0|        memcpy(*chunk, chunk_ptr, streams_offset);
 4537|      0|      }
 4538|      0|      else {
 4539|      0|        rbytes = BLOSC2_ERROR_FILE_READ;
 4540|      0|      }
 4541|      0|    }
 4542|       |
 4543|      0|    if (rbytes != (int64_t)streams_offset) {
  ------------------
  |  Branch (4543:9): [True: 0, False: 0]
  ------------------
 4544|      0|      BLOSC_TRACE_ERROR("Cannot read the (lazy) chunk out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4545|      0|      rc = BLOSC2_ERROR_FILE_READ;
 4546|      0|      goto end;
 4547|      0|    }
 4548|      0|    if (special_type == BLOSC2_SPECIAL_VALUE) {
  ------------------
  |  Branch (4548:9): [True: 0, False: 0]
  ------------------
 4549|       |      // Value runlen is not returning a lazy chunk.  We are done.
 4550|      0|      goto end;
 4551|      0|    }
 4552|       |
 4553|       |    // Mark chunk as lazy
 4554|      0|    uint8_t* blosc2_flags = *chunk + BLOSC2_CHUNK_BLOSC2_FLAGS;
 4555|      0|    *blosc2_flags |= 0x08U;
 4556|       |
 4557|       |    // Add the trailer (currently, nchunk + offset + block_csizes)
 4558|      0|    if (frame->sframe) {
  ------------------
  |  Branch (4558:9): [True: 0, False: 0]
  ------------------
 4559|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)offset;   // offset is nchunk for sframes
 4560|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = offset;
 4561|      0|    }
 4562|      0|    else {
 4563|      0|      *(int32_t*)(*chunk + trailer_offset) = (int32_t)nchunk;
 4564|      0|      *(int64_t*)(*chunk + trailer_offset + sizeof(int32_t)) = header_len + offset;
 4565|      0|    }
 4566|       |
 4567|      0|    block_csizes = malloc(nblocks * sizeof(int32_t));
 4568|      0|    if (block_csizes == NULL) {
  ------------------
  |  Branch (4568:9): [True: 0, False: 0]
  ------------------
 4569|      0|      rc = BLOSC2_ERROR_MEMORY_ALLOC;
 4570|      0|      goto end;
 4571|      0|    }
 4572|       |
 4573|      0|    if (memcpyed) {
  ------------------
  |  Branch (4573:9): [True: 0, False: 0]
  ------------------
 4574|       |      // When memcpyed the blocksizes are trivial to compute
 4575|      0|      for (size_t i = 0; i + 1 < nblocks; i++) {
  ------------------
  |  Branch (4575:26): [True: 0, False: 0]
  ------------------
 4576|      0|        block_csizes[i] = (int)chunk_blocksize;
 4577|      0|      }
 4578|       |      // The last block could be incomplete, mainly due to the fact that the block size is not divisible
 4579|       |      // by the typesize
 4580|      0|      block_csizes[nblocks - 1] = (int32_t)leftover_block ? (int32_t)leftover_block : chunk_blocksize;
  ------------------
  |  Branch (4580:35): [True: 0, False: 0]
  ------------------
 4581|      0|    }
 4582|      0|    else {
 4583|       |      // In regular, compressed chunks, we need to sort the bstarts (they can be out
 4584|       |      // of order because of multi-threading), and get a reverse index too.
 4585|      0|      memcpy(block_csizes, *chunk + BLOSC_EXTENDED_HEADER_LENGTH, nblocks * sizeof(int32_t));
 4586|       |      // Helper structure to keep track of original indexes
 4587|      0|      csize_idx = malloc(nblocks * sizeof(struct csize_idx));
 4588|      0|      if (csize_idx == NULL) {
  ------------------
  |  Branch (4588:11): [True: 0, False: 0]
  ------------------
 4589|      0|        rc = BLOSC2_ERROR_MEMORY_ALLOC;
 4590|      0|        goto end;
 4591|      0|      }
 4592|      0|      for (size_t n = 0; n < nblocks; n++) {
  ------------------
  |  Branch (4592:26): [True: 0, False: 0]
  ------------------
 4593|       |        // A block starts within its chunk, at or after streams_offset; damaged
 4594|       |        // starts would point into chunk headers or overflow the differences below
 4595|       |        // (and in sort_offset())
 4596|      0|        if (block_csizes[n] < (int64_t)streams_offset || block_csizes[n] > chunk_cbytes) {
  ------------------
  |  Branch (4596:13): [True: 0, False: 0]
  |  Branch (4596:58): [True: 0, False: 0]
  ------------------
 4597|      0|          rc = BLOSC2_ERROR_INVALID_HEADER;
 4598|      0|          goto end;
 4599|      0|        }
 4600|      0|        csize_idx[n].val = block_csizes[n];
 4601|      0|        csize_idx[n].idx = (int)n;
 4602|      0|      }
 4603|      0|      qsort(csize_idx, nblocks, sizeof(struct csize_idx), &sort_offset);
 4604|       |      // Compute the actual csizes
 4605|      0|      int idx;
 4606|      0|      for (size_t n = 0; n + 1 < nblocks; n++) {
  ------------------
  |  Branch (4606:26): [True: 0, False: 0]
  ------------------
 4607|      0|        idx = csize_idx[n].idx;
 4608|      0|        block_csizes[idx] = csize_idx[n + 1].val - csize_idx[n].val;
 4609|      0|      }
 4610|      0|      idx = csize_idx[nblocks - 1].idx;
 4611|      0|      block_csizes[idx] = chunk_cbytes - csize_idx[nblocks - 1].val;
 4612|      0|      free(csize_idx);
 4613|      0|      csize_idx = NULL;
 4614|      0|    }
 4615|       |    // Copy the csizes at the end of the trailer
 4616|      0|    void *trailer_csizes = *chunk + lazychunk_cbytes - nblocks * sizeof(int32_t);
 4617|      0|    memcpy(trailer_csizes, block_csizes, nblocks * sizeof(int32_t));
 4618|      0|    free(block_csizes);
 4619|      0|    block_csizes = NULL;
 4620|    502|  } else {
 4621|       |    // The chunk is in memory and just one pointer away
 4622|    502|    int64_t chunk_header_offset = header_len + offset;
 4623|    502|    int64_t chunk_cbytes_offset = chunk_header_offset + BLOSC_MIN_HEADER_LENGTH;
 4624|       |
 4625|    502|    *chunk = frame->cframe + chunk_header_offset;
 4626|       |
 4627|    502|    if (chunk_header_offset < 0 ||
  ------------------
  |  Branch (4627:9): [True: 0, False: 502]
  ------------------
 4628|    502|        chunk_cbytes_offset < chunk_header_offset ||
  ------------------
  |  Branch (4628:9): [True: 0, False: 502]
  ------------------
 4629|    502|        chunk_cbytes_offset > frame->len) {
  ------------------
  |  Branch (4629:9): [True: 0, False: 502]
  ------------------
 4630|      0|      BLOSC_TRACE_ERROR("Cannot read the header for chunk in the (contiguous) frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4631|      0|      rc = BLOSC2_ERROR_READ_BUFFER;
 4632|    502|    } else {
 4633|    502|      int32_t chunk_blocksize = 0;
 4634|    502|      rc = blosc2_cbuffer_sizes(*chunk, NULL, &lazychunk_cbytes, &chunk_blocksize);
 4635|    502|      if (rc < 0) {
  ------------------
  |  Branch (4635:11): [True: 0, False: 502]
  ------------------
 4636|      0|        BLOSC_TRACE_ERROR("Cannot read the chunk header.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4637|      0|        rc = BLOSC2_ERROR_READ_BUFFER;
 4638|      0|      }
 4639|    502|      else if (chunk_blocksize <= 0) {
  ------------------
  |  Branch (4639:16): [True: 0, False: 502]
  ------------------
 4640|      0|        BLOSC_TRACE_ERROR("Invalid blocksize %d in chunk header.", chunk_blocksize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4641|      0|        rc = BLOSC2_ERROR_INVALID_HEADER;
 4642|      0|      }
 4643|    502|      else if (lazychunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4643:16): [True: 2, False: 500]
  ------------------
 4644|    500|               chunk_header_offset > INT64_MAX - lazychunk_cbytes ||
  ------------------
  |  Branch (4644:16): [True: 0, False: 500]
  ------------------
 4645|    500|               chunk_header_offset + lazychunk_cbytes > frame_len) {
  ------------------
  |  Branch (4645:16): [True: 27, False: 473]
  ------------------
 4646|     29|        BLOSC_TRACE_ERROR("Compressed bytes exceed beyond frame length.");
  ------------------
  |  |   93|     29|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     29|    do {                                            \
  |  |  |  |   98|     29|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     29|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 29, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     29|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4647|     29|        rc = BLOSC2_ERROR_READ_BUFFER;
 4648|     29|      }
 4649|    502|    }
 4650|    502|  }
 4651|       |
 4652|  1.04k|  end:
 4653|  1.04k|  if (csize_idx != NULL) {
  ------------------
  |  Branch (4653:7): [True: 0, False: 1.04k]
  ------------------
 4654|      0|    free(csize_idx);
 4655|      0|  }
 4656|  1.04k|  if (block_csizes != NULL) {
  ------------------
  |  Branch (4656:7): [True: 0, False: 1.04k]
  ------------------
 4657|      0|    free(block_csizes);
 4658|      0|  }
 4659|  1.04k|  if (fp != NULL) {
  ------------------
  |  Branch (4659:7): [True: 0, False: 1.04k]
  ------------------
 4660|      0|    frame_reader_release(frame, io_cb, fp);
 4661|      0|  }
 4662|  1.04k|  if (rc < 0) {
  ------------------
  |  Branch (4662:7): [True: 42, False: 998]
  ------------------
 4663|     42|    if (*needs_free) {
  ------------------
  |  Branch (4663:9): [True: 0, False: 42]
  ------------------
 4664|      0|      free(*chunk);
 4665|      0|      *chunk = NULL;
 4666|      0|      *needs_free = false;
 4667|      0|    }
 4668|     42|    return rc;
 4669|     42|  }
 4670|       |
 4671|    998|  return (int)lazychunk_cbytes;
 4672|  1.04k|}
frame_decompress_chunk:
 7084|  76.4k|int frame_decompress_chunk(blosc2_context *dctx, blosc2_frame_s* frame, int64_t nchunk, void *dest, int32_t nbytes) {
 7085|  76.4k|  uint8_t* src = NULL;
 7086|  76.4k|  bool needs_free = false;
 7087|  76.4k|  int32_t srcsize;
 7088|  76.4k|  int32_t chunk_nbytes;
 7089|  76.4k|  int32_t chunk_cbytes;
 7090|  76.4k|  int rc;
 7091|       |
 7092|  76.4k|  size_t capacity = 0;
 7093|  76.4k|  rc = get_chunk(frame, nchunk, &src, &needs_free, &capacity);
 7094|  76.4k|  if (rc < 0) {
  ------------------
  |  Branch (7094:7): [True: 237, False: 76.2k]
  ------------------
 7095|    237|    BLOSC_TRACE_ERROR("Cannot get the chunk in position %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    237|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    237|    do {                                            \
  |  |  |  |   98|    237|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    237|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 237, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    237|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7096|    237|    goto end;
 7097|    237|  }
 7098|  76.2k|  srcsize = rc;
 7099|  76.2k|  if (srcsize < BLOSC_MIN_HEADER_LENGTH) {
  ------------------
  |  Branch (7099:7): [True: 0, False: 76.2k]
  ------------------
 7100|      0|    BLOSC_TRACE_ERROR("Not enough input to read the header of chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7101|      0|    rc = BLOSC2_ERROR_READ_BUFFER;
 7102|      0|    goto end;
 7103|      0|  }
 7104|       |
 7105|  76.2k|  rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 7106|  76.2k|  if (rc < 0) {
  ------------------
  |  Branch (7106:7): [True: 12, False: 76.2k]
  ------------------
 7107|     12|    goto end;
 7108|     12|  }
 7109|       |  /* The header cbytes is used as srcsize below, so it must fit in what was read */
 7110|  76.2k|  if (chunk_cbytes > srcsize) {
  ------------------
  |  Branch (7110:7): [True: 0, False: 76.2k]
  ------------------
 7111|      0|    BLOSC_TRACE_ERROR("Invalid chunk size in frame for chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7112|      0|    rc = BLOSC2_ERROR_INVALID_HEADER;
 7113|      0|    goto end;
 7114|      0|  }
 7115|       |
 7116|       |  /* Create a buffer for destination */
 7117|  76.2k|  if (chunk_nbytes > nbytes) {
  ------------------
  |  Branch (7117:7): [True: 35, False: 76.1k]
  ------------------
 7118|     35|    BLOSC_TRACE_ERROR("Not enough space for decompressing in dest.");
  ------------------
  |  |   93|     35|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     35|    do {                                            \
  |  |  |  |   98|     35|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     35|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 35, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     35|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7119|     35|    rc = BLOSC2_ERROR_WRITE_BUFFER;
 7120|     35|    goto end;
 7121|     35|  }
 7122|       |  /* And decompress it */
 7123|  76.1k|  dctx->header_overhead = BLOSC_EXTENDED_HEADER_LENGTH;
 7124|  76.1k|  int chunksize = rc = blosc2_decompress_ctx(dctx, src, chunk_cbytes, dest, nbytes);
 7125|  76.1k|  if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (7125:7): [True: 405, False: 75.7k]
  |  Branch (7125:24): [True: 33, False: 75.7k]
  ------------------
 7126|    438|    BLOSC_TRACE_ERROR("Error in decompressing chunk.");
  ------------------
  |  |   93|    438|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    438|    do {                                            \
  |  |  |  |   98|    438|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    438|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 438, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    438|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7127|    438|    if (chunksize >= 0)
  ------------------
  |  Branch (7127:9): [True: 33, False: 405]
  ------------------
 7128|     33|      rc = BLOSC2_ERROR_FAILURE;
 7129|    438|  }
 7130|  76.4k|  end:
 7131|  76.4k|  if (needs_free) {
  ------------------
  |  Branch (7131:7): [True: 30.6k, False: 45.8k]
  ------------------
 7132|  30.6k|    blosc2_tmp_free(src, capacity);
 7133|  30.6k|  }
 7134|  76.4k|  return rc;
 7135|  76.1k|}
frame.c:reader_cacheable:
  292|     20|static bool reader_cacheable(const blosc2_io* io) {
  293|     20|  return io->id == BLOSC2_IO_FILESYSTEM;
  294|     20|}
frame.c:cache_slot_claim:
  264|     20|static bool cache_slot_claim(const void* slot, bool* nocache) {
  265|     20|  if (slot != NULL || *nocache) {
  ------------------
  |  Branch (265:7): [True: 0, False: 20]
  |  Branch (265:23): [True: 0, False: 20]
  ------------------
  266|      0|    return false;
  267|      0|  }
  268|     20|  if (!reader_cache_claim()) {
  ------------------
  |  Branch (268:7): [True: 0, False: 20]
  ------------------
  269|      0|    *nocache = true;
  270|      0|    return false;
  271|      0|  }
  272|     20|  return true;
  273|     20|}
frame.c:reader_cache_claim:
  155|     20|static bool reader_cache_claim(void) {
  156|     20|  bool claimed = false;
  157|     20|  pthread_once(&reader_cache_atfork_once, reader_cache_register_atfork);
  158|     20|  blosc2_pthread_mutex_lock(&reader_cache_mutex);
  ------------------
  |  |   92|     20|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  159|     20|  if (reader_cache_count < reader_cache_max()) {
  ------------------
  |  Branch (159:7): [True: 20, False: 0]
  ------------------
  160|     20|    reader_cache_count++;
  161|     20|    claimed = true;
  162|     20|  }
  163|     20|  blosc2_pthread_mutex_unlock(&reader_cache_mutex);
  ------------------
  |  |   93|     20|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  164|     20|  return claimed;
  165|     20|}
frame.c:reader_cache_register_atfork:
  121|      1|static void reader_cache_register_atfork(void) {
  122|      1|  if (pthread_atfork(reader_cache_atfork_prepare, reader_cache_atfork_parent, reader_cache_atfork_child) != 0) {
  ------------------
  |  Branch (122:7): [True: 0, False: 1]
  ------------------
  123|       |    BLOSC_TRACE_WARNING("pthread_atfork() failed: a fork()ed child may find the reader cache locked");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  124|      0|  }
  125|      1|}
frame.c:reader_cache_max:
  127|     20|static int reader_cache_max(void) {
  128|     20|  static int cached_max = -1;
  129|     20|  if (cached_max >= 0) {
  ------------------
  |  Branch (129:7): [True: 19, False: 1]
  ------------------
  130|     19|    return cached_max;
  131|     19|  }
  132|      1|  char* envvar = getenv("BLOSC_MAX_CACHED_READERS");
  133|      1|  if (envvar != NULL && envvar[0] != '\0') {
  ------------------
  |  Branch (133:7): [True: 0, False: 1]
  |  Branch (133:25): [True: 0, False: 0]
  ------------------
  134|      0|    long value = strtol(envvar, NULL, 10);
  135|      0|    if (value >= 0 && value <= INT_MAX) {
  ------------------
  |  Branch (135:9): [True: 0, False: 0]
  |  Branch (135:23): [True: 0, False: 0]
  ------------------
  136|      0|      cached_max = (int)value;
  137|      0|      return cached_max;
  138|      0|    }
  139|      0|  }
  140|      1|  cached_max = FRAME_READER_CACHE_MAX;
  ------------------
  |  |   93|      1|#define FRAME_READER_CACHE_MAX 96
  ------------------
  141|      1|  struct rlimit rl;
  142|      1|  if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && rl.rlim_cur != RLIM_INFINITY) {
  ------------------
  |  Branch (142:7): [True: 1, False: 0]
  |  Branch (142:45): [True: 1, False: 0]
  ------------------
  143|      1|    rlim_t share = rl.rlim_cur / FRAME_READER_CACHE_SHARE;
  ------------------
  |  |   94|      1|#define FRAME_READER_CACHE_SHARE 16
  ------------------
  144|      1|    if (share < (rlim_t)cached_max) {
  ------------------
  |  Branch (144:9): [True: 1, False: 0]
  ------------------
  145|      1|      cached_max = (int)share;
  146|      1|    }
  147|      1|  }
  148|       |  /* A budget below FRAME_READER_CACHE_SHARE lands on 0, i.e. no caching at all;
  149|       |     that is the right answer there -- a descriptor held for a frame's lifetime
  150|       |     is exactly what such a process cannot spare. */
  151|      1|  return cached_max;
  152|      1|}
frame.c:cache_install:
  277|     20|static void cache_install(void** slot, uint64_t* dev, uint64_t* ino, void* fp) {
  278|     20|  *slot = fp;
  279|     20|  if (fp == NULL) {
  ------------------
  |  Branch (279:7): [True: 20, False: 0]
  ------------------
  280|     20|    reader_cache_return();
  281|     20|  }
  282|      0|  else {
  283|      0|    record_handle_identity(fp, dev, ino);
  284|      0|  }
  285|     20|}
frame.c:reader_cache_return:
  167|     20|static void reader_cache_return(void) {
  168|     20|  blosc2_pthread_mutex_lock(&reader_cache_mutex);
  ------------------
  |  |   92|     20|#define blosc2_pthread_mutex_lock(a) pthread_mutex_lock((a))
  ------------------
  169|     20|  if (reader_cache_count > 0) {
  ------------------
  |  Branch (169:7): [True: 20, False: 0]
  ------------------
  170|     20|    reader_cache_count--;
  171|     20|  }
  172|     20|  blosc2_pthread_mutex_unlock(&reader_cache_mutex);
  ------------------
  |  |   93|     20|#define blosc2_pthread_mutex_unlock(a) pthread_mutex_unlock((a))
  ------------------
  173|     20|}
frame.c:frame_writer_close_locked:
  474|  7.02k|static int frame_writer_close_locked(blosc2_frame_s* frame) {
  475|  7.02k|  int rc = BLOSC2_ERROR_SUCCESS;
  476|  7.02k|  if (frame->write_fp != NULL) {
  ------------------
  |  Branch (476:7): [True: 0, False: 7.02k]
  ------------------
  477|       |    /* Only the filesystem backend ever populates write_fp */
  478|      0|    int close_rc = blosc2_stdio_close(frame->write_fp);
  479|      0|    frame->write_fp = NULL;
  480|      0|#if !defined(_WIN32)
  481|      0|    reader_cache_return();
  482|      0|#endif
  483|      0|    if (close_rc != 0) {
  ------------------
  |  Branch (483:9): [True: 0, False: 0]
  ------------------
  484|      0|      BLOSC_TRACE_ERROR("Cannot close the cached frame writer handle.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  485|      0|      rc = BLOSC2_ERROR_FILE_WRITE;
  486|      0|    }
  487|      0|  }
  488|       |  frame->write_fp_stale = false;
  489|  7.02k|  frame->file_end = 0;
  490|  7.02k|  return rc;
  491|  7.02k|}
frame.c:frame_reader_close_locked:
  441|  7.02k|static int frame_reader_close_locked(blosc2_frame_s* frame, bool force) {
  442|  7.02k|  if (frame->read_fp == NULL) {
  ------------------
  |  Branch (442:7): [True: 7.02k, False: 0]
  ------------------
  443|  7.02k|    return BLOSC2_ERROR_SUCCESS;
  444|  7.02k|  }
  445|      0|  if (frame->read_fp_refs > 0 && !force) {
  ------------------
  |  Branch (445:7): [True: 0, False: 0]
  |  Branch (445:34): [True: 0, False: 0]
  ------------------
  446|       |    /* A caller up the stack is reading through it (frame_to_schunk holds it
  447|       |       across its whole chunk loop, and that loop re-enters get_header_info).
  448|       |       Closing it here would hand that caller a dangling handle, and its own
  449|       |       release would then close it a second time.  Leave it: the operation in
  450|       |       flight finishes on the file it started on, and the next revalidate --
  451|       |       past that release -- drops it. */
  452|      0|    return 1;
  453|      0|  }
  454|       |  /* read_fp only ever comes from the filesystem backend, so close it directly:
  455|       |     blosc2_get_io_cb() would return NULL after a blosc2_destroy(), and then the
  456|       |     descriptor would leak while its cache slot got handed back anyway. */
  457|      0|  int close_rc = blosc2_stdio_close(frame->read_fp);
  458|      0|  frame->read_fp = NULL;
  459|      0|  frame->read_fp_refs = 0;
  460|      0|#if !defined(_WIN32)
  461|      0|  reader_cache_return();
  462|      0|#endif
  463|      0|  if (close_rc != 0) {
  ------------------
  |  Branch (463:7): [True: 0, False: 0]
  ------------------
  464|      0|    BLOSC_TRACE_ERROR("Cannot close the cached frame reader handle.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  465|      0|    return BLOSC2_ERROR_FILE_WRITE;
  466|      0|  }
  467|      0|  return BLOSC2_ERROR_SUCCESS;
  468|      0|}
frame.c:frame_alloc:
  308|  7.02k|static blosc2_frame_s* frame_alloc(void) {
  309|  7.02k|  blosc2_frame_s* frame = calloc(1, sizeof(blosc2_frame_s));
  310|  7.02k|  if (frame != NULL) {
  ------------------
  |  Branch (310:7): [True: 7.02k, False: 0]
  ------------------
  311|  7.02k|    blosc2_pthread_mutex_init(&frame->read_fp_mutex, NULL);
  ------------------
  |  |   90|  7.02k|#define blosc2_pthread_mutex_init(a, b) pthread_mutex_init((a), (b))
  ------------------
  312|  7.02k|  }
  313|  7.02k|  return frame;
  314|  7.02k|}
frame.c:frame_refresh_if_stale:
 1568|  77.7k|static int frame_refresh_if_stale(blosc2_frame_s *frame, int64_t frame_len_on_disk) {
 1569|  77.7k|  if (frame->cframe != NULL || frame->schunk == NULL ||
  ------------------
  |  Branch (1569:7): [True: 77.7k, False: 0]
  |  Branch (1569:32): [True: 0, False: 0]
  ------------------
 1570|  77.7k|      (!frame->force_refresh && frame_len_on_disk == frame->len)) {
  ------------------
  |  Branch (1570:8): [True: 0, False: 0]
  |  Branch (1570:33): [True: 0, False: 0]
  ------------------
 1571|  77.7k|    return 0;
 1572|  77.7k|  }
 1573|       |  // Saved so the metalayer-reload retry loop below can roll back to a fully
 1574|       |  // consistent state on exhaustion, rather than leaving frame->len/trailer_len
 1575|       |  // committed to the new value with no metalayers to match it.
 1576|      0|  int64_t old_len = frame->len;
 1577|      0|  uint32_t old_trailer_len = frame->trailer_len;
 1578|       |
 1579|      0|  if (frame_len_on_disk < FRAME_HEADER_MINLEN + FRAME_TRAILER_MINLEN) {
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                if (frame_len_on_disk < FRAME_HEADER_MINLEN + FRAME_TRAILER_MINLEN) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1579:7): [True: 0, False: 0]
  ------------------
 1580|      0|    BLOSC_TRACE_ERROR("Invalid on-disk frame length (%" PRId64 ").", frame_len_on_disk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1581|      0|    return BLOSC2_ERROR_FILE_READ;
 1582|      0|  }
 1583|       |
 1584|       |  // Read and validate the trailer *before* mutating any frame state below,
 1585|       |  // so a transient torn read (a writer without locking has no coordination
 1586|       |  // preventing a reader from landing mid-rewrite here -- the documented
 1587|       |  // SWMR-without-locking tradeoff) can be handled opportunistically: keep
 1588|       |  // the old cached view and let the next access retry, the same way
 1589|       |  // frame_check_stale()'s header read already does a few lines up in the
 1590|       |  // caller. Once frame->len/coffsets are overwritten below, a failure
 1591|       |  // partway through would leave the frame in a self-inconsistent state
 1592|       |  // (new length, stale trailer/offsets), so those mutations only happen
 1593|       |  // after the trailer is confirmed good.
 1594|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 1595|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1595:7): [True: 0, False: 0]
  ------------------
 1596|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1597|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1598|      0|  }
 1599|      0|  void* fp;
 1600|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1600:7): [True: 0, False: 0]
  ------------------
 1601|      0|    fp = sframe_open_index(frame->urlpath, "rb", frame->schunk->storage->io);
 1602|      0|  }
 1603|      0|  else {
 1604|      0|    fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 1605|      0|  }
 1606|      0|  if (fp == NULL) {
  ------------------
  |  Branch (1606:7): [True: 0, False: 0]
  ------------------
 1607|      0|    BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1608|      0|    return BLOSC2_ERROR_FILE_OPEN;
 1609|      0|  }
 1610|      0|  uint8_t trailer[FRAME_TRAILER_MINLEN];
 1611|      0|  uint8_t* trailer_ptr = trailer;
 1612|      0|  int64_t io_pos = frame->file_offset + frame_len_on_disk - FRAME_TRAILER_MINLEN;
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 1613|      0|  int64_t rbytes = io_cb->read((void**)&trailer_ptr, 1, FRAME_TRAILER_MINLEN, io_pos, fp);
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
 1614|      0|  frame_reader_release(frame, io_cb, fp);
 1615|      0|  if (rbytes != FRAME_TRAILER_MINLEN) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1615:7): [True: 0, False: 0]
  ------------------
 1616|      0|    BLOSC_TRACE_ERROR("Cannot read the trailer out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1617|      0|    return 0;  // opportunistic: transient, keep the cached view, retry later
 1618|      0|  }
 1619|      0|  int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
                int trailer_offset = FRAME_TRAILER_MINLEN - FRAME_TRAILER_LEN_OFFSET;
  ------------------
  |  |   59|      0|#define FRAME_TRAILER_LEN_OFFSET (22)  // offset to trailer length (counting from the end)
  ------------------
 1620|      0|  if (trailer_ptr[trailer_offset - 1] != 0xce) {
  ------------------
  |  Branch (1620:7): [True: 0, False: 0]
  ------------------
 1621|       |    // Not a valid trailer; most likely we are reading a frame in the middle of
 1622|       |    // being rewritten by another handle without locking (locked handles
 1623|       |    // fully serialize, so this only happens under the no-locking contract).
 1624|      0|    BLOSC_TRACE_ERROR("Invalid trailer in frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1625|      0|    return 0;  // opportunistic, same reasoning as above
 1626|      0|  }
 1627|      0|  uint32_t trailer_len;
 1628|      0|  from_big(&trailer_len, trailer_ptr + trailer_offset, sizeof(trailer_len));
  ------------------
  |  |   38|      0|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 1629|      0|  if (trailer_len < FRAME_TRAILER_MINLEN || trailer_len > INT32_MAX ||
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1629:7): [True: 0, False: 0]
  |  Branch (1629:45): [True: 0, False: 0]
  ------------------
 1630|      0|      (int64_t)trailer_len > frame_len_on_disk - FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|      0|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|      0|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|      0|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|      0|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|      0|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|      0|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|      0|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|      0|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|      0|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|      0|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|      0|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|      0|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|      0|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1630:7): [True: 0, False: 0]
  ------------------
 1631|      0|    BLOSC_TRACE_ERROR("Invalid trailer length (%" PRIu32 ") in frame.", trailer_len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1632|      0|    return 0;  // opportunistic, same reasoning as above
 1633|      0|  }
 1634|       |
 1635|       |  // Trailer confirmed good: now safe to commit the new length. The lock
 1636|       |  // generation counter (see frame_lock) may have flagged a mutation that
 1637|       |  // left the frame length unchanged; only clear that flag here, once a
 1638|       |  // refresh has actually happened -- clearing it earlier and then bailing
 1639|       |  // out opportunistically above would permanently lose a same-length
 1640|       |  // mutation notification on a torn-read retry. The cached offsets index is
 1641|       |  // dropped further down, only once the metalayer/vlmetalayer reload below
 1642|       |  // has actually succeeded -- neither of those touches frame->coffsets, so
 1643|       |  // deferring this keeps the old view of it fully intact for the
 1644|       |  // opportunistic rollback path below, exactly as strong as the trailer
 1645|       |  // read's own bail-outs above.
 1646|      0|  frame->force_refresh = false;
 1647|      0|  frame->len = frame_len_on_disk;
 1648|      0|  frame->file_end = 0;  // another handle wrote the file; its size is unknown again
 1649|      0|  if (frame->nholes > 0) {
  ------------------
  |  Branch (1649:7): [True: 0, False: 0]
  ------------------
 1650|       |    // Nor do we know its free space any more (only an unlocked writer gets here inside frame_begin_updates())
 1651|      0|    frame->nholes = 0;
 1652|      0|    frame->holes_lost = true;
 1653|      0|  }
 1654|      0|  frame->trailer_len = trailer_len;
 1655|       |
 1656|       |  // The header metalayers and trailer vlmetalayers were cached at open time;
 1657|       |  // reload them so metadata changes made by another handle (e.g. a b2nd shape
 1658|       |  // update) become visible too.  The guard protects against re-entering from
 1659|       |  // the reload path itself (get_header_info does not refresh, but cheap
 1660|       |  // insurance against future changes there).
 1661|       |  //
 1662|       |  // frame_get_metalayers()/frame_get_vlmetalayers() each do their own fully
 1663|       |  // independent header/trailer re-read (separate from the trailer read
 1664|       |  // above), so without locking they can hit the same transient torn-read
 1665|       |  // window. Unlike that trailer read, there's no way to validate first and
 1666|       |  // commit after: schunk_free_metalayers()/schunk_free_vlmetalayers() must
 1667|       |  // run before a reload attempt (the parsers write straight into
 1668|       |  // schunk->metalayers[]/vlmetalayers[] as they go), so a single failed
 1669|       |  // attempt already discards the old cached set. Retry a bounded number of
 1670|       |  // times -- both free helpers are NULL-safe and re-run cleanly against a
 1671|       |  // partial prior attempt, and each attempt is a fresh independent read, so
 1672|       |  // this self-heals once the writer's rewrite stabilizes.
 1673|       |  //
 1674|       |  // This reasoning only holds without locking, though: frame_check_stale()
 1675|       |  // (the only caller) holds the shared frame lock across this entire call
 1676|       |  // when frame->locking is set, which fully excludes writers for its
 1677|       |  // duration -- so under locking a reload failure here cannot be a torn
 1678|       |  // read, it is a genuine problem (corruption or a real I/O error), and
 1679|       |  // retrying 50 times would just waste ~50ms holding that shared lock
 1680|       |  // before silently masking it. Retry once (i.e. don't retry) and propagate
 1681|       |  // the error under locking; keep the opportunistic bounded retry + silent
 1682|       |  // rollback for the no-locking case only.
 1683|       |  //
 1684|       |  // On exhaustion in the no-locking case, roll back frame->len/trailer_len
 1685|       |  // to what they were before this call and force a full retry on the next
 1686|       |  // poll (frame->force_refresh = true) -- otherwise frame_len_on_disk ==
 1687|       |  // frame->len would short-circuit every subsequent call at the top of this
 1688|       |  // function, permanently stranding this handle with an empty metalayer set.
 1689|      0|  if (!frame->refreshing) {
  ------------------
  |  Branch (1689:7): [True: 0, False: 0]
  ------------------
 1690|      0|    frame->refreshing = true;
 1691|      0|    int rc = -1;
 1692|      0|    const int max_attempts = frame->locking ? 1 : 50;
  ------------------
  |  Branch (1692:30): [True: 0, False: 0]
  ------------------
 1693|      0|    for (int attempt = 0; attempt < max_attempts; attempt++) {
  ------------------
  |  Branch (1693:27): [True: 0, False: 0]
  ------------------
 1694|      0|      schunk_free_metalayers(frame->schunk);
 1695|      0|      rc = frame_get_metalayers(frame, frame->schunk);
 1696|      0|      if (rc >= 0) {
  ------------------
  |  Branch (1696:11): [True: 0, False: 0]
  ------------------
 1697|      0|        schunk_free_vlmetalayers(frame->schunk);
 1698|      0|        rc = frame_get_vlmetalayers(frame, frame->schunk);
 1699|      0|      }
 1700|      0|      if (rc >= 0 || attempt + 1 == max_attempts) {
  ------------------
  |  Branch (1700:11): [True: 0, False: 0]
  |  Branch (1700:22): [True: 0, False: 0]
  ------------------
 1701|      0|        break;
 1702|      0|      }
 1703|       |#if defined(_WIN32)
 1704|       |      Sleep(1);
 1705|       |#else
 1706|      0|      usleep(1000);
 1707|      0|#endif
 1708|      0|    }
 1709|      0|    frame->refreshing = false;
 1710|      0|    if (rc < 0) {
  ------------------
  |  Branch (1710:9): [True: 0, False: 0]
  ------------------
 1711|      0|      if (frame->locking) {
  ------------------
  |  Branch (1711:11): [True: 0, False: 0]
  ------------------
 1712|      0|        BLOSC_TRACE_ERROR("Cannot reload the metalayers from the refreshed frame "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1713|      0|                          "(locked handle: this is not a transient race).");
 1714|      0|        return rc;
 1715|      0|      }
 1716|      0|      BLOSC_TRACE_ERROR("Cannot reload the metalayers from the refreshed frame "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1717|      0|                        "after retries; rolling back to the previous cached view.");
 1718|      0|      frame->len = old_len;
 1719|      0|      frame->trailer_len = old_trailer_len;
 1720|      0|      frame->force_refresh = true;
 1721|      0|      return 0;
 1722|      0|    }
 1723|      0|  }
 1724|      0|  frame->schunk->change_tick++;
 1725|       |
 1726|       |  // Cached offsets index invalidated only now, after a fully successful
 1727|       |  // refresh: recomputed lazily from the fresh trailer on demand.
 1728|      0|  if (frame->coffsets != NULL) {
  ------------------
  |  Branch (1728:7): [True: 0, False: 0]
  ------------------
 1729|      0|    if (frame->coffsets_needs_free) {
  ------------------
  |  Branch (1729:9): [True: 0, False: 0]
  ------------------
 1730|      0|      free(frame->coffsets);
 1731|      0|    }
 1732|      0|    frame->coffsets = NULL;
 1733|      0|  }
 1734|       |
 1735|      0|  return 1;
 1736|      0|}
frame.c:get_coffsets_nbytes:
 1783|  3.70k|                               int32_t *coffsets_nbytes, const blosc2_io *io) {
 1784|  3.70k|  int32_t chunk_cbytes;
 1785|  3.70k|  int rc;
 1786|  3.70k|  int64_t off_pos = header_len;
 1787|  3.70k|  if (!frame->sframe) {
  ------------------
  |  Branch (1787:7): [True: 3.70k, False: 0]
  ------------------
 1788|  3.70k|    if (cbytes < INT64_MAX - header_len) {
  ------------------
  |  Branch (1788:9): [True: 56, False: 3.64k]
  ------------------
 1789|     56|      off_pos += cbytes;
 1790|     56|    }
 1791|  3.70k|  }
 1792|       |
 1793|  3.70k|  if (off_pos < 0 || off_pos > INT64_MAX - BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (1793:7): [True: 0, False: 3.70k]
  |  Branch (1793:22): [True: 0, False: 3.70k]
  ------------------
 1794|  3.70k|      off_pos + BLOSC_EXTENDED_HEADER_LENGTH > frame->len) {
  ------------------
  |  Branch (1794:7): [True: 2, False: 3.70k]
  ------------------
 1795|      2|    BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1796|      2|    return BLOSC2_ERROR_INVALID_HEADER;
 1797|      2|  }
 1798|       |
 1799|  3.70k|  if (frame->cframe != NULL) {
  ------------------
  |  Branch (1799:7): [True: 3.70k, False: 0]
  ------------------
 1800|  3.70k|    uint8_t *off_start = frame->cframe + off_pos;
 1801|  3.70k|    rc = blosc2_cbuffer_sizes(off_start, coffsets_nbytes, &chunk_cbytes, NULL);
 1802|  3.70k|    if (rc < 0) {
  ------------------
  |  Branch (1802:9): [True: 4, False: 3.69k]
  ------------------
 1803|      4|      return rc;
 1804|      4|    }
 1805|  3.69k|    if (chunk_cbytes < 0 || off_pos + chunk_cbytes > frame->len) {
  ------------------
  |  Branch (1805:9): [True: 0, False: 3.69k]
  |  Branch (1805:29): [True: 2, False: 3.69k]
  ------------------
 1806|      2|      BLOSC_TRACE_ERROR("Cannot read the cbytes outside of frame boundary.");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1807|      2|      return BLOSC2_ERROR_INVALID_HEADER;
 1808|      2|    }
 1809|  3.69k|    return 0;
 1810|  3.69k|  }
 1811|       |
 1812|      0|  int64_t trailer_offset = get_trailer_offset(frame, header_len, true);
 1813|      0|  if (trailer_offset < BLOSC_EXTENDED_HEADER_LENGTH || trailer_offset + FRAME_TRAILER_MINLEN > frame->len) {
  ------------------
  |  |   58|      0|#define FRAME_TRAILER_MINLEN (25)  // minimum length for the trailer (msgpack overhead)
  ------------------
  |  Branch (1813:7): [True: 0, False: 0]
  |  Branch (1813:56): [True: 0, False: 0]
  ------------------
 1814|      0|    BLOSC_TRACE_ERROR("Cannot read the trailer out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1815|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1816|      0|  }
 1817|       |
 1818|      0|  blosc2_io_cb *io_cb = blosc2_get_io_cb(io->id);
 1819|      0|  if (io_cb == NULL) {
  ------------------
  |  Branch (1819:7): [True: 0, False: 0]
  ------------------
 1820|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1821|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 1822|      0|  }
 1823|       |
 1824|      0|  uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 1825|      0|  uint8_t *header_ptr = header;
 1826|      0|  void *fp = NULL;
 1827|      0|  int64_t io_pos = 0;
 1828|      0|  if (frame->sframe) {
  ------------------
  |  Branch (1828:7): [True: 0, False: 0]
  ------------------
 1829|      0|    fp = sframe_open_index(frame->urlpath, "rb", io);
 1830|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1830:9): [True: 0, False: 0]
  ------------------
 1831|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1832|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1833|      0|    }
 1834|      0|    io_pos = off_pos;
 1835|      0|  }
 1836|      0|  else {
 1837|      0|    fp = frame_reader_acquire(frame, io);
 1838|      0|    if (fp == NULL) {
  ------------------
  |  Branch (1838:9): [True: 0, False: 0]
  ------------------
 1839|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1840|      0|      return BLOSC2_ERROR_FILE_OPEN;
 1841|      0|    }
 1842|      0|    io_pos = frame->file_offset + off_pos;
 1843|      0|  }
 1844|      0|  int64_t rbytes = io_cb->read((void**)&header_ptr, 1, BLOSC_EXTENDED_HEADER_LENGTH, io_pos, fp);
 1845|      0|  frame_reader_release(frame, io_cb, fp);
 1846|      0|  if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (1846:7): [True: 0, False: 0]
  ------------------
 1847|      0|    BLOSC_TRACE_ERROR("Cannot read the offsets header out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1848|      0|    return BLOSC2_ERROR_FILE_READ;
 1849|      0|  }
 1850|       |
 1851|      0|  rc = blosc2_cbuffer_sizes(header_ptr, coffsets_nbytes, &chunk_cbytes, NULL);
 1852|      0|  if (rc < 0) {
  ------------------
  |  Branch (1852:7): [True: 0, False: 0]
  ------------------
 1853|      0|    return rc;
 1854|      0|  }
 1855|       |
 1856|      0|  if (chunk_cbytes < 0 || off_pos + chunk_cbytes > trailer_offset) {
  ------------------
  |  Branch (1856:7): [True: 0, False: 0]
  |  Branch (1856:27): [True: 0, False: 0]
  ------------------
 1857|      0|    BLOSC_TRACE_ERROR("Cannot read the offsets outside of frame boundary.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1858|      0|    return BLOSC2_ERROR_INVALID_HEADER;
 1859|      0|  }
 1860|       |
 1861|      0|  return 0;
 1862|      0|}
frame.c:get_meta_from_header:
 2963|  1.03k|                                int32_t header_len) {
 2964|  1.03k|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|  1.03k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 2965|  1.03k|  int64_t header_pos = FRAME_IDX_SIZE;
  ------------------
  |  |   51|  1.03k|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|  1.03k|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  1.03k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|  1.03k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  1.03k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|  1.03k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|  1.03k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.03k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.03k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.03k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.03k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.03k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.03k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.03k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.03k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.03k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2966|       |
 2967|       |  // Get the size for the index of metalayers
 2968|  1.03k|  uint16_t idx_size;
 2969|  1.03k|  header_pos += sizeof(idx_size);
 2970|  1.03k|  if (header_len < header_pos) {
  ------------------
  |  Branch (2970:7): [True: 0, False: 1.03k]
  ------------------
 2971|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2972|      0|  }
 2973|  1.03k|  from_big(&idx_size, header + FRAME_IDX_SIZE, sizeof(idx_size));
  ------------------
  |  |   38|  1.03k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2974|       |
 2975|       |  // Get the actual index of metalayers
 2976|  1.03k|  uint8_t* metalayers_idx = header + FRAME_IDX_SIZE + 2;
  ------------------
  |  |   51|  1.03k|#define FRAME_IDX_SIZE (FRAME_METALAYERS + 1 + 1)  // 89
  |  |  ------------------
  |  |  |  |   50|  1.03k|#define FRAME_METALAYERS (FRAME_HEADER_MINLEN)  // 87
  |  |  |  |  ------------------
  |  |  |  |  |  |   49|  1.03k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   44|  1.03k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   43|  1.03k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   42|  1.03k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   41|  1.03k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   40|  1.03k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  1.03k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  1.03k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  1.03k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  1.03k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  1.03k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  1.03k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  1.03k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  1.03k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2977|  1.03k|  header_pos += 1;
 2978|  1.03k|  if (header_len < header_pos) {
  ------------------
  |  Branch (2978:7): [True: 0, False: 1.03k]
  ------------------
 2979|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2980|      0|  }
 2981|  1.03k|  if (metalayers_idx[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (2981:7): [True: 24, False: 1.01k]
  ------------------
 2982|     24|    return BLOSC2_ERROR_DATA;
 2983|     24|  }
 2984|  1.01k|  uint8_t* idxp = metalayers_idx + 1;
 2985|  1.01k|  uint16_t nmetalayers;
 2986|  1.01k|  header_pos += sizeof(nmetalayers);
 2987|  1.01k|  if (header_len < header_pos) {
  ------------------
  |  Branch (2987:7): [True: 0, False: 1.01k]
  ------------------
 2988|      0|    return BLOSC2_ERROR_READ_BUFFER;
 2989|      0|  }
 2990|  1.01k|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|  1.01k|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 2991|  1.01k|  idxp += 2;
 2992|  1.01k|  if (nmetalayers > BLOSC2_MAX_METALAYERS) {
  ------------------
  |  | 1895|  1.01k|#define BLOSC2_MAX_METALAYERS 16
  ------------------
  |  Branch (2992:7): [True: 11, False: 999]
  ------------------
 2993|     11|    return BLOSC2_ERROR_DATA;
 2994|     11|  }
 2995|    999|  schunk->nmetalayers = nmetalayers;
 2996|       |
 2997|       |  // Populate the metalayers and its serialized values
 2998|    999|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2998:28): [True: 31, False: 968]
  ------------------
 2999|     31|    header_pos += 1;
 3000|     31|    if (header_len < header_pos) {
  ------------------
  |  Branch (3000:9): [True: 0, False: 31]
  ------------------
 3001|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3002|      0|    }
 3003|     31|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (3003:9): [True: 2, False: 29]
  ------------------
 3004|      2|      return BLOSC2_ERROR_DATA;
 3005|      2|    }
 3006|     29|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 3007|     29|    if (metalayer == NULL) {
  ------------------
  |  Branch (3007:9): [True: 0, False: 29]
  ------------------
 3008|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3009|      0|    }
 3010|     29|    schunk->metalayers[nmetalayer] = metalayer;
 3011|       |
 3012|       |    // Populate the metalayer string
 3013|     29|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 3014|     29|    idxp += 1;
 3015|     29|    header_pos += nslen;
 3016|     29|    if (header_len < header_pos) {
  ------------------
  |  Branch (3016:9): [True: 0, False: 29]
  ------------------
 3017|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3018|      0|    }
 3019|     29|    char* ns = malloc((size_t)nslen + 1);
 3020|     29|    if (ns == NULL) {
  ------------------
  |  Branch (3020:9): [True: 0, False: 29]
  ------------------
 3021|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3022|      0|    }
 3023|     29|    memcpy(ns, idxp, nslen);
 3024|     29|    ns[nslen] = '\0';
 3025|     29|    idxp += nslen;
 3026|     29|    metalayer->name = ns;
 3027|       |
 3028|       |    // Populate the serialized value for this metalayer
 3029|       |    // Get the offset
 3030|     29|    header_pos += 1;
 3031|     29|    if (header_len < header_pos) {
  ------------------
  |  Branch (3031:9): [True: 2, False: 27]
  ------------------
 3032|      2|      return BLOSC2_ERROR_READ_BUFFER;
 3033|      2|    }
 3034|     27|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (3034:9): [True: 4, False: 23]
  ------------------
 3035|      4|      return BLOSC2_ERROR_DATA;
 3036|      4|    }
 3037|     23|    idxp += 1;
 3038|     23|    int32_t offset;
 3039|     23|    header_pos += sizeof(offset);
 3040|     23|    if (header_len < header_pos) {
  ------------------
  |  Branch (3040:9): [True: 1, False: 22]
  ------------------
 3041|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3042|      1|    }
 3043|     22|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|     22|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3044|     22|    idxp += 4;
 3045|     22|    if (offset < 0 || offset >= header_len) {
  ------------------
  |  Branch (3045:9): [True: 2, False: 20]
  |  Branch (3045:23): [True: 10, False: 10]
  ------------------
 3046|       |      // Offset is less than zero or exceeds header length
 3047|     12|      return BLOSC2_ERROR_DATA;
 3048|     12|    }
 3049|       |    // Go to offset and see if we have the correct marker
 3050|     10|    uint8_t* content_marker = header + offset;
 3051|     10|    if ((int64_t)header_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (3051:9): [True: 1, False: 9]
  ------------------
 3052|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3053|      1|    }
 3054|      9|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (3054:9): [True: 4, False: 5]
  ------------------
 3055|      4|      return BLOSC2_ERROR_DATA;
 3056|      4|    }
 3057|       |
 3058|       |    // Read the size of the content
 3059|      5|    int32_t content_len;
 3060|      5|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|      5|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3061|      5|    if (content_len < 0) {
  ------------------
  |  Branch (3061:9): [True: 1, False: 4]
  ------------------
 3062|      1|      return BLOSC2_ERROR_DATA;
 3063|      1|    }
 3064|      4|    metalayer->content_len = content_len;
 3065|       |
 3066|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 3067|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 3068|       |    // bounds check, which would let memcpy below read past the header buffer.
 3069|      4|    if ((int64_t)header_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (3069:9): [True: 4, False: 0]
  ------------------
 3070|      4|      return BLOSC2_ERROR_READ_BUFFER;
 3071|      4|    }
 3072|      0|    char* content = malloc((size_t)content_len);
 3073|       |    // malloc(0) is allowed to return NULL, and blosc2_meta_add accepts
 3074|       |    // content_len == 0, so only treat NULL as an allocation failure when
 3075|       |    // a non-zero allocation was requested.
 3076|      0|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (3076:9): [True: 0, False: 0]
  |  Branch (3076:28): [True: 0, False: 0]
  ------------------
 3077|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3078|      0|    }
 3079|      0|    if (content_len > 0) {
  ------------------
  |  Branch (3079:9): [True: 0, False: 0]
  ------------------
 3080|      0|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 3081|      0|    }
 3082|      0|    metalayer->content = (uint8_t*)content;
 3083|      0|  }
 3084|       |
 3085|    968|  return 1;
 3086|    999|}
frame.c:get_vlmeta_from_trailer:
 3166|    967|                                   int32_t trailer_len) {
 3167|       |
 3168|    967|  BLOSC_UNUSED_PARAM(frame);
  ------------------
  |  |   28|    967|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
 3169|    967|  int64_t trailer_pos = FRAME_TRAILER_VLMETALAYERS + 2;
  ------------------
  |  |   60|    967|#define FRAME_TRAILER_VLMETALAYERS (2)
  ------------------
 3170|    967|  uint8_t* idxp = trailer + trailer_pos;
 3171|       |
 3172|       |  // Get the size for the index of metalayers
 3173|    967|  trailer_pos += 2;
 3174|    967|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3174:7): [True: 0, False: 967]
  ------------------
 3175|      0|    return BLOSC2_ERROR_READ_BUFFER;
 3176|      0|  }
 3177|    967|  uint16_t idx_size;
 3178|    967|  from_big(&idx_size, idxp, sizeof(idx_size));
  ------------------
  |  |   38|    967|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3179|    967|  idxp += 2;
 3180|       |
 3181|    967|  trailer_pos += 1;
 3182|       |  // Get the actual index of metalayers
 3183|    967|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3183:7): [True: 0, False: 967]
  ------------------
 3184|      0|    return BLOSC2_ERROR_READ_BUFFER;
 3185|      0|  }
 3186|    967|  if (idxp[0] != 0xde) {   // sanity check
  ------------------
  |  Branch (3186:7): [True: 28, False: 939]
  ------------------
 3187|     28|    return BLOSC2_ERROR_DATA;
 3188|     28|  }
 3189|    939|  idxp += 1;
 3190|       |
 3191|       |  // The on-wire encoding is unsigned (uint16 follows the msgpack `0xde`
 3192|       |  // map16 marker), but `schunk->nvlmetalayers` is int16_t. Decoding into a
 3193|       |  // signed local would let raw bytes like 0xff 0xff slip past the
 3194|       |  // `> BLOSC2_MAX_VLMETALAYERS` ceiling as a negative count, after which
 3195|       |  // a later `blosc2_vlmeta_add` would write through `vlmetalayers[-1]`
 3196|       |  // and corrupt adjacent schunk fields. Decode unsigned, then narrow.
 3197|    939|  uint16_t nmetalayers;
 3198|    939|  trailer_pos += sizeof(nmetalayers);
 3199|    939|  if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3199:7): [True: 0, False: 939]
  ------------------
 3200|      0|    return BLOSC2_ERROR_READ_BUFFER;
 3201|      0|  }
 3202|    939|  from_big(&nmetalayers, idxp, sizeof(uint16_t));
  ------------------
  |  |   38|    939|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3203|    939|  idxp += 2;
 3204|    939|  if (nmetalayers > BLOSC2_MAX_VLMETALAYERS) {
  ------------------
  |  | 1901|    939|#define BLOSC2_MAX_VLMETALAYERS (8 * 1024)
  ------------------
  |  Branch (3204:7): [True: 3, False: 936]
  ------------------
 3205|      3|    return BLOSC2_ERROR_DATA;
 3206|      3|  }
 3207|    936|  schunk->nvlmetalayers = (int16_t)nmetalayers;
 3208|       |
 3209|       |  // Populate the metalayers and its serialized values
 3210|  1.47k|  for (int nmetalayer = 0; nmetalayer < nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (3210:28): [True: 606, False: 872]
  ------------------
 3211|    606|    trailer_pos += 1;
 3212|    606|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3212:9): [True: 0, False: 606]
  ------------------
 3213|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3214|      0|    }
 3215|    606|    if ((*idxp & 0xe0u) != 0xa0u) {   // sanity check
  ------------------
  |  Branch (3215:9): [True: 3, False: 603]
  ------------------
 3216|      3|      return BLOSC2_ERROR_DATA;
 3217|      3|    }
 3218|    603|    blosc2_metalayer* metalayer = calloc(1, sizeof(blosc2_metalayer));
 3219|    603|    if (metalayer == NULL) {
  ------------------
  |  Branch (3219:9): [True: 0, False: 603]
  ------------------
 3220|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3221|      0|    }
 3222|    603|    schunk->vlmetalayers[nmetalayer] = metalayer;
 3223|       |
 3224|       |    // Populate the metalayer string
 3225|    603|    uint8_t nslen = *idxp & (uint8_t)0x1F;
 3226|    603|    idxp += 1;
 3227|    603|    trailer_pos += nslen;
 3228|    603|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3228:9): [True: 0, False: 603]
  ------------------
 3229|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3230|      0|    }
 3231|    603|    char* ns = malloc((size_t)nslen + 1);
 3232|    603|    if (ns == NULL) {
  ------------------
  |  Branch (3232:9): [True: 0, False: 603]
  ------------------
 3233|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3234|      0|    }
 3235|    603|    memcpy(ns, idxp, nslen);
 3236|    603|    ns[nslen] = '\0';
 3237|    603|    idxp += nslen;
 3238|    603|    metalayer->name = ns;
 3239|       |
 3240|       |    // Populate the serialized value for this metalayer
 3241|       |    // Get the offset
 3242|    603|    trailer_pos += 1;
 3243|    603|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3243:9): [True: 0, False: 603]
  ------------------
 3244|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3245|      0|    }
 3246|    603|    if ((*idxp & 0xffu) != 0xd2u) {   // sanity check
  ------------------
  |  Branch (3246:9): [True: 6, False: 597]
  ------------------
 3247|      6|      return BLOSC2_ERROR_DATA;
 3248|      6|    }
 3249|    597|    idxp += 1;
 3250|    597|    int32_t offset;
 3251|    597|    trailer_pos += sizeof(offset);
 3252|    597|    if (trailer_len < trailer_pos) {
  ------------------
  |  Branch (3252:9): [True: 0, False: 597]
  ------------------
 3253|      0|      return BLOSC2_ERROR_READ_BUFFER;
 3254|      0|    }
 3255|    597|    from_big(&offset, idxp, sizeof(offset));
  ------------------
  |  |   38|    597|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3256|    597|    idxp += 4;
 3257|    597|    if (offset < 0 || offset >= trailer_len) {
  ------------------
  |  Branch (3257:9): [True: 12, False: 585]
  |  Branch (3257:23): [True: 32, False: 553]
  ------------------
 3258|       |      // Offset is less than zero or exceeds trailer length
 3259|     44|      return BLOSC2_ERROR_DATA;
 3260|     44|    }
 3261|       |    // Go to offset and see if we have the correct marker
 3262|    553|    uint8_t* content_marker = trailer + offset;
 3263|    553|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4) {
  ------------------
  |  Branch (3263:9): [True: 1, False: 552]
  ------------------
 3264|      1|      return BLOSC2_ERROR_READ_BUFFER;
 3265|      1|    }
 3266|    552|    if (*content_marker != 0xc6) {
  ------------------
  |  Branch (3266:9): [True: 3, False: 549]
  ------------------
 3267|      3|      return BLOSC2_ERROR_DATA;
 3268|      3|    }
 3269|       |
 3270|       |    // Read the size of the content
 3271|    549|    int32_t content_len;
 3272|    549|    from_big(&content_len, content_marker + 1, sizeof(content_len));
  ------------------
  |  |   38|    549|#define from_big(dest, src, itemsize)     endian_handler(false, dest, src, itemsize)
  ------------------
 3273|    549|    if (content_len < 0) {
  ------------------
  |  Branch (3273:9): [True: 5, False: 544]
  ------------------
 3274|      5|      return BLOSC2_ERROR_DATA;
 3275|      5|    }
 3276|    544|    metalayer->content_len = content_len;
 3277|       |
 3278|       |    // Finally, read the content. Use 64-bit arithmetic so a malicious
 3279|       |    // (offset, content_len) pair near INT32_MAX cannot wrap and bypass the
 3280|       |    // bounds check, which would let memcpy below read past the trailer buffer.
 3281|    544|    if ((int64_t)trailer_len < (int64_t)offset + 1 + 4 + (int64_t)content_len) {
  ------------------
  |  Branch (3281:9): [True: 2, False: 542]
  ------------------
 3282|      2|      return BLOSC2_ERROR_READ_BUFFER;
 3283|      2|    }
 3284|    542|    char* content = malloc((size_t)content_len);
 3285|       |    // Same zero-length carve-out as in get_meta_from_header: malloc(0) may
 3286|       |    // return NULL on some platforms, and the public API allows
 3287|       |    // content_len == 0, so don't reject a valid empty vlmetalayer.
 3288|    542|    if (content_len > 0 && content == NULL) {
  ------------------
  |  Branch (3288:9): [True: 538, False: 4]
  |  Branch (3288:28): [True: 0, False: 538]
  ------------------
 3289|      0|      return BLOSC2_ERROR_MEMORY_ALLOC;
 3290|      0|    }
 3291|    542|    if (content_len > 0) {
  ------------------
  |  Branch (3291:9): [True: 538, False: 4]
  ------------------
 3292|    538|      memcpy(content, content_marker + 1 + 4, (size_t)content_len);
 3293|    538|    }
 3294|    542|    metalayer->content = (uint8_t*)content;
 3295|    542|  }
 3296|    872|  return 1;
 3297|    936|}
frame.c:validate_offsets_chunk:
 3455|  6.96k|                                  int64_t nchunks) {
 3456|  6.96k|  int32_t coffsets_cbytes = 0;
 3457|  6.96k|  uint8_t* coffsets = get_coffsets(frame, header_len, cbytes, nchunks, &coffsets_cbytes);
 3458|  6.96k|  if (coffsets == NULL) {
  ------------------
  |  Branch (3458:7): [True: 26, False: 6.93k]
  ------------------
 3459|     26|    BLOSC_TRACE_ERROR("Cannot get compressed offsets from frame.");
  ------------------
  |  |   93|     26|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     26|    do {                                            \
  |  |  |  |   98|     26|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     26|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 26, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     26|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3460|     26|    return BLOSC2_ERROR_DATA;
 3461|     26|  }
 3462|       |
 3463|  6.93k|  int32_t offsets_nbytes;
 3464|  6.93k|  if (!blosc2_nchunks_to_offsets_nbytes(nchunks, &offsets_nbytes)) {
  ------------------
  |  Branch (3464:7): [True: 0, False: 6.93k]
  ------------------
 3465|      0|    BLOSC_TRACE_ERROR("Too many chunks for offsets representation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3466|      0|    return BLOSC2_ERROR_FAILURE;
 3467|      0|  }
 3468|       |
 3469|  6.93k|  int64_t* offsets = (int64_t*)malloc((size_t)offsets_nbytes);
 3470|  6.93k|  if (offsets == NULL) {
  ------------------
  |  Branch (3470:7): [True: 0, False: 6.93k]
  ------------------
 3471|      0|    BLOSC_TRACE_ERROR("Cannot allocate memory for offsets validation.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3472|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 3473|      0|  }
 3474|       |
 3475|  6.93k|  blosc2_dparams off_dparams = BLOSC2_DPARAMS_DEFAULTS;
 3476|  6.93k|  blosc2_context* dctx = blosc2_create_dctx(off_dparams);
 3477|  6.93k|  if (dctx == NULL) {
  ------------------
  |  Branch (3477:7): [True: 0, False: 6.93k]
  ------------------
 3478|      0|    free(offsets);
 3479|      0|    BLOSC_TRACE_ERROR("Error while creating the decompression context.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3480|      0|    return BLOSC2_ERROR_FAILURE;
 3481|      0|  }
 3482|       |
 3483|  6.93k|  int32_t off_nbytes = blosc2_decompress_ctx(dctx, coffsets, coffsets_cbytes,
 3484|  6.93k|                                             offsets, offsets_nbytes);
 3485|  6.93k|  blosc2_free_ctx(dctx);
 3486|  6.93k|  if (off_nbytes != offsets_nbytes) {
  ------------------
  |  Branch (3486:7): [True: 5.68k, False: 1.25k]
  ------------------
 3487|  5.68k|    free(offsets);
 3488|  5.68k|    BLOSC_TRACE_ERROR("Cannot decompress offsets chunk.");
  ------------------
  |  |   93|  5.68k|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|  5.68k|    do {                                            \
  |  |  |  |   98|  5.68k|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|  5.68k|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 5.68k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|  5.68k|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3489|  5.68k|    return BLOSC2_ERROR_DATA;
 3490|  5.68k|  }
 3491|       |
 3492|   803M|  for (int64_t i = 0; i < nchunks; ++i) {
  ------------------
  |  Branch (3492:23): [True: 803M, False: 1.23k]
  ------------------
 3493|   803M|    int64_t offset = offsets[i];
 3494|   803M|    if (offset < 0) {
  ------------------
  |  Branch (3494:9): [True: 11.2M, False: 792M]
  ------------------
 3495|  11.2M|      continue;
 3496|  11.2M|    }
 3497|   792M|    if (offset > INT64_MAX - header_len || offset > cbytes - BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (3497:9): [True: 0, False: 792M]
  |  Branch (3497:44): [True: 20, False: 792M]
  ------------------
 3498|     20|      free(offsets);
 3499|     20|      BLOSC_TRACE_ERROR("Offset for chunk %" PRId64 " is out of bounds.", i);
  ------------------
  |  |   93|     20|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     20|    do {                                            \
  |  |  |  |   98|     20|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     20|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 20, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     20|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3500|     20|      return BLOSC2_ERROR_INVALID_HEADER;
 3501|     20|    }
 3502|       |    /* Offsets do not need to be monotonic.  Frame mutations like insert can append
 3503|       |     * chunk payloads at the end of the cframe while updating the logical chunk order
 3504|       |     * only in the offsets table, so a valid frame may legitimately contain
 3505|       |     * non-monotonic non-negative offsets.
 3506|       |     */
 3507|   792M|  }
 3508|       |
 3509|  1.23k|  free(offsets);
 3510|  1.23k|  return 0;
 3511|  1.25k|}
frame.c:special_chunk_into:
 4042|  31.2k|                              uint8_t* dest, int32_t cbytes) {
 4043|  31.2k|  int rc = 0;
 4044|       |
 4045|       |  // Detect the kind of special value
 4046|  31.2k|  uint64_t zeros_mask = (uint64_t) BLOSC2_SPECIAL_ZERO << (8 * 7);  // chunk of zeros
 4047|  31.2k|  uint64_t nans_mask = (uint64_t) BLOSC2_SPECIAL_NAN << (8 * 7);  // chunk of NaNs
 4048|  31.2k|  uint64_t uninit_mask = (uint64_t) BLOSC2_SPECIAL_UNINIT << (8 * 7);  // chunk of uninit values
 4049|       |
 4050|  31.2k|  blosc2_cparams cparams = BLOSC2_CPARAMS_DEFAULTS;
 4051|  31.2k|  cparams.typesize = typesize;
 4052|  31.2k|  cparams.blocksize = blocksize;
 4053|  31.2k|  if (special_value & zeros_mask) {
  ------------------
  |  Branch (4053:7): [True: 28.7k, False: 2.43k]
  ------------------
 4054|  28.7k|    rc = blosc2_chunk_zeros(cparams, nbytes, dest, cbytes);
 4055|  28.7k|    if (rc < 0) {
  ------------------
  |  Branch (4055:9): [True: 13, False: 28.7k]
  ------------------
 4056|     13|      BLOSC_TRACE_ERROR("Error creating a zero chunk");
  ------------------
  |  |   93|     13|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     13|    do {                                            \
  |  |  |  |   98|     13|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     13|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 13, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     13|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4057|     13|    }
 4058|  28.7k|  }
 4059|  2.43k|  else if (special_value & uninit_mask) {
  ------------------
  |  Branch (4059:12): [True: 1.91k, False: 521]
  ------------------
 4060|  1.91k|    rc = blosc2_chunk_uninit(cparams, nbytes, dest, cbytes);
 4061|  1.91k|    if (rc < 0) {
  ------------------
  |  Branch (4061:9): [True: 2, False: 1.91k]
  ------------------
 4062|      2|      BLOSC_TRACE_ERROR("Error creating a non initialized chunk");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4063|      2|    }
 4064|  1.91k|  }
 4065|    521|  else if (special_value & nans_mask) {
  ------------------
  |  Branch (4065:12): [True: 502, False: 19]
  ------------------
 4066|    502|    rc = blosc2_chunk_nans(cparams, nbytes, dest, cbytes);
 4067|    502|    if (rc < 0) {
  ------------------
  |  Branch (4067:9): [True: 10, False: 492]
  ------------------
 4068|     10|      BLOSC_TRACE_ERROR("Error creating a nan chunk");
  ------------------
  |  |   93|     10|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     10|    do {                                            \
  |  |  |  |   98|     10|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     10|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 10, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     10|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4069|     10|    }
 4070|    502|  }
 4071|     19|  else {
 4072|       |    BLOSC_TRACE_ERROR("Special value not recognized: %" PRId64 "", special_value);
  ------------------
  |  |   93|     19|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     19|    do {                                            \
  |  |  |  |   98|     19|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     19|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 19, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     19|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4073|     19|    rc = BLOSC2_ERROR_DATA;
 4074|     19|  }
 4075|  31.2k|  return rc;
 4076|  31.2k|}
frame.c:get_chunk:
 4110|  76.4k|                     size_t *capacity) {
 4111|  76.4k|  if (capacity != NULL) {
  ------------------
  |  Branch (4111:7): [True: 76.4k, False: 0]
  ------------------
 4112|  76.4k|    *capacity = 0;
 4113|  76.4k|  }
 4114|  76.4k|  int32_t header_len;
 4115|  76.4k|  int64_t frame_len;
 4116|  76.4k|  int64_t nbytes;
 4117|  76.4k|  int64_t cbytes;
 4118|  76.4k|  int32_t blocksize;
 4119|  76.4k|  int32_t chunksize;
 4120|  76.4k|  int64_t nchunks;
 4121|  76.4k|  int32_t typesize;
 4122|  76.4k|  int64_t offset;
 4123|  76.4k|  int32_t chunk_cbytes;
 4124|  76.4k|  int rc;
 4125|       |
 4126|  76.4k|  *chunk = NULL;
 4127|  76.4k|  *needs_free = false;
 4128|  76.4k|  rc = get_header_info(frame, &header_len, &frame_len, &nbytes, &cbytes,
 4129|  76.4k|                       &blocksize, &chunksize, &nchunks,
 4130|  76.4k|                       &typesize, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 4131|  76.4k|                       frame->schunk->storage->io);
 4132|  76.4k|  if (rc < 0) {
  ------------------
  |  Branch (4132:7): [True: 0, False: 76.4k]
  ------------------
 4133|      0|    BLOSC_TRACE_ERROR("Unable to get meta info from frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4134|      0|    return rc;
 4135|      0|  }
 4136|  76.4k|  rc = frame_refresh_if_stale(frame, frame_len);
 4137|  76.4k|  if (rc < 0) {
  ------------------
  |  Branch (4137:7): [True: 0, False: 76.4k]
  ------------------
 4138|      0|    BLOSC_TRACE_ERROR("Unable to refresh the frame state from disk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4139|      0|    return rc;
 4140|      0|  }
 4141|  76.4k|  if (rc > 0) {
  ------------------
  |  Branch (4141:7): [True: 0, False: 76.4k]
  ------------------
 4142|       |    // Keep the schunk-level counters in sync with the refreshed on-disk state.
 4143|       |    // Mutating ops (update/delete) read a chunk before adjusting the counters,
 4144|       |    // so this also gives them a fresh base to apply their deltas on.
 4145|      0|    frame->schunk->nbytes = nbytes;
 4146|      0|    frame->schunk->cbytes = cbytes;
 4147|      0|    frame->schunk->nchunks = nchunks;
 4148|      0|  }
 4149|       |
 4150|  76.4k|  if ((nchunks > 0) && (nchunk >= nchunks)) {
  ------------------
  |  Branch (4150:7): [True: 76.4k, False: 0]
  |  Branch (4150:24): [True: 0, False: 76.4k]
  ------------------
 4151|      0|    BLOSC_TRACE_ERROR("nchunk ('%" PRId64 "') exceeds the number of chunks "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4152|      0|                    "('%" PRId64 "') in frame.", nchunk, nchunks);
 4153|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 4154|      0|  }
 4155|       |
 4156|       |  // Get the offset to nchunk
 4157|  76.4k|  rc = get_coffset(frame, header_len, cbytes, nchunk, nchunks, &offset);
 4158|  76.4k|  if (rc < 0) {
  ------------------
  |  Branch (4158:7): [True: 129, False: 76.3k]
  ------------------
 4159|    129|    BLOSC_TRACE_ERROR("Unable to get offset to chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|    129|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|    129|    do {                                            \
  |  |  |  |   98|    129|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|    129|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 129, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|    129|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4160|    129|    return rc;
 4161|    129|  }
 4162|       |
 4163|  76.3k|  if (offset < 0) {
  ------------------
  |  Branch (4163:7): [True: 30.6k, False: 45.6k]
  ------------------
 4164|       |    // Special value
 4165|  30.6k|    if (chunksize <= 0) {
  ------------------
  |  Branch (4165:9): [True: 0, False: 30.6k]
  ------------------
 4166|      0|      BLOSC_TRACE_ERROR("Cannot synthesize special chunk with chunksize <= 0.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4167|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4168|      0|    }
 4169|  30.6k|    chunk_cbytes = BLOSC_EXTENDED_HEADER_LENGTH;
 4170|  30.6k|    int32_t chunksize_ = chunksize;
 4171|  30.6k|    if ((nchunk == nchunks - 1) && (nbytes % chunksize)) {
  ------------------
  |  Branch (4171:9): [True: 0, False: 30.6k]
  |  Branch (4171:36): [True: 0, False: 0]
  ------------------
 4172|       |      // Last chunk is incomplete.  Compute its actual size.
 4173|      0|      chunksize_ = (int32_t) (nbytes % chunksize);
 4174|      0|    }
 4175|  30.6k|    rc = frame_special_chunk(offset, chunksize_, typesize, blocksize, chunk, chunk_cbytes, needs_free);
 4176|  30.6k|    if (rc < 0) {
  ------------------
  |  Branch (4176:9): [True: 31, False: 30.6k]
  ------------------
 4177|     31|      return rc;
 4178|     31|    }
 4179|  30.6k|    goto end;
 4180|  30.6k|  }
 4181|       |
 4182|  45.6k|  if (frame->sframe) {
  ------------------
  |  Branch (4182:7): [True: 0, False: 45.6k]
  ------------------
 4183|       |    // Sparse on-disk
 4184|      0|    nchunk = offset;
 4185|      0|    return sframe_get_chunk(frame, nchunk, chunk, needs_free);
 4186|      0|  }
 4187|       |
 4188|  45.6k|  blosc2_io_cb *io_cb = blosc2_get_io_cb(frame->schunk->storage->io->id);
 4189|  45.6k|  if (io_cb == NULL) {
  ------------------
  |  Branch (4189:7): [True: 0, False: 45.6k]
  ------------------
 4190|      0|    BLOSC_TRACE_ERROR("Error getting the input/output API");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4191|      0|    return BLOSC2_ERROR_PLUGIN_IO;
 4192|      0|  }
 4193|       |
 4194|  45.6k|  if (frame->cframe == NULL) {
  ------------------
  |  Branch (4194:7): [True: 0, False: 45.6k]
  ------------------
 4195|      0|    uint8_t* header_ptr;
 4196|      0|    uint8_t header[BLOSC_EXTENDED_HEADER_LENGTH];
 4197|      0|    void* fp = frame_reader_acquire(frame, frame->schunk->storage->io);
 4198|      0|    if (fp == NULL) {
  ------------------
  |  Branch (4198:9): [True: 0, False: 0]
  ------------------
 4199|      0|      BLOSC_TRACE_ERROR("Error opening file in: %s", frame->urlpath);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4200|      0|      return BLOSC2_ERROR_FILE_OPEN;
 4201|      0|    }
 4202|      0|    if (io_cb->is_allocation_necessary)
  ------------------
  |  Branch (4202:9): [True: 0, False: 0]
  ------------------
 4203|      0|      header_ptr = header;
 4204|      0|    int64_t io_pos = frame->file_offset + header_len + offset;
 4205|      0|    int64_t rbytes = io_cb->read((void**)&header_ptr, 1, sizeof(header), io_pos, fp);
 4206|      0|    if (rbytes != BLOSC_EXTENDED_HEADER_LENGTH) {
  ------------------
  |  Branch (4206:9): [True: 0, False: 0]
  ------------------
 4207|      0|      BLOSC_TRACE_ERROR("Cannot read the cbytes for chunk in the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4208|      0|      frame_reader_release(frame, io_cb, fp);
 4209|      0|      return BLOSC2_ERROR_FILE_READ;
 4210|      0|    }
 4211|      0|    rc = blosc2_cbuffer_sizes(header_ptr, NULL, &chunk_cbytes, NULL);
 4212|      0|    if (rc < 0) {
  ------------------
  |  Branch (4212:9): [True: 0, False: 0]
  ------------------
 4213|      0|      BLOSC_TRACE_ERROR("Cannot read the cbytes for chunk in the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4214|      0|      frame_reader_release(frame, io_cb, fp);
 4215|      0|      return rc;
 4216|      0|    }
 4217|      0|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4217:9): [True: 0, False: 0]
  ------------------
 4218|      0|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (4218:9): [True: 0, False: 0]
  ------------------
 4219|      0|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (4219:9): [True: 0, False: 0]
  ------------------
 4220|      0|      BLOSC_TRACE_ERROR("Invalid chunk size in frame for chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4221|      0|      frame_reader_release(frame, io_cb, fp);
 4222|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4223|      0|    }
 4224|      0|    if (io_cb->is_allocation_necessary) {
  ------------------
  |  Branch (4224:9): [True: 0, False: 0]
  ------------------
 4225|      0|      *chunk = capacity != NULL ? blosc2_tmp_malloc(chunk_cbytes, capacity) : malloc(chunk_cbytes);
  ------------------
  |  Branch (4225:16): [True: 0, False: 0]
  ------------------
 4226|      0|      if (*chunk == NULL) {
  ------------------
  |  Branch (4226:11): [True: 0, False: 0]
  ------------------
 4227|      0|        BLOSC_TRACE_ERROR("Cannot allocate memory for chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4228|      0|        frame_reader_release(frame, io_cb, fp);
 4229|      0|        return BLOSC2_ERROR_MEMORY_ALLOC;
 4230|      0|      }
 4231|      0|      *needs_free = true;
 4232|      0|    }
 4233|      0|    else {
 4234|      0|      *needs_free = false;
 4235|      0|    }
 4236|       |
 4237|      0|    io_pos = frame->file_offset + header_len + offset;
 4238|      0|    rbytes = io_cb->read((void**)chunk, 1, chunk_cbytes, io_pos, fp);
 4239|      0|    frame_reader_release(frame, io_cb, fp);
 4240|      0|    if (rbytes != chunk_cbytes) {
  ------------------
  |  Branch (4240:9): [True: 0, False: 0]
  ------------------
 4241|      0|      BLOSC_TRACE_ERROR("Cannot read the chunk out of the frame.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4242|      0|      if (*needs_free) {
  ------------------
  |  Branch (4242:11): [True: 0, False: 0]
  ------------------
 4243|      0|        free(*chunk);
 4244|      0|        *chunk = NULL;
 4245|      0|        *needs_free = false;
 4246|      0|      }
 4247|      0|      return BLOSC2_ERROR_FILE_READ;
 4248|      0|    }
 4249|       |
 4250|  45.6k|  } else {
 4251|       |    // The chunk is in memory and just one pointer away
 4252|  45.6k|    *chunk = frame->cframe + header_len + offset;
 4253|  45.6k|    int32_t chunk_blocksize = 0;
 4254|  45.6k|    rc = blosc2_cbuffer_sizes(*chunk, NULL, &chunk_cbytes, &chunk_blocksize);
 4255|  45.6k|    if (rc < 0) {
  ------------------
  |  Branch (4255:9): [True: 24, False: 45.6k]
  ------------------
 4256|     24|      return rc;
 4257|     24|    }
 4258|  45.6k|    if (chunk_blocksize <= 0) {
  ------------------
  |  Branch (4258:9): [True: 0, False: 45.6k]
  ------------------
 4259|      0|      BLOSC_TRACE_ERROR("Invalid blocksize %d in chunk header.", chunk_blocksize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4260|      0|      return BLOSC2_ERROR_INVALID_HEADER;
 4261|      0|    }
 4262|  45.6k|    if (chunk_cbytes < BLOSC_EXTENDED_HEADER_LENGTH ||
  ------------------
  |  Branch (4262:9): [True: 1, False: 45.6k]
  ------------------
 4263|  45.6k|        offset > INT64_MAX - chunk_cbytes ||
  ------------------
  |  Branch (4263:9): [True: 0, False: 45.6k]
  ------------------
 4264|  45.6k|        offset + chunk_cbytes > cbytes) {
  ------------------
  |  Branch (4264:9): [True: 52, False: 45.6k]
  ------------------
 4265|     53|      BLOSC_TRACE_ERROR("Invalid chunk size in frame for chunk %" PRId64 ".", nchunk);
  ------------------
  |  |   93|     53|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     53|    do {                                            \
  |  |  |  |   98|     53|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     53|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 53, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     53|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4266|     53|      return BLOSC2_ERROR_INVALID_HEADER;
 4267|     53|    }
 4268|  45.6k|  }
 4269|       |
 4270|  76.2k|  end:
 4271|  76.2k|  return (int32_t)chunk_cbytes;
 4272|  45.6k|}

prefetch_set_populate:
   85|  7.08k|void prefetch_set_populate(int mode) {
   86|  7.08k|  g_populate = mode < 0 ? -1 : (mode > 0);
  ------------------
  |  Branch (86:16): [True: 7.08k, False: 0]
  ------------------
   87|  7.08k|}
prefetch_destroy:
  356|  7.08k|void prefetch_destroy(void) {
  357|  7.08k|  pthread_mutex_lock(&destroy_mutex);
  358|  7.08k|  pthread_mutex_lock(&pool.mutex);
  359|  7.08k|  if (pool.threads == NULL) {
  ------------------
  |  Branch (359:7): [True: 7.08k, False: 0]
  ------------------
  360|  7.08k|    pthread_mutex_unlock(&pool.mutex);
  361|  7.08k|    pthread_mutex_unlock(&destroy_mutex);
  362|  7.08k|    return;
  363|  7.08k|  }
  364|      0|  pool.stop = true;
  365|      0|  pthread_cond_broadcast(&pool.work);
  366|      0|  int nthreads = pool.nthreads;
  367|      0|  pthread_t *threads = pool.threads;
  368|      0|  pool.threads = NULL;
  369|      0|  pool.nthreads = 0;
  370|      0|  pthread_mutex_unlock(&pool.mutex);
  371|       |
  372|      0|  for (int i = 0; i < nthreads; ++i) {
  ------------------
  |  Branch (372:19): [True: 0, False: 0]
  ------------------
  373|      0|    pthread_join(threads[i], NULL);
  374|      0|  }
  375|      0|  free(threads);
  376|       |
  377|      0|  pthread_mutex_lock(&pool.mutex);
  378|       |  pool.stop = false;
  379|      0|  pthread_mutex_unlock(&pool.mutex);
  380|      0|  pthread_mutex_unlock(&destroy_mutex);
  381|      0|}

blosc2_schunk_get_cparams:
   73|  7.00k|int blosc2_schunk_get_cparams(blosc2_schunk *schunk, blosc2_cparams **cparams) {
   74|  7.00k|  *cparams = calloc(1, sizeof(blosc2_cparams));
   75|  7.00k|  (*cparams)->schunk = schunk;
   76|  49.0k|  for (int i = 0; i < BLOSC2_MAX_FILTERS; i++) {
  ------------------
  |  Branch (76:19): [True: 42.0k, False: 7.00k]
  ------------------
   77|  42.0k|    (*cparams)->filters[i] = schunk->filters[i];
   78|  42.0k|    (*cparams)->filters_meta[i] = schunk->filters_meta[i];
   79|  42.0k|  }
   80|  7.00k|  (*cparams)->compcode = schunk->compcode;
   81|  7.00k|  (*cparams)->compcode_meta = schunk->compcode_meta;
   82|  7.00k|  (*cparams)->clevel = schunk->clevel;
   83|  7.00k|  (*cparams)->typesize = schunk->typesize;
   84|  7.00k|  (*cparams)->blocksize = schunk->blocksize;
   85|  7.00k|  (*cparams)->splitmode = schunk->splitmode;
   86|  7.00k|  (*cparams)->use_dict = schunk->use_dict;
   87|  7.00k|  if (schunk->cctx == NULL) {
  ------------------
  |  Branch (87:7): [True: 7.00k, False: 0]
  ------------------
   88|  7.00k|    (*cparams)->nthreads = blosc2_get_nthreads();
   89|  7.00k|  }
   90|      0|  else {
   91|      0|    (*cparams)->nthreads = (int16_t)schunk->cctx->nthreads;
   92|      0|  }
   93|  7.00k|  return 0;
   94|  7.00k|}
blosc2_schunk_get_dparams:
   98|  7.00k|int blosc2_schunk_get_dparams(blosc2_schunk *schunk, blosc2_dparams **dparams) {
   99|  7.00k|  *dparams = calloc(1, sizeof(blosc2_dparams));
  100|  7.00k|  (*dparams)->schunk = schunk;
  101|  7.00k|  if (schunk->dctx == NULL) {
  ------------------
  |  Branch (101:7): [True: 7.00k, False: 0]
  ------------------
  102|  7.00k|    (*dparams)->nthreads = blosc2_get_nthreads();
  103|  7.00k|  }
  104|      0|  else {
  105|      0|    (*dparams)->nthreads = schunk->dctx->nthreads;
  106|      0|  }
  107|  7.00k|  return 0;
  108|  7.00k|}
schunk_free_metalayers:
  790|  7.02k|void schunk_free_metalayers(blosc2_schunk *schunk) {
  791|  7.10k|  for (int i = 0; i < schunk->nmetalayers; i++) {
  ------------------
  |  Branch (791:19): [True: 84, False: 7.02k]
  ------------------
  792|     84|    if (schunk->metalayers[i] != NULL) {
  ------------------
  |  Branch (792:9): [True: 29, False: 55]
  ------------------
  793|     29|      free(schunk->metalayers[i]->name);
  794|     29|      free(schunk->metalayers[i]->content);
  795|     29|      free(schunk->metalayers[i]);
  796|       |      schunk->metalayers[i] = NULL;
  797|     29|    }
  798|     84|  }
  799|  7.02k|  schunk->nmetalayers = 0;
  800|  7.02k|}
schunk_free_vlmetalayers:
  803|  7.02k|void schunk_free_vlmetalayers(blosc2_schunk *schunk) {
  804|  29.5k|  for (int i = 0; i < schunk->nvlmetalayers; i++) {
  ------------------
  |  Branch (804:19): [True: 22.5k, False: 7.02k]
  ------------------
  805|  22.5k|    if (schunk->vlmetalayers[i] != NULL) {
  ------------------
  |  Branch (805:9): [True: 603, False: 21.8k]
  ------------------
  806|    603|      free(schunk->vlmetalayers[i]->name);
  807|    603|      free(schunk->vlmetalayers[i]->content);
  808|    603|      free(schunk->vlmetalayers[i]);
  809|       |      schunk->vlmetalayers[i] = NULL;
  810|    603|    }
  811|  22.5k|  }
  812|  7.02k|  schunk->nvlmetalayers = 0;
  813|  7.02k|}
blosc2_schunk_free:
  816|  7.02k|int blosc2_schunk_free(blosc2_schunk *schunk) {
  817|  7.02k|  int err = 0;
  818|       |
  819|       |  // If it is a view, the data belongs to original array and should not be freed
  820|  7.02k|  if (schunk->data != NULL && !schunk->view) {
  ------------------
  |  Branch (820:7): [True: 0, False: 7.02k]
  |  Branch (820:31): [True: 0, False: 0]
  ------------------
  821|      0|    for (int i = 0; i < schunk->nchunks; i++) {
  ------------------
  |  Branch (821:21): [True: 0, False: 0]
  ------------------
  822|      0|      free(schunk->data[i]);
  823|      0|    }
  824|      0|    free(schunk->data);
  825|      0|  }
  826|  7.02k|  if (schunk->cctx != NULL)
  ------------------
  |  Branch (826:7): [True: 7.00k, False: 20]
  ------------------
  827|  7.00k|    blosc2_free_ctx(schunk->cctx);
  828|  7.02k|  if (schunk->dctx != NULL)
  ------------------
  |  Branch (828:7): [True: 7.00k, False: 20]
  ------------------
  829|  7.00k|    blosc2_free_ctx(schunk->dctx);
  830|  7.02k|  if (schunk->blockshape != NULL)
  ------------------
  |  Branch (830:7): [True: 0, False: 7.02k]
  ------------------
  831|      0|    free(schunk->blockshape);
  832|       |
  833|  7.02k|  schunk_free_metalayers(schunk);
  834|       |
  835|  7.02k|  if (schunk->storage != NULL) {
  ------------------
  |  Branch (835:7): [True: 7.00k, False: 20]
  ------------------
  836|  7.00k|    blosc2_io_cb *io_cb = blosc2_get_io_cb(schunk->storage->io->id);
  837|  7.00k|    if (io_cb != NULL) {
  ------------------
  |  Branch (837:9): [True: 7.00k, False: 0]
  ------------------
  838|  7.00k|      int rc = io_cb->destroy(schunk->storage->io->params);
  839|  7.00k|      if (rc < 0) {
  ------------------
  |  Branch (839:11): [True: 0, False: 7.00k]
  ------------------
  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|  7.00k|    }
  844|       |
  845|  7.00k|    if (schunk->storage->urlpath != NULL) {
  ------------------
  |  Branch (845:9): [True: 0, False: 7.00k]
  ------------------
  846|      0|      free(schunk->storage->urlpath);
  847|      0|    }
  848|  7.00k|    free(schunk->storage->cparams);
  849|  7.00k|    free(schunk->storage->dparams);
  850|  7.00k|    free(schunk->storage->io);
  851|  7.00k|    free(schunk->storage);
  852|  7.00k|  }
  853|       |
  854|       |  // If it is a view, the frame belongs to original array and should not be freed
  855|  7.02k|  if (schunk->frame != NULL && !schunk->view) {
  ------------------
  |  Branch (855:7): [True: 7.02k, False: 0]
  |  Branch (855:32): [True: 7.02k, False: 0]
  ------------------
  856|  7.02k|    int rc = frame_free((blosc2_frame_s *) schunk->frame);
  857|  7.02k|    if (rc < 0 && err == 0) {
  ------------------
  |  Branch (857:9): [True: 0, False: 7.02k]
  |  Branch (857:19): [True: 0, False: 0]
  ------------------
  858|      0|      err = rc;
  859|      0|    }
  860|  7.02k|  }
  861|       |
  862|  7.02k|  schunk_free_vlmetalayers(schunk);
  863|       |
  864|  7.02k|  free(schunk);
  865|       |
  866|  7.02k|  return err;
  867|  7.02k|}
blosc2_schunk_from_buffer:
  880|  7.08k|blosc2_schunk* blosc2_schunk_from_buffer(uint8_t *cframe, int64_t len, bool copy) {
  881|       |  // Check that the buffer actually comes from a cframe
  882|  7.08k|  if (cframe == NULL || len < FRAME_HEADER_MINLEN) {
  ------------------
  |  |   49|  7.08k|#define FRAME_HEADER_MINLEN (FRAME_FILTER_PIPELINE + 1 + 16)  // 87 <- minimum length
  |  |  ------------------
  |  |  |  |   44|  7.08k|#define FRAME_FILTER_PIPELINE (FRAME_HAS_VLMETALAYERS + 1 + 1) // 70
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  7.08k|#define FRAME_HAS_VLMETALAYERS (FRAME_NTHREADS_D + 2)  // 68
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   42|  7.08k|#define FRAME_NTHREADS_D (FRAME_NTHREADS_C + 2 + 1)  // 66
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   41|  7.08k|#define FRAME_NTHREADS_C (FRAME_CHUNKSIZE + 4 + 1)  // 63
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |   40|  7.08k|#define FRAME_CHUNKSIZE (FRAME_BLOCKSIZE + 4 + 1)  // 58
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |   39|  7.08k|#define FRAME_BLOCKSIZE (FRAME_TYPESIZE + 4 + 1)  // 53
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   38|  7.08k|#define FRAME_TYPESIZE (FRAME_CBYTES + 8 + 1) // 48
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   37|  7.08k|#define FRAME_CBYTES (FRAME_NBYTES + 8 + 1)  // 39
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   36|  7.08k|#define FRAME_NBYTES (FRAME_FLAGS + 4 + 1)  // 30
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   32|  7.08k|#define FRAME_FLAGS (FRAME_LEN + 8 + 1)  // 25
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   31|  7.08k|#define FRAME_LEN (FRAME_HEADER_LEN + 4 + 1)  // 16
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   30|  7.08k|#define FRAME_HEADER_LEN (FRAME_HEADER_MAGIC + 8 + 1)  // 11
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |   29|  7.08k|#define FRAME_HEADER_MAGIC 2
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (882:7): [True: 0, False: 7.08k]
  |  Branch (882:25): [True: 0, False: 7.08k]
  ------------------
  883|      0|    return NULL;
  884|      0|  }
  885|  7.08k|  char *magic_number = (char *)cframe + FRAME_HEADER_MAGIC;
  ------------------
  |  |   29|  7.08k|#define FRAME_HEADER_MAGIC 2
  ------------------
  886|  7.08k|  if (memcmp(magic_number, "b2frame", sizeof("b2frame")) != 0) {
  ------------------
  |  Branch (886:7): [True: 53, False: 7.03k]
  ------------------
  887|     53|    return NULL;
  888|     53|  }
  889|  7.03k|  blosc2_frame_s* frame = frame_from_cframe(cframe, len, false);
  890|  7.03k|  if (frame == NULL) {
  ------------------
  |  Branch (890:7): [True: 10, False: 7.02k]
  ------------------
  891|     10|    return NULL;
  892|     10|  }
  893|  7.02k|  blosc2_schunk* schunk = frame_to_schunk(frame, copy, &BLOSC2_IO_DEFAULTS);
  894|  7.02k|  if (schunk && copy) {
  ------------------
  |  Branch (894:7): [True: 872, False: 6.14k]
  |  Branch (894:17): [True: 0, False: 872]
  ------------------
  895|       |    // Super-chunk has its own copy of frame
  896|      0|    frame_free(frame);
  897|      0|  }
  898|  7.02k|  return schunk;
  899|  7.03k|}
blosc2_schunk_decompress_chunk:
 1747|  76.4k|                                   void *dest, int32_t nbytes) {
 1748|  76.4k|  int rc = validate_nchunk(schunk, nchunk, false, "blosc2_schunk_decompress_chunk");
 1749|  76.4k|  if (rc < 0) {
  ------------------
  |  Branch (1749:7): [True: 0, False: 76.4k]
  ------------------
 1750|      0|    return rc;
 1751|      0|  }
 1752|       |
 1753|  76.4k|  int32_t chunk_nbytes;
 1754|  76.4k|  int32_t chunk_cbytes;
 1755|  76.4k|  int chunksize;
 1756|  76.4k|  blosc2_frame_s* frame = (blosc2_frame_s*)schunk->frame;
 1757|       |
 1758|  76.4k|  schunk->current_nchunk = nchunk;
 1759|  76.4k|  if (frame == NULL) {
  ------------------
  |  Branch (1759:7): [True: 0, False: 76.4k]
  ------------------
 1760|      0|    uint8_t* src = schunk->data[nchunk];
 1761|      0|    if (src == 0) {
  ------------------
  |  Branch (1761:9): [True: 0, False: 0]
  ------------------
 1762|      0|      return 0;
 1763|      0|    }
 1764|       |
 1765|      0|    rc = blosc2_cbuffer_sizes(src, &chunk_nbytes, &chunk_cbytes, NULL);
 1766|      0|    if (rc < 0) {
  ------------------
  |  Branch (1766:9): [True: 0, False: 0]
  ------------------
 1767|      0|      return rc;
 1768|      0|    }
 1769|       |
 1770|      0|    if (nbytes < chunk_nbytes) {
  ------------------
  |  Branch (1770:9): [True: 0, False: 0]
  ------------------
 1771|      0|      BLOSC_TRACE_ERROR("Buffer size is too small for the decompressed buffer "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1772|      0|                        "('%d' bytes, but '%d' are needed).", nbytes, chunk_nbytes);
 1773|      0|      return BLOSC2_ERROR_INVALID_PARAM;
 1774|      0|    }
 1775|       |
 1776|      0|    chunksize = blosc2_decompress_ctx(schunk->dctx, src, chunk_cbytes, dest, nbytes);
 1777|      0|    if (chunksize < 0 || chunksize != chunk_nbytes) {
  ------------------
  |  Branch (1777:9): [True: 0, False: 0]
  |  Branch (1777:26): [True: 0, False: 0]
  ------------------
 1778|      0|      BLOSC_TRACE_ERROR("Error in decompressing chunk.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1779|      0|      if (chunksize < 0)
  ------------------
  |  Branch (1779:11): [True: 0, False: 0]
  ------------------
 1780|      0|        return chunksize;
 1781|      0|      return BLOSC2_ERROR_FAILURE;
 1782|      0|    }
 1783|  76.4k|  } else {
 1784|  76.4k|    rc = frame_lock(frame, false);
 1785|  76.4k|    if (rc < 0) {
  ------------------
  |  Branch (1785:9): [True: 0, False: 76.4k]
  ------------------
 1786|      0|      return rc;
 1787|      0|    }
 1788|  76.4k|    chunksize = frame_decompress_chunk(schunk->dctx, frame, nchunk, dest, nbytes);
 1789|  76.4k|    frame_unlock(frame);
 1790|  76.4k|    if (chunksize < 0) {
  ------------------
  |  Branch (1790:9): [True: 722, False: 75.7k]
  ------------------
 1791|    722|      return chunksize;
 1792|    722|    }
 1793|  76.4k|  }
 1794|  75.7k|  return chunksize;
 1795|  76.4k|}
schunk.c:validate_nchunk:
   47|  76.4k|static int validate_nchunk(blosc2_schunk *schunk, int64_t nchunk, bool allow_end, const char *func_name) {
   48|  76.4k|  if (nchunk < 0) {
  ------------------
  |  Branch (48:7): [True: 0, False: 76.4k]
  ------------------
   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|  76.4k|  if (allow_end) {
  ------------------
  |  Branch (53:7): [True: 0, False: 76.4k]
  ------------------
   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|  76.4k|  else {
   61|  76.4k|    if (nchunk >= schunk->nchunks) {
  ------------------
  |  Branch (61:9): [True: 0, False: 76.4k]
  ------------------
   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|  76.4k|  }
   67|       |
   68|  76.4k|  return BLOSC2_ERROR_SUCCESS;
   69|  76.4k|}

unshuffle_avx2:
  777|   213k|               const uint8_t *_src, uint8_t *_dest) {
  778|   213k|  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|   213k|  if (blocksize < vectorized_chunk_size) {
  ------------------
  |  Branch (782:7): [True: 71.9k, False: 141k]
  ------------------
  783|  71.9k|    unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  784|  71.9k|    return;
  785|  71.9k|  }
  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|   141k|  const int32_t vectorizable_bytes = blocksize - (blocksize % vectorized_chunk_size);
  793|       |
  794|   141k|  const int32_t vectorizable_elements = vectorizable_bytes / bytesoftype;
  795|   141k|  const int32_t total_elements = blocksize / bytesoftype;
  796|       |
  797|       |  /* Optimized unshuffle implementations */
  798|   141k|  switch (bytesoftype) {
  799|  4.46k|    case 2:
  ------------------
  |  Branch (799:5): [True: 4.46k, False: 137k]
  ------------------
  800|  4.46k|      unshuffle2_avx2(_dest, _src, vectorizable_elements, total_elements);
  801|  4.46k|      break;
  802|  1.85k|    case 4:
  ------------------
  |  Branch (802:5): [True: 1.85k, False: 139k]
  ------------------
  803|  1.85k|      unshuffle4_avx2(_dest, _src, vectorizable_elements, total_elements);
  804|  1.85k|      break;
  805|  39.1k|    case 8:
  ------------------
  |  Branch (805:5): [True: 39.1k, False: 102k]
  ------------------
  806|  39.1k|      unshuffle8_avx2(_dest, _src, vectorizable_elements, total_elements);
  807|  39.1k|      break;
  808|  4.05k|    case 12:
  ------------------
  |  Branch (808:5): [True: 4.05k, False: 137k]
  ------------------
  809|  4.05k|      unshuffle12_avx2(_dest, _src, vectorizable_elements, total_elements);
  810|  4.05k|      break;
  811|  1.05k|    case 16:
  ------------------
  |  Branch (811:5): [True: 1.05k, False: 140k]
  ------------------
  812|  1.05k|      unshuffle16_avx2(_dest, _src, vectorizable_elements, total_elements);
  813|  1.05k|      break;
  814|  91.0k|    default:
  ------------------
  |  Branch (814:5): [True: 91.0k, False: 50.5k]
  ------------------
  815|       |      /* For types larger than 16 bytes, use the AVX2 tiled unshuffle. */
  816|  91.0k|      if (bytesoftype > (int32_t)sizeof(__m128i)) {
  ------------------
  |  Branch (816:11): [True: 66.4k, False: 24.5k]
  ------------------
  817|  66.4k|        unshuffle16_tiled_avx2(_dest, _src, vectorizable_elements, total_elements, bytesoftype);
  818|  66.4k|      }
  819|  24.5k|      else {
  820|       |        /* Non-optimized unshuffle */
  821|  24.5k|        unshuffle_generic(bytesoftype, blocksize, _src, _dest);
  822|       |        /* The non-optimized function covers the whole buffer,
  823|       |           so we're done processing here. */
  824|  24.5k|        return;
  825|  24.5k|      }
  826|   141k|  }
  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|   116k|  if (vectorizable_bytes < blocksize) {
  ------------------
  |  Branch (831:7): [True: 103k, False: 13.3k]
  ------------------
  832|   103k|    unshuffle_generic_inline(bytesoftype, vectorizable_bytes, blocksize, _src, _dest);
  833|   103k|  }
  834|   116k|}
shuffle-avx2.c:unshuffle2_avx2:
  331|  4.46k|                const int32_t vectorizable_elements, const int32_t total_elements) {
  332|  4.46k|  static const int32_t bytesoftype = 2;
  333|  4.46k|  int32_t i;
  334|  4.46k|  int j;
  335|  4.46k|  __m256i ymm0[2], ymm1[2];
  336|       |
  337|  90.2k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (337:15): [True: 85.7k, False: 4.46k]
  ------------------
  338|       |    /* Load 32 elements (64 bytes) into 2 YMM registers. */
  339|  85.7k|    const uint8_t* const src_for_ith_element = src + i;
  340|   257k|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (340:17): [True: 171k, False: 85.7k]
  ------------------
  341|   171k|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  342|   171k|    }
  343|       |    /* Shuffle bytes */
  344|   257k|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (344:17): [True: 171k, False: 85.7k]
  ------------------
  345|   171k|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  346|   171k|    }
  347|       |    /* Compute the low 64 bytes */
  348|  85.7k|    ymm1[0] = _mm256_unpacklo_epi8(ymm0[0], ymm0[1]);
  349|       |    /* Compute the hi 64 bytes */
  350|  85.7k|    ymm1[1] = _mm256_unpackhi_epi8(ymm0[0], ymm0[1]);
  351|       |    /* Store the result vectors in proper order */
  352|  85.7k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  353|  85.7k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[1]);
  354|  85.7k|  }
  355|  4.46k|}
shuffle-avx2.c:unshuffle4_avx2:
  360|  1.85k|                const int32_t vectorizable_elements, const int32_t total_elements) {
  361|  1.85k|  static const int32_t bytesoftype = 4;
  362|  1.85k|  int32_t i;
  363|  1.85k|  int j;
  364|  1.85k|  __m256i ymm0[4], ymm1[4];
  365|       |
  366|   541k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (366:15): [True: 539k, False: 1.85k]
  ------------------
  367|       |    /* Load 32 elements (128 bytes) into 4 YMM registers. */
  368|   539k|    const uint8_t* const src_for_ith_element = src + i;
  369|  2.69M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (369:17): [True: 2.15M, False: 539k]
  ------------------
  370|  2.15M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  371|  2.15M|    }
  372|       |    /* Shuffle bytes */
  373|  1.61M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (373:17): [True: 1.07M, False: 539k]
  ------------------
  374|       |      /* Compute the low 64 bytes */
  375|  1.07M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  376|       |      /* Compute the hi 64 bytes */
  377|  1.07M|      ymm1[2 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  378|  1.07M|    }
  379|       |    /* Shuffle 2-byte words */
  380|  1.61M|    for (j = 0; j < 2; j++) {
  ------------------
  |  Branch (380:17): [True: 1.07M, False: 539k]
  ------------------
  381|       |      /* Compute the low 64 bytes */
  382|  1.07M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  383|       |      /* Compute the hi 64 bytes */
  384|  1.07M|      ymm0[2 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  385|  1.07M|    }
  386|   539k|    ymm1[0] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x20);
  387|   539k|    ymm1[1] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x20);
  388|   539k|    ymm1[2] = _mm256_permute2x128_si256(ymm0[0], ymm0[2], 0x31);
  389|   539k|    ymm1[3] = _mm256_permute2x128_si256(ymm0[1], ymm0[3], 0x31);
  390|       |
  391|       |    /* Store the result vectors in proper order */
  392|  2.69M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (392:17): [True: 2.15M, False: 539k]
  ------------------
  393|  2.15M|      _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (j * sizeof(__m256i))), ymm1[j]);
  394|  2.15M|    }
  395|   539k|  }
  396|  1.85k|}
shuffle-avx2.c:unshuffle8_avx2:
  401|  39.1k|                const int32_t vectorizable_elements, const int32_t total_elements) {
  402|  39.1k|  static const int32_t bytesoftype = 8;
  403|  39.1k|  int32_t i;
  404|  39.1k|  int j;
  405|  39.1k|  __m256i ymm0[8], ymm1[8];
  406|       |
  407|  11.6M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (407:15): [True: 11.5M, False: 39.1k]
  ------------------
  408|       |    /* Fetch 32 elements (256 bytes) into 8 YMM registers. */
  409|  11.5M|    const uint8_t* const src_for_ith_element = src + i;
  410|   104M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (410:17): [True: 92.7M, False: 11.5M]
  ------------------
  411|  92.7M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  412|  92.7M|    }
  413|       |    /* Shuffle bytes */
  414|  57.9M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (414:17): [True: 46.3M, False: 11.5M]
  ------------------
  415|       |      /* Compute the low 32 bytes */
  416|  46.3M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  417|       |      /* Compute the hi 32 bytes */
  418|  46.3M|      ymm1[4 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  419|  46.3M|    }
  420|       |    /* Shuffle words */
  421|  57.9M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (421:17): [True: 46.3M, False: 11.5M]
  ------------------
  422|       |      /* Compute the low 32 bytes */
  423|  46.3M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  424|       |      /* Compute the hi 32 bytes */
  425|  46.3M|      ymm0[4 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  426|  46.3M|    }
  427|   104M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (427:17): [True: 92.7M, False: 11.5M]
  ------------------
  428|  92.7M|      ymm0[j] = _mm256_permute4x64_epi64(ymm0[j], 0xd8);
  429|  92.7M|    }
  430|       |
  431|       |    /* Shuffle 4-byte dwords */
  432|  57.9M|    for (j = 0; j < 4; j++) {
  ------------------
  |  Branch (432:17): [True: 46.3M, False: 11.5M]
  ------------------
  433|       |      /* Compute the low 32 bytes */
  434|  46.3M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  435|       |      /* Compute the hi 32 bytes */
  436|  46.3M|      ymm1[4 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  437|  46.3M|    }
  438|       |
  439|       |    /* Store the result vectors in proper order */
  440|  11.5M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  441|  11.5M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[2]);
  442|  11.5M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[1]);
  443|  11.5M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[3]);
  444|  11.5M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[4]);
  445|  11.5M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[6]);
  446|  11.5M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[5]);
  447|  11.5M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  448|  11.5M|  }
  449|  39.1k|}
shuffle-avx2.c:unshuffle12_avx2:
  526|  4.05k|    const int32_t vectorizable_elements, const int32_t total_elements) {
  527|  4.05k|  static const int32_t bytesoftype = 12;
  528|  4.05k|  int32_t i;
  529|  4.05k|  int j;
  530|  4.05k|  __m256i ymm0[16], ymm1[16];
  531|       |
  532|  4.05k|  __m256i permute = _mm256_set_epi32(0,0,6,5,4,2,1,0);
  533|  4.05k|  __m256i store_mask = _mm256_set_epi32(0x0, 0x0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
  534|  4.05k|  int32_t jump = 2*bytesoftype;
  535|  16.6k|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (535:15): [True: 12.5k, False: 4.05k]
  ------------------
  536|       |    /* Fetch 24 elements (384 bytes) into 12 YMM registers. */
  537|  12.5k|    const uint8_t* const src_for_ith_element = src + i;
  538|   163k|    for (j = 0; j < bytesoftype; j++) {
  ------------------
  |  Branch (538:17): [True: 150k, False: 12.5k]
  ------------------
  539|   150k|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  540|   150k|    }
  541|       |    /* Initialize the last 4 registers (128 bytes) to null */
  542|  62.8k|    for (j = bytesoftype; j < 16; j++) {
  ------------------
  |  Branch (542:27): [True: 50.2k, False: 12.5k]
  ------------------
  543|  50.2k|      ymm0[j] = _mm256_setzero_si256();
  544|  50.2k|    }
  545|       |
  546|       |    /* Shuffle bytes */
  547|   113k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (547:17): [True: 100k, False: 12.5k]
  ------------------
  548|       |      /* Compute the low 32 bytes */
  549|   100k|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  550|       |      /* Compute the hi 32 bytes */
  551|   100k|      ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  552|   100k|    }
  553|       |    /* Shuffle 2-byte words */
  554|   113k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (554:17): [True: 100k, False: 12.5k]
  ------------------
  555|       |      /* Compute the low 32 bytes */
  556|   100k|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  557|       |      /* Compute the hi 32 bytes */
  558|   100k|      ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  559|   100k|    }
  560|       |    /* Shuffle 4-byte dwords */
  561|   113k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (561:17): [True: 100k, False: 12.5k]
  ------------------
  562|       |      /* Compute the low 32 bytes */
  563|   100k|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  564|       |      /* Compute the hi 32 bytes */
  565|   100k|      ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  566|   100k|    }
  567|       |
  568|       |    /* Shuffle 8-byte qwords */
  569|   113k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (569:17): [True: 100k, False: 12.5k]
  ------------------
  570|       |      /* Compute the low 32 bytes */
  571|   100k|      ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  572|       |      /* Compute the hi 32 bytes */
  573|   100k|      ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  574|   100k|    }
  575|       |
  576|       |
  577|   113k|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (577:17): [True: 100k, False: 12.5k]
  ------------------
  578|   100k|      ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  579|   100k|      ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  580|   100k|      ymm1[j] = _mm256_permutevar8x32_epi32(ymm1[j], permute);
  581|   100k|      ymm1[j+8] = _mm256_permutevar8x32_epi32(ymm1[j+8], permute);
  582|       |
  583|       |
  584|   100k|    }
  585|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * jump)), ymm1[0]);
  586|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * jump)), ymm1[4]);
  587|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * jump)), ymm1[2]);
  588|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * jump)), ymm1[6]);
  589|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * jump)), ymm1[1]);
  590|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * jump)), ymm1[5]);
  591|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * jump)), ymm1[3]);
  592|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * jump)), ymm1[7]);
  593|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (8 * jump)), ymm1[8]);
  594|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (9 * jump)), ymm1[12]);
  595|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (10 * jump)), ymm1[10]);
  596|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (11 * jump)), ymm1[14]);
  597|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (12 * jump)), ymm1[9]);
  598|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (13 * jump)), ymm1[13]);
  599|  12.5k|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (14 * jump)), ymm1[11]);
  600|  12.5k|    _mm256_maskstore_epi32((int *)(dest + (i * bytesoftype) + (15 * jump)), store_mask, ymm1[15]);
  601|  12.5k|  }
  602|  4.05k|}
shuffle-avx2.c:unshuffle16_avx2:
  454|  1.05k|                 const int32_t vectorizable_elements, const int32_t total_elements) {
  455|  1.05k|  static const int32_t bytesoftype = 16;
  456|  1.05k|  int32_t i;
  457|  1.05k|  int j;
  458|  1.05k|  __m256i ymm0[16], ymm1[16];
  459|       |
  460|  2.11M|  for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (460:15): [True: 2.11M, False: 1.05k]
  ------------------
  461|       |    /* Fetch 32 elements (512 bytes) into 16 YMM registers. */
  462|  2.11M|    const uint8_t* const src_for_ith_element = src + i;
  463|  35.9M|    for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (463:17): [True: 33.8M, False: 2.11M]
  ------------------
  464|  33.8M|      ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (j * total_elements)));
  465|  33.8M|    }
  466|       |
  467|       |    /* Shuffle bytes */
  468|  19.0M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (468:17): [True: 16.9M, False: 2.11M]
  ------------------
  469|       |      /* Compute the low 32 bytes */
  470|  16.9M|      ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  471|       |      /* Compute the hi 32 bytes */
  472|  16.9M|      ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  473|  16.9M|    }
  474|       |    /* Shuffle 2-byte words */
  475|  19.0M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (475:17): [True: 16.9M, False: 2.11M]
  ------------------
  476|       |      /* Compute the low 32 bytes */
  477|  16.9M|      ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  478|       |      /* Compute the hi 32 bytes */
  479|  16.9M|      ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  480|  16.9M|    }
  481|       |    /* Shuffle 4-byte dwords */
  482|  19.0M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (482:17): [True: 16.9M, False: 2.11M]
  ------------------
  483|       |      /* Compute the low 32 bytes */
  484|  16.9M|      ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  485|       |      /* Compute the hi 32 bytes */
  486|  16.9M|      ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  487|  16.9M|    }
  488|       |
  489|       |    /* Shuffle 8-byte qwords */
  490|  19.0M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (490:17): [True: 16.9M, False: 2.11M]
  ------------------
  491|       |      /* Compute the low 32 bytes */
  492|  16.9M|      ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  493|       |      /* Compute the hi 32 bytes */
  494|  16.9M|      ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  495|  16.9M|    }
  496|       |
  497|  19.0M|    for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (497:17): [True: 16.9M, False: 2.11M]
  ------------------
  498|  16.9M|      ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  499|  16.9M|      ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  500|  16.9M|    }
  501|       |
  502|       |    /* Store the result vectors in proper order */
  503|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (0 * sizeof(__m256i))), ymm1[0]);
  504|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (1 * sizeof(__m256i))), ymm1[4]);
  505|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (2 * sizeof(__m256i))), ymm1[2]);
  506|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (3 * sizeof(__m256i))), ymm1[6]);
  507|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (4 * sizeof(__m256i))), ymm1[1]);
  508|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (5 * sizeof(__m256i))), ymm1[5]);
  509|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (6 * sizeof(__m256i))), ymm1[3]);
  510|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (7 * sizeof(__m256i))), ymm1[7]);
  511|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (8 * sizeof(__m256i))), ymm1[8]);
  512|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (9 * sizeof(__m256i))), ymm1[12]);
  513|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (10 * sizeof(__m256i))), ymm1[10]);
  514|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (11 * sizeof(__m256i))), ymm1[14]);
  515|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (12 * sizeof(__m256i))), ymm1[9]);
  516|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (13 * sizeof(__m256i))), ymm1[13]);
  517|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (14 * sizeof(__m256i))), ymm1[11]);
  518|  2.11M|    _mm256_storeu_si256((__m256i*)(dest + (i * bytesoftype) + (15 * sizeof(__m256i))), ymm1[15]);
  519|  2.11M|  }
  520|  1.05k|}
shuffle-avx2.c:unshuffle16_tiled_avx2:
  606|  66.4k|                       const int32_t vectorizable_elements, const int32_t total_elements, const int32_t bytesoftype) {
  607|  66.4k|  int32_t i;
  608|  66.4k|  int j;
  609|  66.4k|  __m256i ymm0[16], ymm1[16];
  610|       |
  611|  66.4k|  const lldiv_t vecs_per_el = lldiv(bytesoftype, sizeof(__m128i));
  612|  66.4k|  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|  66.4k|  int32_t offset_into_type;
  617|   668k|  for (offset_into_type = 0; offset_into_type < bytesoftype;
  ------------------
  |  Branch (617:30): [True: 601k, False: 66.4k]
  ------------------
  618|   601k|       offset_into_type += (offset_into_type == 0 && vecs_rem > 0 ? vecs_rem : (int32_t)sizeof(__m128i))) {
  ------------------
  |  Branch (618:29): [True: 66.4k, False: 535k]
  |  Branch (618:54): [True: 61.1k, False: 5.27k]
  ------------------
  619|  41.4M|    for (i = 0; i < vectorizable_elements; i += sizeof(__m256i)) {
  ------------------
  |  Branch (619:17): [True: 40.8M, False: 601k]
  ------------------
  620|       |      /* Load the first 16 bytes of 32 adjacent elements (512 bytes) into 16 YMM registers */
  621|  40.8M|      const uint8_t* const src_for_ith_element = src + i;
  622|   695M|      for (j = 0; j < 16; j++) {
  ------------------
  |  Branch (622:19): [True: 654M, False: 40.8M]
  ------------------
  623|   654M|        ymm0[j] = _mm256_loadu_si256((__m256i*)(src_for_ith_element + (total_elements * (offset_into_type + j))));
  624|   654M|      }
  625|       |
  626|       |      /* Shuffle bytes */
  627|   368M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (627:19): [True: 327M, False: 40.8M]
  ------------------
  628|       |        /* Compute the low 32 bytes */
  629|   327M|        ymm1[j] = _mm256_unpacklo_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  630|       |        /* Compute the hi 32 bytes */
  631|   327M|        ymm1[8 + j] = _mm256_unpackhi_epi8(ymm0[j * 2], ymm0[j * 2 + 1]);
  632|   327M|      }
  633|       |      /* Shuffle 2-byte words */
  634|   368M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (634:19): [True: 327M, False: 40.8M]
  ------------------
  635|       |        /* Compute the low 32 bytes */
  636|   327M|        ymm0[j] = _mm256_unpacklo_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  637|       |        /* Compute the hi 32 bytes */
  638|   327M|        ymm0[8 + j] = _mm256_unpackhi_epi16(ymm1[j * 2], ymm1[j * 2 + 1]);
  639|   327M|      }
  640|       |      /* Shuffle 4-byte dwords */
  641|   368M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (641:19): [True: 327M, False: 40.8M]
  ------------------
  642|       |        /* Compute the low 32 bytes */
  643|   327M|        ymm1[j] = _mm256_unpacklo_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  644|       |        /* Compute the hi 32 bytes */
  645|   327M|        ymm1[8 + j] = _mm256_unpackhi_epi32(ymm0[j * 2], ymm0[j * 2 + 1]);
  646|   327M|      }
  647|       |
  648|       |      /* Shuffle 8-byte qwords */
  649|   368M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (649:19): [True: 327M, False: 40.8M]
  ------------------
  650|       |        /* Compute the low 32 bytes */
  651|   327M|        ymm0[j] = _mm256_unpacklo_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  652|       |        /* Compute the hi 32 bytes */
  653|   327M|        ymm0[8 + j] = _mm256_unpackhi_epi64(ymm1[j * 2], ymm1[j * 2 + 1]);
  654|   327M|      }
  655|       |
  656|   368M|      for (j = 0; j < 8; j++) {
  ------------------
  |  Branch (656:19): [True: 327M, False: 40.8M]
  ------------------
  657|   327M|        ymm1[j] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x20);
  658|   327M|        ymm1[j + 8] = _mm256_permute2x128_si256(ymm0[j], ymm0[j + 8], 0x31);
  659|   327M|      }
  660|       |
  661|       |      /* Store the result vectors in proper order */
  662|  40.8M|      const uint8_t* const dest_with_offset = dest + offset_into_type;
  663|  40.8M|      _mm256_storeu2_m128i(
  664|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x01) * bytesoftype),
  665|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x00) * bytesoftype), ymm1[0]);
  666|  40.8M|      _mm256_storeu2_m128i(
  667|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x03) * bytesoftype),
  668|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x02) * bytesoftype), ymm1[4]);
  669|  40.8M|      _mm256_storeu2_m128i(
  670|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x05) * bytesoftype),
  671|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x04) * bytesoftype), ymm1[2]);
  672|  40.8M|      _mm256_storeu2_m128i(
  673|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x07) * bytesoftype),
  674|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x06) * bytesoftype), ymm1[6]);
  675|  40.8M|      _mm256_storeu2_m128i(
  676|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x09) * bytesoftype),
  677|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x08) * bytesoftype), ymm1[1]);
  678|  40.8M|      _mm256_storeu2_m128i(
  679|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x0b) * bytesoftype),
  680|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x0a) * bytesoftype), ymm1[5]);
  681|  40.8M|      _mm256_storeu2_m128i(
  682|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x0d) * bytesoftype),
  683|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x0c) * bytesoftype), ymm1[3]);
  684|  40.8M|      _mm256_storeu2_m128i(
  685|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x0f) * bytesoftype),
  686|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x0e) * bytesoftype), ymm1[7]);
  687|  40.8M|      _mm256_storeu2_m128i(
  688|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x11) * bytesoftype),
  689|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x10) * bytesoftype), ymm1[8]);
  690|  40.8M|      _mm256_storeu2_m128i(
  691|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x13) * bytesoftype),
  692|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x12) * bytesoftype), ymm1[12]);
  693|  40.8M|      _mm256_storeu2_m128i(
  694|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x15) * bytesoftype),
  695|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x14) * bytesoftype), ymm1[10]);
  696|  40.8M|      _mm256_storeu2_m128i(
  697|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x17) * bytesoftype),
  698|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x16) * bytesoftype), ymm1[14]);
  699|  40.8M|      _mm256_storeu2_m128i(
  700|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x19) * bytesoftype),
  701|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x18) * bytesoftype), ymm1[9]);
  702|  40.8M|      _mm256_storeu2_m128i(
  703|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x1b) * bytesoftype),
  704|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x1a) * bytesoftype), ymm1[13]);
  705|  40.8M|      _mm256_storeu2_m128i(
  706|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x1d) * bytesoftype),
  707|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x1c) * bytesoftype), ymm1[11]);
  708|  40.8M|      _mm256_storeu2_m128i(
  709|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x1f) * bytesoftype),
  710|  40.8M|          (__m128i*)(dest_with_offset + (i + 0x1e) * bytesoftype), ymm1[15]);
  711|  40.8M|    }
  712|   601k|  }
  713|  66.4k|}

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

unshuffle_generic:
   22|  96.4k|                       const uint8_t *_src, uint8_t *_dest) {
   23|       |  /* Non-optimized unshuffle */
   24|  96.4k|  unshuffle_generic_inline(bytesoftype, 0, blocksize, _src, _dest);
   25|  96.4k|}

shuffle-generic.c:unshuffle_generic_inline:
   64|  96.4k|                                     const uint8_t *_src, uint8_t *_dest) {
   65|  96.4k|  int32_t i, j;
   66|       |
   67|       |  /* Calculate the number of elements in the block. */
   68|  96.4k|  const int32_t neblock_quot = blocksize / type_size;
   69|  96.4k|  const int32_t neblock_rem = blocksize % type_size;
   70|  96.4k|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   71|       |
   72|       |  /* Non-optimized unshuffle */
   73|  75.3M|  for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (73:35): [True: 75.2M, False: 96.4k]
  ------------------
   74|   584M|    for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (74:17): [True: 509M, False: 75.2M]
  ------------------
   75|   509M|      _dest[i * type_size + j] = _src[j * neblock_quot + i];
   76|   509M|    }
   77|  75.2M|  }
   78|       |
   79|       |  /* Copy any leftover bytes in the block without unshuffling them. */
   80|  96.4k|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   81|  96.4k|}
shuffle-avx2.c:unshuffle_generic_inline:
   64|   103k|                                     const uint8_t *_src, uint8_t *_dest) {
   65|   103k|  int32_t i, j;
   66|       |
   67|       |  /* Calculate the number of elements in the block. */
   68|   103k|  const int32_t neblock_quot = blocksize / type_size;
   69|   103k|  const int32_t neblock_rem = blocksize % type_size;
   70|   103k|  const int32_t vectorizable_elements = vectorizable_blocksize / type_size;
   71|       |
   72|       |  /* Non-optimized unshuffle */
   73|  2.00M|  for (i = vectorizable_elements; i < (int32_t)neblock_quot; i++) {
  ------------------
  |  Branch (73:35): [True: 1.90M, False: 103k]
  ------------------
   74|   172M|    for (j = 0; j < type_size; j++) {
  ------------------
  |  Branch (74:17): [True: 170M, False: 1.90M]
  ------------------
   75|   170M|      _dest[i * type_size + j] = _src[j * neblock_quot + i];
   76|   170M|    }
   77|  1.90M|  }
   78|       |
   79|       |  /* Copy any leftover bytes in the block without unshuffling them. */
   80|   103k|  memcpy(_dest + (blocksize - neblock_rem), _src + (blocksize - neblock_rem), neblock_rem);
   81|   103k|}

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

blosc_stune_next_blocksize:
   47|  31.1k|int blosc_stune_next_blocksize(blosc2_context *context) {
   48|  31.1k|  int32_t clevel = context->clevel;
   49|  31.1k|  int32_t typesize = context->typesize;
   50|  31.1k|  int32_t nbytes = context->sourcesize;
   51|  31.1k|  int32_t user_blocksize = context->blocksize;
   52|  31.1k|  int32_t blocksize = nbytes;
   53|       |
   54|       |  // Protection against very small buffers
   55|  31.1k|  if (nbytes < typesize) {
  ------------------
  |  Branch (55:7): [True: 0, False: 31.1k]
  ------------------
   56|      0|    context->blocksize = 1;
   57|      0|    return BLOSC2_ERROR_SUCCESS;
   58|      0|  }
   59|       |
   60|  31.1k|  int splitmode = split_block(context, typesize, blocksize);
   61|  31.1k|  if (user_blocksize) {
  ------------------
  |  Branch (61:7): [True: 4.85k, False: 26.3k]
  ------------------
   62|  4.85k|    blocksize = user_blocksize;
   63|  4.85k|    goto last;
   64|  4.85k|  }
   65|       |
   66|  26.3k|  if (nbytes >= L1) {
  ------------------
  |  |   19|  26.3k|#define L1 (32 * 1024)
  ------------------
  |  Branch (66:7): [True: 1.30k, False: 25.0k]
  ------------------
   67|  1.30k|    blocksize = L1;
  ------------------
  |  |   19|  1.30k|#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|  1.30k|    if (is_HCR(context)) {
  ------------------
  |  Branch (72:9): [True: 0, False: 1.30k]
  ------------------
   73|      0|      blocksize *= 2;
   74|      0|    }
   75|       |
   76|       |    // Choose a different blocksize depending on the compression level
   77|  1.30k|    switch (clevel) {
   78|      0|      case 0:
  ------------------
  |  Branch (78:7): [True: 0, False: 1.30k]
  ------------------
   79|       |        // Case of plain copy
   80|      0|        blocksize /= 4;
   81|      0|        break;
   82|      0|      case 1:
  ------------------
  |  Branch (82:7): [True: 0, False: 1.30k]
  ------------------
   83|      0|        blocksize /= 2;
   84|      0|        break;
   85|      0|      case 2:
  ------------------
  |  Branch (85:7): [True: 0, False: 1.30k]
  ------------------
   86|      0|        blocksize *= 1;
   87|      0|        break;
   88|      0|      case 3:
  ------------------
  |  Branch (88:7): [True: 0, False: 1.30k]
  ------------------
   89|      0|        blocksize *= 2;
   90|      0|        break;
   91|      0|      case 4:
  ------------------
  |  Branch (91:7): [True: 0, False: 1.30k]
  ------------------
   92|  1.30k|      case 5:
  ------------------
  |  Branch (92:7): [True: 1.30k, False: 0]
  ------------------
   93|  1.30k|        blocksize *= 4;
   94|  1.30k|        break;
   95|      0|      case 6:
  ------------------
  |  Branch (95:7): [True: 0, False: 1.30k]
  ------------------
   96|      0|      case 7:
  ------------------
  |  Branch (96:7): [True: 0, False: 1.30k]
  ------------------
   97|      0|      case 8:
  ------------------
  |  Branch (97:7): [True: 0, False: 1.30k]
  ------------------
   98|      0|        blocksize *= 8;
   99|      0|        break;
  100|      0|      case 9:
  ------------------
  |  Branch (100:7): [True: 0, False: 1.30k]
  ------------------
  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: 1.30k]
  ------------------
  108|      0|        break;
  109|  1.30k|    }
  110|  1.30k|  }
  111|       |
  112|       |  /* Now the blocksize for splittable codecs */
  113|  26.3k|  if (clevel > 0 && splitmode) {
  ------------------
  |  Branch (113:7): [True: 26.3k, False: 0]
  |  Branch (113:21): [True: 1.05k, False: 25.2k]
  ------------------
  114|       |    // For performance reasons, do not exceed 256 KB (it must fit in L2 cache)
  115|  1.05k|    switch (clevel) {
  116|      0|      case 1:
  ------------------
  |  Branch (116:7): [True: 0, False: 1.05k]
  ------------------
  117|      0|      case 2:
  ------------------
  |  Branch (117:7): [True: 0, False: 1.05k]
  ------------------
  118|      0|      case 3:
  ------------------
  |  Branch (118:7): [True: 0, False: 1.05k]
  ------------------
  119|      0|        blocksize = 32 * 1024;
  120|      0|        break;
  121|      0|      case 4:
  ------------------
  |  Branch (121:7): [True: 0, False: 1.05k]
  ------------------
  122|  1.05k|      case 5:
  ------------------
  |  Branch (122:7): [True: 1.05k, False: 0]
  ------------------
  123|  1.05k|      case 6:
  ------------------
  |  Branch (123:7): [True: 0, False: 1.05k]
  ------------------
  124|  1.05k|        blocksize = 64 * 1024;
  125|  1.05k|        break;
  126|      0|      case 7:
  ------------------
  |  Branch (126:7): [True: 0, False: 1.05k]
  ------------------
  127|      0|        blocksize = 128 * 1024;
  128|      0|        break;
  129|      0|      case 8:
  ------------------
  |  Branch (129:7): [True: 0, False: 1.05k]
  ------------------
  130|      0|        blocksize = 256 * 1024;
  131|      0|        break;
  132|      0|      case 9:
  ------------------
  |  Branch (132:7): [True: 0, False: 1.05k]
  ------------------
  133|      0|      default:
  ------------------
  |  Branch (133:7): [True: 0, False: 1.05k]
  ------------------
  134|      0|        blocksize = 512 * 1024;
  135|      0|        break;
  136|  1.05k|    }
  137|       |    // Multiply by typesize to get proper split sizes
  138|  1.05k|    blocksize *= typesize;
  139|       |    // But do not exceed 4 MB per thread (having this capacity in L3 is normal in modern CPUs)
  140|  1.05k|    if (blocksize > 4 * 1024 * 1024) {
  ------------------
  |  Branch (140:9): [True: 0, False: 1.05k]
  ------------------
  141|      0|      blocksize = 4 * 1024 * 1024;
  142|      0|    }
  143|  1.05k|    if (blocksize < 32 * 1024) {
  ------------------
  |  Branch (143:9): [True: 0, False: 1.05k]
  ------------------
  144|       |      /* Do not use a too small blocksize (< 32 KB) when typesize is small */
  145|      0|      blocksize = 32 * 1024;
  146|      0|    }
  147|  1.05k|  }
  148|       |
  149|  31.1k|  last:
  150|       |  /* Check that blocksize is not too large */
  151|  31.1k|  if (blocksize > nbytes) {
  ------------------
  |  Branch (151:7): [True: 2.90k, False: 28.2k]
  ------------------
  152|  2.90k|    blocksize = nbytes;
  153|  2.90k|  }
  154|       |
  155|       |  // blocksize *must absolutely* be a multiple of the typesize
  156|  31.1k|  if (blocksize > typesize) {
  ------------------
  |  Branch (156:7): [True: 30.4k, False: 717]
  ------------------
  157|  30.4k|    blocksize = blocksize / typesize * typesize;
  158|  30.4k|  }
  159|       |
  160|  31.1k|  context->blocksize = blocksize;
  161|  31.1k|  BLOSC_INFO("compcode: %d, clevel: %d, blocksize: %d, splitmode: %d, typesize: %d",
  ------------------
  |  |  121|  31.1k|    do {                                            \
  |  |  122|  31.1k|        const char *__e = getenv("BLOSC_INFO");     \
  |  |  123|  31.1k|        if (!__e) { break; }                        \
  |  |  ------------------
  |  |  |  Branch (123:13): [True: 31.1k, False: 0]
  |  |  ------------------
  |  |  124|  31.1k|        fprintf(stderr, "[INFO] - " msg "\n", ##__VA_ARGS__); \
  |  |  125|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  162|  31.1k|             context->compcode, context->clevel, blocksize, splitmode, typesize);
  163|       |
  164|  31.1k|  return BLOSC2_ERROR_SUCCESS;
  165|  26.3k|}
split_block:
  190|  31.1k|int split_block(blosc2_context *context, int32_t typesize, int32_t blocksize) {
  191|  31.1k|  if (context->blosc1_format &&
  ------------------
  |  Branch (191:7): [True: 0, False: 31.1k]
  ------------------
  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|  31.1k|  switch (context->splitmode) {
  197|      0|    case BLOSC_ALWAYS_SPLIT:
  ------------------
  |  Branch (197:5): [True: 0, False: 31.1k]
  ------------------
  198|      0|      return 1;
  199|      0|    case BLOSC_NEVER_SPLIT:
  ------------------
  |  Branch (199:5): [True: 0, False: 31.1k]
  ------------------
  200|      0|      return 0;
  201|  31.1k|    case BLOSC_FORWARD_COMPAT_SPLIT:
  ------------------
  |  Branch (201:5): [True: 31.1k, False: 0]
  ------------------
  202|  31.1k|    case BLOSC_AUTO_SPLIT:
  ------------------
  |  Branch (202:5): [True: 0, False: 31.1k]
  ------------------
  203|       |      // These cases will be handled later
  204|  31.1k|      break;
  205|      0|    default:
  ------------------
  |  Branch (205:5): [True: 0, False: 31.1k]
  ------------------
  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|  31.1k|  }
  208|       |
  209|  31.1k|  int compcode = context->compcode;
  210|  31.1k|  if (compcode == BLOSC_CODEC_OPENZL) {
  ------------------
  |  Branch (210:7): [True: 0, False: 31.1k]
  ------------------
  211|       |    // Never split blocks for OpenZL, as it has its own block mechanisms
  212|      0|    return 0;
  213|      0|  }
  214|  31.1k|  return (
  215|       |          // Fast codecs like blosclz, lz4 seems to prefer to split
  216|  31.1k|          ((compcode == BLOSC_BLOSCLZ) || (compcode == BLOSC_LZ4)
  ------------------
  |  Branch (216:12): [True: 31.1k, False: 0]
  |  Branch (216:43): [True: 0, False: 0]
  ------------------
  217|       |            // and low levels of zstd too
  218|      0|            || ((compcode == BLOSC_ZSTD) && (context->clevel <= 5))
  ------------------
  |  Branch (218:17): [True: 0, False: 0]
  |  Branch (218:45): [True: 0, False: 0]
  ------------------
  219|  31.1k|            ) &&
  220|       |          // ...but split seems to harm cratio too much when not using shuffle
  221|  31.1k|          (context->filter_flags & BLOSC_DOSHUFFLE) &&
  ------------------
  |  Branch (221:11): [True: 31.1k, False: 0]
  ------------------
  222|  31.1k|          (typesize <= MAX_STREAMS) &&
  ------------------
  |  |   24|  31.1k|#define MAX_STREAMS 16 /* Cannot be larger than 128 */
  ------------------
  |  Branch (222:11): [True: 29.6k, False: 1.46k]
  ------------------
  223|  29.6k|          (blocksize / typesize) >= BLOSC_MIN_BUFFERSIZE);
  ------------------
  |  Branch (223:11): [True: 4.68k, False: 25.0k]
  ------------------
  224|  31.1k|}
stune.c:is_HCR:
   21|  1.30k|static bool is_HCR(blosc2_context * context) {
   22|  1.30k|  switch (context->compcode) {
   23|  1.30k|    case BLOSC_BLOSCLZ :
  ------------------
  |  Branch (23:5): [True: 1.30k, False: 0]
  ------------------
   24|  1.30k|      return false;
   25|      0|    case BLOSC_LZ4 :
  ------------------
  |  Branch (25:5): [True: 0, False: 1.30k]
  ------------------
   26|       |      // return (context->filter_flags & BLOSC_DOBITSHUFFLE) ? true : false;
   27|       |      // Do not treat LZ4 differently than BloscLZ here
   28|      0|      return false;
   29|      0|    case BLOSC_LZ4HC :
  ------------------
  |  Branch (29:5): [True: 0, False: 1.30k]
  ------------------
   30|      0|    case BLOSC_ZLIB :
  ------------------
  |  Branch (30:5): [True: 0, False: 1.30k]
  ------------------
   31|      0|    case BLOSC_ZSTD :
  ------------------
  |  Branch (31:5): [True: 0, False: 1.30k]
  ------------------
   32|      0|      return true;
   33|      0|    default :
  ------------------
  |  Branch (33:5): [True: 0, False: 1.30k]
  ------------------
   34|       |      return false;
   35|  1.30k|  }
   36|  1.30k|}

blosc2.c:print_error:
  525|      9|static inline char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|      9|  return (char *) blosc2_error_string(rc);
  528|      9|}
ndcell.c:blosc2_meta_get:
 2774|      1|                                  int32_t *content_len) {
 2775|      1|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2775:7): [True: 0, False: 1]
  |  Branch (2775:25): [True: 0, False: 1]
  |  Branch (2775:41): [True: 0, False: 1]
  |  Branch (2775:60): [True: 0, False: 1]
  ------------------
 2776|      0|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2777|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2778|      0|  }
 2779|       |
 2780|      1|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2781|      1|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2781:7): [True: 1, False: 0]
  ------------------
 2782|      1|    BLOSC_TRACE_WARNING("Metalayer \"%s\" not found.", name);
  ------------------
  |  |   94|      1|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2783|      1|    return nmetalayer;
 2784|      1|  }
 2785|      0|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2786|      0|  if (len < 0) {
  ------------------
  |  Branch (2786:7): [True: 0, False: 0]
  ------------------
 2787|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content length %d.", name, len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2788|      0|    return BLOSC2_ERROR_DATA;
 2789|      0|  }
 2790|      0|  *content_len = len;
 2791|      0|  if (len == 0) {
  ------------------
  |  Branch (2791:7): [True: 0, False: 0]
  ------------------
 2792|      0|    *content = NULL;
 2793|      0|    return nmetalayer;
 2794|      0|  }
 2795|      0|  *content = (uint8_t*)malloc((size_t)len);
 2796|      0|  if (*content == NULL) {
  ------------------
  |  Branch (2796:7): [True: 0, False: 0]
  ------------------
 2797|      0|    BLOSC_TRACE_ERROR("Unable to allocate metalayer content buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2798|      0|    *content_len = 0;
 2799|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2800|      0|  }
 2801|      0|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2801:7): [True: 0, False: 0]
  |  Branch (2801:18): [True: 0, False: 0]
  ------------------
 2802|      0|    free(*content);
 2803|      0|    *content = NULL;
 2804|      0|    *content_len = 0;
 2805|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content pointer.", name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2806|      0|    return BLOSC2_ERROR_DATA;
 2807|      0|  }
 2808|      0|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2809|      0|  return nmetalayer;
 2810|      0|}
ndcell.c:blosc2_meta_exists:
 2705|      1|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2706|      1|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|      1|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2706:7): [True: 0, False: 1]
  ------------------
 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1896|      0|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2708|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2709|      0|  }
 2710|       |
 2711|      1|  if (schunk == NULL) {
  ------------------
  |  Branch (2711:7): [True: 0, False: 1]
  ------------------
 2712|      0|    BLOSC_TRACE_ERROR("Schunk must not be NUll.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2713|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2714|      0|  }
 2715|       |
 2716|      1|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2716:28): [True: 0, False: 1]
  ------------------
 2717|      0|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2717:9): [True: 0, False: 0]
  ------------------
 2718|      0|      return nmetalayer;
 2719|      0|    }
 2720|      0|  }
 2721|      1|  return BLOSC2_ERROR_NOT_FOUND;
 2722|      1|}
ndmean.c:blosc2_meta_get:
 2774|      1|                                  int32_t *content_len) {
 2775|      1|  if (schunk == NULL || name == NULL || content == NULL || content_len == NULL) {
  ------------------
  |  Branch (2775:7): [True: 0, False: 1]
  |  Branch (2775:25): [True: 0, False: 1]
  |  Branch (2775:41): [True: 0, False: 1]
  |  Branch (2775:60): [True: 0, False: 1]
  ------------------
 2776|      0|    BLOSC_TRACE_ERROR("Invalid parameters.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2777|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2778|      0|  }
 2779|       |
 2780|      1|  int nmetalayer = blosc2_meta_exists(schunk, name);
 2781|      1|  if (nmetalayer < 0) {
  ------------------
  |  Branch (2781:7): [True: 1, False: 0]
  ------------------
 2782|      1|    BLOSC_TRACE_WARNING("Metalayer \"%s\" not found.", name);
  ------------------
  |  |   94|      1|#define BLOSC_TRACE_WARNING(msg, ...) BLOSC_TRACE(warning, 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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2783|      1|    return nmetalayer;
 2784|      1|  }
 2785|      0|  int32_t len = schunk->metalayers[nmetalayer]->content_len;
 2786|      0|  if (len < 0) {
  ------------------
  |  Branch (2786:7): [True: 0, False: 0]
  ------------------
 2787|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content length %d.", name, len);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2788|      0|    return BLOSC2_ERROR_DATA;
 2789|      0|  }
 2790|      0|  *content_len = len;
 2791|      0|  if (len == 0) {
  ------------------
  |  Branch (2791:7): [True: 0, False: 0]
  ------------------
 2792|      0|    *content = NULL;
 2793|      0|    return nmetalayer;
 2794|      0|  }
 2795|      0|  *content = (uint8_t*)malloc((size_t)len);
 2796|      0|  if (*content == NULL) {
  ------------------
  |  Branch (2796:7): [True: 0, False: 0]
  ------------------
 2797|      0|    BLOSC_TRACE_ERROR("Unable to allocate metalayer content buffer.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2798|      0|    *content_len = 0;
 2799|      0|    return BLOSC2_ERROR_MEMORY_ALLOC;
 2800|      0|  }
 2801|      0|  if (len > 0 && schunk->metalayers[nmetalayer]->content == NULL) {
  ------------------
  |  Branch (2801:7): [True: 0, False: 0]
  |  Branch (2801:18): [True: 0, False: 0]
  ------------------
 2802|      0|    free(*content);
 2803|      0|    *content = NULL;
 2804|      0|    *content_len = 0;
 2805|      0|    BLOSC_TRACE_ERROR("Metalayer \"%s\" has corrupted content pointer.", name);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2806|      0|    return BLOSC2_ERROR_DATA;
 2807|      0|  }
 2808|      0|  memcpy(*content, schunk->metalayers[nmetalayer]->content, (size_t)len);
 2809|      0|  return nmetalayer;
 2810|      0|}
ndmean.c:blosc2_meta_exists:
 2705|      1|static inline int blosc2_meta_exists(blosc2_schunk *schunk, const char *name) {
 2706|      1|  if (strlen(name) > BLOSC2_METALAYER_NAME_MAXLEN) {
  ------------------
  |  | 1896|      1|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  ------------------
  |  Branch (2706:7): [True: 0, False: 1]
  ------------------
 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  | 2707|      0|    BLOSC_TRACE_ERROR("Metalayers cannot be larger than %d chars.", BLOSC2_METALAYER_NAME_MAXLEN);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  | 1896|      0|#define BLOSC2_METALAYER_NAME_MAXLEN 31
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2708|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2709|      0|  }
 2710|       |
 2711|      1|  if (schunk == NULL) {
  ------------------
  |  Branch (2711:7): [True: 0, False: 1]
  ------------------
 2712|      0|    BLOSC_TRACE_ERROR("Schunk must not be NUll.");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2713|      0|    return BLOSC2_ERROR_INVALID_PARAM;
 2714|      0|  }
 2715|       |
 2716|      1|  for (int nmetalayer = 0; nmetalayer < schunk->nmetalayers; nmetalayer++) {
  ------------------
  |  Branch (2716:28): [True: 0, False: 1]
  ------------------
 2717|      0|    if (strcmp(name, schunk->metalayers[nmetalayer]->name) == 0) {
  ------------------
  |  Branch (2717:9): [True: 0, False: 0]
  ------------------
 2718|      0|      return nmetalayer;
 2719|      0|    }
 2720|      0|  }
 2721|      1|  return BLOSC2_ERROR_NOT_FOUND;
 2722|      1|}
bytedelta.c:print_error:
  525|      3|static inline char *print_error(int rc) {
  526|       |  // TODO: remove this function, use blosc2_error_string only
  527|      3|  return (char *) blosc2_error_string(rc);
  528|      3|}

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

ndlz_decompress:
   42|    532|                    uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
   43|    532|  NDLZ_ERROR_NULL(input);
  ------------------
  |  |   19|    532|  do {                           \
  |  |   20|    532|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 532]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|    532|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 532]
  |  |  ------------------
  ------------------
   44|    532|  NDLZ_ERROR_NULL(output);
  ------------------
  |  |   19|    532|  do {                           \
  |  |   20|    532|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 532]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|    532|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 532]
  |  |  ------------------
  ------------------
   45|    532|  NDLZ_ERROR_NULL(dparams);
  ------------------
  |  |   19|    532|  do {                           \
  |  |   20|    532|    if ((pointer) == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (20:9): [True: 0, False: 532]
  |  |  ------------------
  |  |   21|      0|      return 0;                  \
  |  |   22|      0|    }                            \
  |  |   23|    532|  } while (0)
  |  |  ------------------
  |  |  |  Branch (23:12): [Folded, False: 532]
  |  |  ------------------
  ------------------
   46|    532|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|    532|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
   47|       |
   48|    532|  switch (meta) {
   49|    260|    case 4:
  ------------------
  |  Branch (49:5): [True: 260, False: 272]
  ------------------
   50|    260|      return ndlz4_decompress(input, input_len, output, output_len, meta, dparams);
   51|    269|    case 8:
  ------------------
  |  Branch (51:5): [True: 269, False: 263]
  ------------------
   52|    269|      return ndlz8_decompress(input, input_len, output, output_len, meta, dparams);
   53|      3|    default:
  ------------------
  |  Branch (53:5): [True: 3, False: 529]
  ------------------
   54|      3|      BLOSC_TRACE_ERROR("NDLZ is not available for this cellsize: %d", meta);
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   55|    532|  }
   56|      3|  return BLOSC2_ERROR_FAILURE;
   57|    532|}

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

ndlz8_decompress:
  444|    269|                     uint8_t meta, blosc2_dparams *dparams) {
  445|    269|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|    269|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  446|    269|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|    269|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  447|    269|  BLOSC_ERROR_NULL(input, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    269|    do {                                            \
  |  |  105|    269|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 269]
  |  |  ------------------
  |  |  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|    269|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 269]
  |  |  ------------------
  ------------------
  448|    269|  BLOSC_ERROR_NULL(output, BLOSC2_ERROR_NULL_POINTER);
  ------------------
  |  |  104|    269|    do {                                            \
  |  |  105|    269|        if ((pointer) == NULL) {                    \
  |  |  ------------------
  |  |  |  Branch (105:13): [True: 0, False: 269]
  |  |  ------------------
  |  |  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|    269|    } while (0)
  |  |  ------------------
  |  |  |  Branch (109:14): [Folded, False: 269]
  |  |  ------------------
  ------------------
  449|       |
  450|    269|  const int cell_shape = 8;
  451|    269|  const int cell_size = 64;
  452|    269|  uint8_t *ip = (uint8_t *) input;
  453|    269|  uint8_t *op = (uint8_t *) output;
  454|    269|  uint8_t ndim;
  455|    269|  int32_t blockshape[2];
  456|    269|  int32_t eshape[2];
  457|    269|  uint8_t *buffercpy;
  458|    269|  uint8_t token;
  459|       |  // The fixed header is 1 (ndim) + 2 * int32 (blockshape) = 9 bytes.  Reject any
  460|       |  // input too short to hold it -- the previous `< 8` check let an 8-byte input
  461|       |  // through and the header parse below then read a 9th byte.  The cast keeps the
  462|       |  // comparison signed so a negative `input_len` is rejected here, before the
  463|       |  // `ip + input_len` pointer arithmetic (which would otherwise be UB) is reached.
  464|    269|  if (NDLZ_UNEXPECT_CONDITIONAL(input_len < (int32_t) (1 + 2 * sizeof(int32_t)))) {
  ------------------
  |  |   30|    269|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 2, False: 267]
  |  |  ------------------
  ------------------
  465|      2|    return 0;
  466|      2|  }
  467|    267|  uint8_t *ip_limit = ip + input_len;
  468|       |
  469|       |  /* we start with literal copy */
  470|    267|  ndim = *ip;
  471|    267|  ip++;
  472|    267|  if (ndim != 2) {
  ------------------
  |  Branch (472:7): [True: 2, False: 265]
  ------------------
  473|      2|    BLOSC_TRACE_ERROR("This codec only works for ndim = 2");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  474|      2|    return BLOSC2_ERROR_FAILURE;
  475|      2|  }
  476|    265|  memcpy(&blockshape[0], ip, 4);
  477|    265|  ip += 4;
  478|    265|  memcpy(&blockshape[1], ip, 4);
  479|    265|  ip += 4;
  480|       |
  481|       |  // Sanity check.  See https://www.cve.org/CVERecord?id=CVE-2024-3203
  482|    265|  if (output_len < 0 || blockshape[0] < 0 || blockshape[1] < 0) {
  ------------------
  |  Branch (482:7): [True: 0, False: 265]
  |  Branch (482:25): [True: 17, False: 248]
  |  Branch (482:46): [True: 4, False: 244]
  ------------------
  483|     21|    BLOSC_TRACE_ERROR("Output length or blockshape is negative");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  484|     21|    return BLOSC2_ERROR_FAILURE;
  485|     21|  }
  486|       |
  487|    244|  eshape[0] = ((blockshape[0] + 7) / cell_shape) * cell_shape;
  488|    244|  eshape[1] = ((blockshape[1] + 7) / cell_shape) * cell_shape;
  489|       |
  490|    244|  if (NDLZ_UNEXPECT_CONDITIONAL((int64_t)output_len < (int64_t)blockshape[0] * (int64_t)blockshape[1])) {
  ------------------
  |  |   30|    244|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 59, False: 185]
  |  |  ------------------
  ------------------
  491|     59|    BLOSC_TRACE_ERROR("The blockshape is bigger than the output buffer");
  ------------------
  |  |   93|     59|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     59|    do {                                            \
  |  |  |  |   98|     59|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     59|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 59, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     59|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  492|     59|    return 0;
  493|     59|  }
  494|    185|  memset(op, 0, blockshape[0] * blockshape[1]);
  495|       |
  496|    185|  int32_t i_stop[2];
  497|    555|  for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (497:19): [True: 370, False: 185]
  ------------------
  498|    370|    i_stop[i] = eshape[i] / cell_shape;
  499|    370|  }
  500|       |
  501|       |  /* main loop */
  502|    185|  int32_t ii[2];
  503|    185|  int32_t padding[2] = {0};
  504|    185|  int32_t ind = 0;
  505|    185|  uint8_t *local_buffer = malloc(cell_size);
  506|    185|  uint8_t *cell_aux = malloc(cell_size);
  507|       |
  508|       |  // Validate that a read of `len` bytes starting at byte offset `pos` (measured
  509|       |  // from the start of `input`) lies fully within the compressed buffer.  A
  510|       |  // crafted token `offset` otherwise makes a back-reference point before
  511|       |  // `input`, and the cell-fill memcpy then leaks out-of-bounds heap memory into
  512|       |  // the (attacker-visible) output -- CWE-125.  The per-cell `ip > ip_limit`
  513|       |  // check is not enough because each cell reads a 2-byte offset and literal
  514|       |  // bytes past that point.  All arithmetic is done on integer offsets so we
  515|       |  // never form an out-of-bounds pointer (undefined behaviour in C, even when the
  516|       |  // pointer is only compared and not dereferenced).
  517|    185|#define NDLZ8_CHECK_RANGE(pos, len)                                              \
  518|    185|  do {                                                                           \
  519|    185|    int64_t _pos = (int64_t) (pos);                                              \
  520|    185|    int64_t _len = (int64_t) (len);                                              \
  521|    185|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  522|    185|      free(local_buffer);                                                        \
  523|    185|      free(cell_aux);                                                            \
  524|    185|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  525|    185|      return BLOSC2_ERROR_FAILURE;                                               \
  526|    185|    }                                                                            \
  527|    185|  } while (0)
  528|       |
  529|   485M|  for (ii[0] = 0; ii[0] < i_stop[0]; ++ii[0]) {
  ------------------
  |  Branch (529:19): [True: 485M, False: 18]
  ------------------
  530|   485M|    for (ii[1] = 0; ii[1] < i_stop[1]; ++ii[1]) {      // for each cell
  ------------------
  |  Branch (530:21): [True: 1.30k, False: 485M]
  ------------------
  531|  1.30k|      if (NDLZ_UNEXPECT_CONDITIONAL(ip > ip_limit)) {
  ------------------
  |  |   30|  1.30k|#define NDLZ_UNEXPECT_CONDITIONAL(c)  (__builtin_expect((c), 0))
  |  |  ------------------
  |  |  |  Branch (30:39): [True: 0, False: 1.30k]
  |  |  ------------------
  ------------------
  532|      0|        free(local_buffer);
  533|      0|        free(cell_aux);
  534|      0|        BLOSC_TRACE_ERROR("Exceeding input length");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  535|      0|        return BLOSC2_ERROR_FAILURE;
  536|      0|      }
  537|  1.30k|      if (ii[0] == i_stop[0] - 1) {
  ------------------
  |  Branch (537:11): [True: 1.00k, False: 292]
  ------------------
  538|  1.00k|        padding[0] = (blockshape[0] % cell_shape == 0) ? cell_shape : blockshape[0] % cell_shape;
  ------------------
  |  Branch (538:22): [True: 24, False: 984]
  ------------------
  539|  1.00k|      } else {
  540|    292|        padding[0] = cell_shape;
  541|    292|      }
  542|  1.30k|      if (ii[1] == i_stop[1] - 1) {
  ------------------
  |  Branch (542:11): [True: 258, False: 1.04k]
  ------------------
  543|    258|        padding[1] = (blockshape[1] % cell_shape == 0) ? cell_shape : blockshape[1] % cell_shape;
  ------------------
  |  Branch (543:22): [True: 55, False: 203]
  ------------------
  544|  1.04k|      } else {
  545|  1.04k|        padding[1] = cell_shape;
  546|  1.04k|      }
  547|  1.30k|      int64_t cur = ip - (const uint8_t *) input;   // in-range: ip is within [input, ip_limit]
  548|  1.30k|      NDLZ8_CHECK_RANGE(cur, 1);
  ------------------
  |  |  518|  1.30k|  do {                                                                           \
  |  |  519|  1.30k|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|  1.30k|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|  1.30k|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 1.30k]
  |  |  |  Branch (521:21): [True: 0, False: 1.30k]
  |  |  |  Branch (521:33): [True: 2, False: 1.29k]
  |  |  ------------------
  |  |  522|      2|      free(local_buffer);                                                        \
  |  |  523|      2|      free(cell_aux);                                                            \
  |  |  524|      2|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      2|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      2|    }                                                                            \
  |  |  527|  1.30k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 1.29k]
  |  |  ------------------
  ------------------
  549|  1.29k|      token = *ip++;
  550|  1.29k|      uint8_t match_type = (token >> 3U);
  551|  1.29k|      if (token == 0) {    // no match
  ------------------
  |  Branch (551:11): [True: 271, False: 1.02k]
  ------------------
  552|    271|        NDLZ8_CHECK_RANGE(cur + 1, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|    271|  do {                                                                           \
  |  |  519|    271|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    271|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    271|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 271]
  |  |  |  Branch (521:21): [True: 0, False: 271]
  |  |  |  Branch (521:33): [True: 9, False: 262]
  |  |  ------------------
  |  |  522|      9|      free(local_buffer);                                                        \
  |  |  523|      9|      free(cell_aux);                                                            \
  |  |  524|      9|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      9|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      9|    do {                                            \
  |  |  |  |  |  |   98|      9|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      9|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 9, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      9|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      9|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      9|    }                                                                            \
  |  |  527|    271|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 262]
  |  |  ------------------
  ------------------
  553|    262|        buffercpy = ip;
  554|    262|        ip += padding[0] * padding[1];
  555|  1.02k|      } else if (token == (uint8_t) ((1U << 7U) | (1U << 6U))) {  // cell match
  ------------------
  |  Branch (555:18): [True: 39, False: 988]
  ------------------
  556|     39|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|     39|  do {                                                                           \
  |  |  519|     39|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     39|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     39|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 39]
  |  |  |  Branch (521:21): [True: 0, False: 39]
  |  |  |  Branch (521:33): [True: 1, False: 38]
  |  |  ------------------
  |  |  522|      1|      free(local_buffer);                                                        \
  |  |  523|      1|      free(cell_aux);                                                            \
  |  |  524|      1|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      1|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      1|    }                                                                            \
  |  |  527|     39|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 38]
  |  |  ------------------
  ------------------
  557|     38|        uint16_t offset;
  558|     38|        memcpy(&offset, ip, sizeof(offset));
  559|     38|        int64_t bpos = (cur + 1) - (int64_t) offset - 1;
  560|     38|        NDLZ8_CHECK_RANGE(bpos, (int64_t) padding[0] * padding[1]);
  ------------------
  |  |  518|     38|  do {                                                                           \
  |  |  519|     38|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|     38|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|     38|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 22, False: 16]
  |  |  |  Branch (521:21): [True: 0, False: 16]
  |  |  |  Branch (521:33): [True: 3, False: 13]
  |  |  ------------------
  |  |  522|     25|      free(local_buffer);                                                        \
  |  |  523|     25|      free(cell_aux);                                                            \
  |  |  524|     25|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     25|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     25|    }                                                                            \
  |  |  527|     38|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 13]
  |  |  ------------------
  ------------------
  561|     13|        buffercpy = (uint8_t *) input + bpos;
  562|     13|        ip += 2;
  563|    988|      } else if (token == (uint8_t) (1U << 6U)) { // whole cell of same element
  ------------------
  |  Branch (563:18): [True: 701, False: 287]
  ------------------
  564|    701|        NDLZ8_CHECK_RANGE(cur + 1, 1);
  ------------------
  |  |  518|    701|  do {                                                                           \
  |  |  519|    701|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    701|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    701|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 701]
  |  |  |  Branch (521:21): [True: 0, False: 701]
  |  |  |  Branch (521:33): [True: 2, False: 699]
  |  |  ------------------
  |  |  522|      2|      free(local_buffer);                                                        \
  |  |  523|      2|      free(cell_aux);                                                            \
  |  |  524|      2|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      2|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      2|    }                                                                            \
  |  |  527|    701|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 699]
  |  |  ------------------
  ------------------
  565|    699|        buffercpy = cell_aux;
  566|    699|        memset(buffercpy, *ip, cell_size);
  567|    699|        ip++;
  568|    699|      } else if (match_type == 21) {    // triple match
  ------------------
  |  Branch (568:18): [True: 112, False: 175]
  ------------------
  569|    112|        buffercpy = local_buffer;
  570|    112|        int row = (int) (token & 7);
  571|    112|        if (row + 2 >= cell_shape) {
  ------------------
  |  Branch (571:13): [True: 1, False: 111]
  ------------------
  572|      1|          free(local_buffer);
  573|      1|          free(cell_aux);
  574|      1|          BLOSC_TRACE_ERROR("Triple match row out of bounds");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  575|      1|          return BLOSC2_ERROR_FAILURE;
  576|      1|        }
  577|    111|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|    111|  do {                                                                           \
  |  |  519|    111|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    111|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    111|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 111]
  |  |  |  Branch (521:21): [True: 0, False: 111]
  |  |  |  Branch (521:33): [True: 1, False: 110]
  |  |  ------------------
  |  |  522|      1|      free(local_buffer);                                                        \
  |  |  523|      1|      free(cell_aux);                                                            \
  |  |  524|      1|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      1|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      1|    }                                                                            \
  |  |  527|    111|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 110]
  |  |  ------------------
  ------------------
  578|    110|        uint16_t offset;
  579|    110|        memcpy(&offset, ip, sizeof(offset));
  580|    110|        ip += 2;
  581|       |        // back-reference base == ip - sizeof(token) - sizeof(offset) - offset,
  582|       |        // i.e. (cur + 3) - 3 - offset == cur - offset, expressed as an offset.
  583|    110|        int64_t bpos = cur - (int64_t) offset;
  584|    110|        NDLZ8_CHECK_RANGE(bpos, 3 * cell_shape);
  ------------------
  |  |  518|    110|  do {                                                                           \
  |  |  519|    110|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    110|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    110|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 19, False: 91]
  |  |  |  Branch (521:21): [True: 0, False: 91]
  |  |  |  Branch (521:33): [True: 1, False: 90]
  |  |  ------------------
  |  |  522|     20|      free(local_buffer);                                                        \
  |  |  523|     20|      free(cell_aux);                                                            \
  |  |  524|     20|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|     20|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     20|    do {                                            \
  |  |  |  |  |  |   98|     20|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     20|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 20, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     20|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     20|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     20|    }                                                                            \
  |  |  527|    110|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 90]
  |  |  ------------------
  ------------------
  585|     90|        const uint8_t *ref = (const uint8_t *) input + bpos;
  586|    360|        for (int l = 0; l < 3; l++) {
  ------------------
  |  Branch (586:25): [True: 270, False: 90]
  ------------------
  587|    270|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  588|    270|        }
  589|    774|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (589:25): [True: 692, False: 82]
  ------------------
  590|    692|          if ((l < row) || (l > row + 2)) {
  ------------------
  |  Branch (590:15): [True: 248, False: 444]
  |  Branch (590:28): [True: 189, False: 255]
  ------------------
  591|    437|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|    437|  do {                                                                           \
  |  |  519|    437|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    437|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    437|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 437]
  |  |  |  Branch (521:21): [True: 0, False: 437]
  |  |  |  Branch (521:33): [True: 8, False: 429]
  |  |  ------------------
  |  |  522|      8|      free(local_buffer);                                                        \
  |  |  523|      8|      free(cell_aux);                                                            \
  |  |  524|      8|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|      8|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|      8|    do {                                            \
  |  |  |  |  |  |   98|      8|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|      8|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 8, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|      8|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      8|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      8|    }                                                                            \
  |  |  527|    437|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 429]
  |  |  ------------------
  ------------------
  592|    429|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  593|    429|            ip += cell_shape;
  594|    429|          }
  595|    692|        }
  596|    175|      } else if (match_type == 17) {    // pair match
  ------------------
  |  Branch (596:18): [True: 117, False: 58]
  ------------------
  597|    117|        buffercpy = local_buffer;
  598|    117|        int row = (int) (token & 7);
  599|    117|        if (row + 1 >= cell_shape) {
  ------------------
  |  Branch (599:13): [True: 1, False: 116]
  ------------------
  600|      1|          free(local_buffer);
  601|      1|          free(cell_aux);
  602|      1|          BLOSC_TRACE_ERROR("Pair match row out of bounds");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  603|      1|          return BLOSC2_ERROR_FAILURE;
  604|      1|        }
  605|    116|        NDLZ8_CHECK_RANGE(cur + 1, 2);
  ------------------
  |  |  518|    116|  do {                                                                           \
  |  |  519|    116|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    116|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    116|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 116]
  |  |  |  Branch (521:21): [True: 0, False: 116]
  |  |  |  Branch (521:33): [True: 1, False: 115]
  |  |  ------------------
  |  |  522|      1|      free(local_buffer);                                                        \
  |  |  523|      1|      free(cell_aux);                                                            \
  |  |  524|      1|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|      1|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|      1|    }                                                                            \
  |  |  527|    116|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 115]
  |  |  ------------------
  ------------------
  606|    115|        uint16_t offset;
  607|    115|        memcpy(&offset, ip, sizeof(offset));
  608|    115|        ip += 2;
  609|       |        // back-reference base == cur - offset (see triple-match note above).
  610|    115|        int64_t bpos = cur - (int64_t) offset;
  611|    115|        NDLZ8_CHECK_RANGE(bpos, 2 * cell_shape);
  ------------------
  |  |  518|    115|  do {                                                                           \
  |  |  519|    115|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    115|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    115|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 21, False: 94]
  |  |  |  Branch (521:21): [True: 0, False: 94]
  |  |  |  Branch (521:33): [True: 2, False: 92]
  |  |  ------------------
  |  |  522|     23|      free(local_buffer);                                                        \
  |  |  523|     23|      free(cell_aux);                                                            \
  |  |  524|     23|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   93|     23|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   97|     23|    do {                                            \
  |  |  |  |  |  |   98|     23|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |  |  |   99|     23|        if (!__e) { break; }                        \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (99:13): [True: 23, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  100|     23|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     23|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     23|    }                                                                            \
  |  |  527|    115|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 92]
  |  |  ------------------
  ------------------
  612|     92|        const uint8_t *ref = (const uint8_t *) input + bpos;
  613|    276|        for (int l = 0; l < 2; l++) {
  ------------------
  |  Branch (613:25): [True: 184, False: 92]
  ------------------
  614|    184|          memcpy(&buffercpy[(row + l) * cell_shape], ref + l * cell_shape, cell_shape);
  615|    184|        }
  616|    774|        for (int l = 0; l < cell_shape; l++) {
  ------------------
  |  Branch (616:25): [True: 697, False: 77]
  ------------------
  617|    697|          if ((l < row) || (l > row + 1)) {
  ------------------
  |  Branch (617:15): [True: 264, False: 433]
  |  Branch (617:28): [True: 261, False: 172]
  ------------------
  618|    525|            NDLZ8_CHECK_RANGE(ip - (const uint8_t *) input, cell_shape);
  ------------------
  |  |  518|    525|  do {                                                                           \
  |  |  519|    525|    int64_t _pos = (int64_t) (pos);                                              \
  |  |  520|    525|    int64_t _len = (int64_t) (len);                                              \
  |  |  521|    525|    if (_pos < 0 || _len < 0 || _pos > (int64_t) input_len - _len) {             \
  |  |  ------------------
  |  |  |  Branch (521:9): [True: 0, False: 525]
  |  |  |  Branch (521:21): [True: 0, False: 525]
  |  |  |  Branch (521:33): [True: 15, False: 510]
  |  |  ------------------
  |  |  522|     15|      free(local_buffer);                                                        \
  |  |  523|     15|      free(cell_aux);                                                            \
  |  |  524|     15|      BLOSC_TRACE_ERROR("ndlz8: out-of-bounds reference in compressed stream");  \
  |  |  ------------------
  |  |  |  |   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]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  525|     15|      return BLOSC2_ERROR_FAILURE;                                               \
  |  |  526|     15|    }                                                                            \
  |  |  527|    525|  } while (0)
  |  |  ------------------
  |  |  |  Branch (527:12): [Folded, False: 510]
  |  |  ------------------
  ------------------
  619|    510|            memcpy(&buffercpy[l * cell_shape], ip, cell_shape);
  620|    510|            ip += cell_shape;
  621|    510|          }
  622|    697|        }
  623|     92|      } else {
  624|     58|        free(local_buffer);
  625|     58|        free(cell_aux);
  626|     58|        BLOSC_TRACE_ERROR("Invalid token: %u at cell [%d, %d]\n", token, ii[0], ii[1]);
  ------------------
  |  |   93|     58|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|     58|    do {                                            \
  |  |  |  |   98|     58|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|     58|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 58, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|     58|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  627|     58|        return BLOSC2_ERROR_FAILURE;
  628|     58|      }
  629|       |
  630|  1.13k|      int32_t orig = ii[0] * cell_shape * blockshape[1] + ii[1] * cell_shape;
  631|  10.1k|      for (int32_t i = 0; i < (int32_t) cell_shape; i++) {
  ------------------
  |  Branch (631:27): [True: 9.06k, False: 1.13k]
  ------------------
  632|  9.06k|        if (i < padding[0]) {
  ------------------
  |  Branch (632:13): [True: 5.04k, False: 4.01k]
  ------------------
  633|  5.04k|          ind = orig + i * blockshape[1];
  634|  5.04k|          memcpy(&op[ind], buffercpy, padding[1]);
  635|       |          // Only advance over rows we actually consume.  For a literal cell
  636|       |          // (token == 0) buffercpy points into the input and only holds
  637|       |          // padding[0] * padding[1] bytes; advancing unconditionally for the
  638|       |          // trailing padding rows would form an out-of-bounds pointer (UB)
  639|       |          // for the block's last cell.  The skipped rows are never read.
  640|  5.04k|          buffercpy += padding[1];
  641|  5.04k|        }
  642|  9.06k|      }
  643|  1.13k|      if (ind > output_len) {
  ------------------
  |  Branch (643:11): [True: 0, False: 1.13k]
  ------------------
  644|      0|        free(local_buffer);
  645|      0|        free(cell_aux);
  646|      0|        BLOSC_TRACE_ERROR("Exceeding output size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  647|      0|        return BLOSC2_ERROR_FAILURE;
  648|      0|      }
  649|  1.13k|    }
  650|   485M|  }
  651|     18|  ind += padding[1];
  652|       |
  653|     18|  free(cell_aux);
  654|     18|  free(local_buffer);
  655|       |
  656|     18|  if (ind != (blockshape[0] * blockshape[1])) {
  ------------------
  |  Branch (656:7): [True: 0, False: 18]
  ------------------
  657|      0|    BLOSC_TRACE_ERROR("Output size is not compatible with embedded blockshape");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  658|      0|    return BLOSC2_ERROR_FAILURE;
  659|      0|  }
  660|     18|  if (ind > output_len) {
  ------------------
  |  Branch (660:7): [True: 0, False: 18]
  ------------------
  661|      0|    BLOSC_TRACE_ERROR("Exceeding output size");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  662|      0|    return BLOSC2_ERROR_FAILURE;
  663|      0|  }
  664|       |
  665|     18|  return (int) ind;
  666|     18|#undef NDLZ8_CHECK_RANGE
  667|     18|}

zfp_acc_decompress:
  305|      2|                       int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
  306|      2|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|      2|  do {                          \
  |  |   23|      2|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      2|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 2]
  |  |  ------------------
  ------------------
  307|      2|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|      2|  do {                          \
  |  |   23|      2|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      2|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 2]
  |  |  ------------------
  ------------------
  308|      2|  ZFP_ERROR_NULL(dparams);
  ------------------
  |  |   22|      2|  do {                          \
  |  |   23|      2|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 2]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      2|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 2]
  |  |  ------------------
  ------------------
  309|      2|  ZFP_ERROR_NULL(dparams->schunk);
  ------------------
  |  |   22|      2|  do {                          \
  |  |   23|      2|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 2, False: 0]
  |  |  ------------------
  |  |   24|      2|      return 0;                 \
  |  |   25|      2|    }                           \
  |  |   26|      2|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  310|      0|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|      0|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  311|       |
  312|      0|  blosc2_schunk *sc = dparams->schunk;
  313|      0|  int32_t typesize = sc->typesize;
  314|       |
  315|      0|  double tol = (int8_t) meta;
  316|      0|  int8_t ndim;
  317|      0|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  318|      0|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  319|      0|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  320|      0|  uint8_t *smeta;
  321|      0|  int32_t smeta_len;
  322|      0|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (322:7): [True: 0, False: 0]
  ------------------
  323|      0|    BLOSC_TRACE_ERROR("Cannot access b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  324|      0|    free(shape);
  325|      0|    free(chunkshape);
  326|      0|    free(blockshape);
  327|      0|    return BLOSC2_ERROR_FAILURE;
  328|      0|  }
  329|      0|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  330|      0|  free(smeta);
  331|       |
  332|      0|  if (zfp_check_output_size(deserialize_rc, ndim, blockshape, typesize, output_len) < 0) {
  ------------------
  |  Branch (332:7): [True: 0, False: 0]
  ------------------
  333|      0|    free(shape);
  334|      0|    free(chunkshape);
  335|      0|    free(blockshape);
  336|      0|    return BLOSC2_ERROR_FAILURE;
  337|      0|  }
  338|       |
  339|      0|  zfp_type type;     /* array scalar type */
  340|      0|  zfp_field *field;  /* array meta data */
  341|      0|  zfp_stream *zfp;   /* compressed stream */
  342|      0|  bitstream *stream = NULL; /* bit stream to write to or read from */
  343|      0|  uint8_t *padded_input = NULL;
  344|      0|  size_t zfpsize;    /* byte size of compressed stream */
  345|      0|  double tolerance = pow(10, tol);
  346|       |
  347|      0|  switch (typesize) {
  348|      0|    case sizeof(float):
  ------------------
  |  Branch (348:5): [True: 0, False: 0]
  ------------------
  349|      0|      type = zfp_type_float;
  350|      0|      break;
  351|      0|    case sizeof(double):
  ------------------
  |  Branch (351:5): [True: 0, False: 0]
  ------------------
  352|      0|      type = zfp_type_double;
  353|      0|      break;
  354|      0|    default:
  ------------------
  |  Branch (354:5): [True: 0, False: 0]
  ------------------
  355|      0|      free(shape);
  356|      0|      free(chunkshape);
  357|      0|      free(blockshape);
  358|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  359|      0|      return BLOSC2_ERROR_FAILURE;
  360|      0|  }
  361|       |
  362|      0|  zfp = zfp_stream_open(NULL);
  363|      0|  zfp_stream_set_accuracy(zfp, tolerance);
  364|       |
  365|      0|  switch (ndim) {
  366|      0|    case 1:
  ------------------
  |  Branch (366:5): [True: 0, False: 0]
  ------------------
  367|      0|      field = zfp_field_1d((void *) output, type, blockshape[0]);
  368|      0|      break;
  369|      0|    case 2:
  ------------------
  |  Branch (369:5): [True: 0, False: 0]
  ------------------
  370|      0|      field = zfp_field_2d((void *) output, type, blockshape[1], blockshape[0]);
  371|      0|      break;
  372|      0|    case 3:
  ------------------
  |  Branch (372:5): [True: 0, False: 0]
  ------------------
  373|      0|      field = zfp_field_3d((void *) output, type, blockshape[2], blockshape[1], blockshape[0]);
  374|      0|      break;
  375|      0|    case 4:
  ------------------
  |  Branch (375:5): [True: 0, False: 0]
  ------------------
  376|      0|      field = zfp_field_4d((void *) output, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  377|      0|      break;
  378|      0|    default:
  ------------------
  |  Branch (378:5): [True: 0, False: 0]
  ------------------
  379|      0|      free(shape);
  380|      0|      free(chunkshape);
  381|      0|      free(blockshape);
  382|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  383|      0|      return BLOSC2_ERROR_FAILURE;
  384|      0|  }
  385|       |
  386|      0|  size_t blocks = zfp_field_blocks(field);
  387|      0|  size_t min_bytes = (blocks + CHAR_BIT - 1) / CHAR_BIT;
  388|      0|  if (min_bytes < 1) {
  ------------------
  |  Branch (388:7): [True: 0, False: 0]
  ------------------
  389|      0|    min_bytes = 1;
  390|      0|  }
  391|      0|  if (input_len < 0 || (size_t) input_len < min_bytes) {
  ------------------
  |  Branch (391:7): [True: 0, False: 0]
  |  Branch (391:24): [True: 0, False: 0]
  ------------------
  392|      0|    BLOSC_TRACE_ERROR("ZFP acc: input too small (%d bytes) for the required "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  393|      0|                      "bitstream size (%zu bytes)", input_len, min_bytes);
  394|      0|    zfp_field_free(field);
  395|      0|    zfp_stream_close(zfp);
  396|      0|    free(shape);
  397|      0|    free(chunkshape);
  398|      0|    free(blockshape);
  399|      0|    return BLOSC2_ERROR_FAILURE;
  400|      0|  }
  401|       |
  402|      0|  if (zfp_open_padded_stream(input, input_len, zfp, field, &stream, &padded_input) != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (402:7): [True: 0, False: 0]
  ------------------
  403|      0|    zfp_field_free(field);
  404|      0|    zfp_stream_close(zfp);
  405|      0|    free(shape);
  406|      0|    free(chunkshape);
  407|      0|    free(blockshape);
  408|      0|    return BLOSC2_ERROR_FAILURE;
  409|      0|  }
  410|       |
  411|      0|  zfpsize = zfp_decompress(zfp, field);
  412|       |
  413|       |  /* clean up */
  414|      0|  zfp_field_free(field);
  415|      0|  zfp_stream_close(zfp);
  416|      0|  zfp_close_padded_stream(stream, padded_input);
  417|      0|  free(shape);
  418|      0|  free(chunkshape);
  419|      0|  free(blockshape);
  420|       |
  421|      0|  if (zfpsize == 0) {
  ------------------
  |  Branch (421:7): [True: 0, False: 0]
  ------------------
  422|      0|    BLOSC_TRACE_ERROR("\n ZFP: Decompression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  423|      0|    return (int) zfpsize;
  424|      0|  }
  425|       |
  426|      0|  return (int) output_len;
  427|      0|}
zfp_prec_decompress:
  607|      1|                        int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
  608|      1|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  609|      1|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  610|      1|  ZFP_ERROR_NULL(dparams);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 1]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 1]
  |  |  ------------------
  ------------------
  611|      1|  ZFP_ERROR_NULL(dparams->schunk);
  ------------------
  |  |   22|      1|  do {                          \
  |  |   23|      1|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 1, False: 0]
  |  |  ------------------
  |  |   24|      1|      return 0;                 \
  |  |   25|      1|    }                           \
  |  |   26|      1|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  612|      0|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|      0|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  613|       |
  614|      0|  blosc2_schunk *sc = dparams->schunk;
  615|      0|  int32_t typesize = sc->typesize;
  616|      0|  int8_t ndim;
  617|      0|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  618|      0|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  619|      0|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  620|      0|  uint8_t *smeta;
  621|      0|  int32_t smeta_len;
  622|      0|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (622:7): [True: 0, False: 0]
  ------------------
  623|      0|    BLOSC_TRACE_ERROR("Cannot access b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  624|      0|    free(shape);
  625|      0|    free(chunkshape);
  626|      0|    free(blockshape);
  627|      0|    return BLOSC2_ERROR_FAILURE;
  628|      0|  }
  629|      0|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  630|      0|  free(smeta);
  631|       |
  632|      0|  if (zfp_check_output_size(deserialize_rc, ndim, blockshape, typesize, output_len) < 0) {
  ------------------
  |  Branch (632:7): [True: 0, False: 0]
  ------------------
  633|      0|    free(shape);
  634|      0|    free(chunkshape);
  635|      0|    free(blockshape);
  636|      0|    return BLOSC2_ERROR_FAILURE;
  637|      0|  }
  638|       |
  639|      0|  zfp_type type;     /* array scalar type */
  640|      0|  zfp_field *field;  /* array meta data */
  641|      0|  zfp_stream *zfp;   /* compressed stream */
  642|      0|  bitstream *stream = NULL; /* bit stream to write to or read from */
  643|      0|  uint8_t *padded_input = NULL;
  644|      0|  size_t zfpsize;    /* byte size of compressed stream */
  645|       |
  646|      0|  uint prec;
  647|      0|  switch (ndim) {
  648|      0|    case 1:
  ------------------
  |  Branch (648:5): [True: 0, False: 0]
  ------------------
  649|      0|      prec = meta + 5;
  650|      0|      break;
  651|      0|    case 2:
  ------------------
  |  Branch (651:5): [True: 0, False: 0]
  ------------------
  652|      0|      prec = meta + 7;
  653|      0|      break;
  654|      0|    case 3:
  ------------------
  |  Branch (654:5): [True: 0, False: 0]
  ------------------
  655|      0|      prec = meta + 9;
  656|      0|      break;
  657|      0|    case 4:
  ------------------
  |  Branch (657:5): [True: 0, False: 0]
  ------------------
  658|      0|      prec = meta + 11;
  659|      0|      break;
  660|      0|    default:
  ------------------
  |  Branch (660:5): [True: 0, False: 0]
  ------------------
  661|      0|      free(shape);
  662|      0|      free(chunkshape);
  663|      0|      free(blockshape);
  664|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  665|      0|      return BLOSC2_ERROR_FAILURE;
  666|      0|  }
  667|       |
  668|      0|  if (prec > ZFP_MAX_PREC) {
  ------------------
  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  |  Branch (668:7): [True: 0, False: 0]
  ------------------
  669|      0|    BLOSC_TRACE_ERROR("Max precision for this codecs is %d", ZFP_MAX_PREC);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  669|      0|    BLOSC_TRACE_ERROR("Max precision for this codecs is %d", ZFP_MAX_PREC);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  670|      0|    prec = ZFP_MAX_PREC;
  ------------------
  |  |   20|      0|#define ZFP_MAX_PREC    64 /* maximum precision supported */
  ------------------
  671|      0|  }
  672|       |
  673|      0|  switch (typesize) {
  674|      0|    case sizeof(float):
  ------------------
  |  Branch (674:5): [True: 0, False: 0]
  ------------------
  675|      0|      type = zfp_type_float;
  676|      0|      break;
  677|      0|    case sizeof(double):
  ------------------
  |  Branch (677:5): [True: 0, False: 0]
  ------------------
  678|      0|      type = zfp_type_double;
  679|      0|      break;
  680|      0|    default:
  ------------------
  |  Branch (680:5): [True: 0, False: 0]
  ------------------
  681|      0|      free(shape);
  682|      0|      free(chunkshape);
  683|      0|      free(blockshape);
  684|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  685|      0|      return BLOSC2_ERROR_FAILURE;
  686|      0|  }
  687|       |
  688|      0|  zfp = zfp_stream_open(NULL);
  689|      0|  zfp_stream_set_precision(zfp, prec);
  690|       |
  691|      0|  switch (ndim) {
  692|      0|    case 1:
  ------------------
  |  Branch (692:5): [True: 0, False: 0]
  ------------------
  693|      0|      field = zfp_field_1d((void *) output, type, blockshape[0]);
  694|      0|      break;
  695|      0|    case 2:
  ------------------
  |  Branch (695:5): [True: 0, False: 0]
  ------------------
  696|      0|      field = zfp_field_2d((void *) output, type, blockshape[1], blockshape[0]);
  697|      0|      break;
  698|      0|    case 3:
  ------------------
  |  Branch (698:5): [True: 0, False: 0]
  ------------------
  699|      0|      field = zfp_field_3d((void *) output, type, blockshape[2], blockshape[1], blockshape[0]);
  700|      0|      break;
  701|      0|    case 4:
  ------------------
  |  Branch (701:5): [True: 0, False: 0]
  ------------------
  702|      0|      field = zfp_field_4d((void *) output, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  703|      0|      break;
  704|      0|    default:
  ------------------
  |  Branch (704:5): [True: 0, False: 0]
  ------------------
  705|      0|      free(shape);
  706|      0|      free(chunkshape);
  707|      0|      free(blockshape);
  708|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  709|      0|      return BLOSC2_ERROR_FAILURE;
  710|      0|  }
  711|       |
  712|      0|  size_t blocks = zfp_field_blocks(field);
  713|      0|  size_t min_bytes = (blocks + CHAR_BIT - 1) / CHAR_BIT;
  714|      0|  if (min_bytes < 1) {
  ------------------
  |  Branch (714:7): [True: 0, False: 0]
  ------------------
  715|      0|    min_bytes = 1;
  716|      0|  }
  717|      0|  if (input_len < 0 || (size_t) input_len < min_bytes) {
  ------------------
  |  Branch (717:7): [True: 0, False: 0]
  |  Branch (717:24): [True: 0, False: 0]
  ------------------
  718|      0|    BLOSC_TRACE_ERROR("ZFP prec: input too small (%d bytes) for the required "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  719|      0|                      "bitstream size (%zu bytes)", input_len, min_bytes);
  720|      0|    zfp_field_free(field);
  721|      0|    zfp_stream_close(zfp);
  722|      0|    free(shape);
  723|      0|    free(chunkshape);
  724|      0|    free(blockshape);
  725|      0|    return BLOSC2_ERROR_FAILURE;
  726|      0|  }
  727|       |
  728|      0|  if (zfp_open_padded_stream(input, input_len, zfp, field, &stream, &padded_input) != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (728:7): [True: 0, False: 0]
  ------------------
  729|      0|    zfp_field_free(field);
  730|      0|    zfp_stream_close(zfp);
  731|      0|    free(shape);
  732|      0|    free(chunkshape);
  733|      0|    free(blockshape);
  734|      0|    return BLOSC2_ERROR_FAILURE;
  735|      0|  }
  736|       |
  737|      0|  zfpsize = zfp_decompress(zfp, field);
  738|       |
  739|       |  /* clean up */
  740|      0|  zfp_field_free(field);
  741|      0|  zfp_stream_close(zfp);
  742|      0|  zfp_close_padded_stream(stream, padded_input);
  743|      0|  free(shape);
  744|      0|  free(chunkshape);
  745|      0|  free(blockshape);
  746|       |
  747|      0|  if (zfpsize == 0) {
  ------------------
  |  Branch (747:7): [True: 0, False: 0]
  ------------------
  748|      0|    BLOSC_TRACE_ERROR("\n ZFP: Decompression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  749|      0|    return (int) zfpsize;
  750|      0|  }
  751|       |
  752|      0|  return (int) output_len;
  753|      0|}
zfp_rate_decompress:
  920|      4|                        int32_t output_len, uint8_t meta, blosc2_dparams *dparams, const void *chunk) {
  921|      4|  ZFP_ERROR_NULL(input);
  ------------------
  |  |   22|      4|  do {                          \
  |  |   23|      4|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 4]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      4|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 4]
  |  |  ------------------
  ------------------
  922|      4|  ZFP_ERROR_NULL(output);
  ------------------
  |  |   22|      4|  do {                          \
  |  |   23|      4|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 4]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      4|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 4]
  |  |  ------------------
  ------------------
  923|      4|  ZFP_ERROR_NULL(dparams);
  ------------------
  |  |   22|      4|  do {                          \
  |  |   23|      4|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 0, False: 4]
  |  |  ------------------
  |  |   24|      0|      return 0;                 \
  |  |   25|      0|    }                           \
  |  |   26|      4|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 4]
  |  |  ------------------
  ------------------
  924|      4|  ZFP_ERROR_NULL(dparams->schunk);
  ------------------
  |  |   22|      4|  do {                          \
  |  |   23|      4|    if ((pointer) == NULL) {    \
  |  |  ------------------
  |  |  |  Branch (23:9): [True: 4, False: 0]
  |  |  ------------------
  |  |   24|      4|      return 0;                 \
  |  |   25|      4|    }                           \
  |  |   26|      4|  } while (0)
  |  |  ------------------
  |  |  |  Branch (26:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  925|      0|  BLOSC_UNUSED_PARAM(chunk);
  ------------------
  |  |   28|      0|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  926|       |
  927|      0|  blosc2_schunk *sc = dparams->schunk;
  928|      0|  int32_t typesize = sc->typesize;
  929|       |
  930|      0|  double ratio = (double) meta / 100.0;
  931|      0|  int8_t ndim;
  932|      0|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  933|      0|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  934|      0|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      0|#define B2ND_MAX_DIM 16
  ------------------
  935|      0|  uint8_t *smeta;
  936|      0|  int32_t smeta_len;
  937|      0|  if (blosc2_meta_get(sc, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (937:7): [True: 0, False: 0]
  ------------------
  938|      0|    BLOSC_TRACE_ERROR("Cannot access b2nd meta info");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  939|      0|    free(shape);
  940|      0|    free(chunkshape);
  941|      0|    free(blockshape);
  942|      0|    return BLOSC2_ERROR_FAILURE;
  943|      0|  }
  944|      0|  int deserialize_rc = b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL);
  945|      0|  free(smeta);
  946|       |
  947|      0|  if (zfp_check_output_size(deserialize_rc, ndim, blockshape, typesize, output_len) < 0) {
  ------------------
  |  Branch (947:7): [True: 0, False: 0]
  ------------------
  948|      0|    free(shape);
  949|      0|    free(chunkshape);
  950|      0|    free(blockshape);
  951|      0|    return BLOSC2_ERROR_FAILURE;
  952|      0|  }
  953|       |
  954|      0|  zfp_type type;     /* array scalar type */
  955|      0|  zfp_field *field;  /* array meta data */
  956|      0|  zfp_stream *zfp;   /* compressed stream */
  957|      0|  bitstream *stream = NULL; /* bit stream to write to or read from */
  958|      0|  uint8_t *padded_input = NULL;
  959|      0|  size_t zfpsize;    /* byte size of compressed stream */
  960|       |
  961|      0|  switch (typesize) {
  962|      0|    case sizeof(float):
  ------------------
  |  Branch (962:5): [True: 0, False: 0]
  ------------------
  963|      0|      type = zfp_type_float;
  964|      0|      break;
  965|      0|    case sizeof(double):
  ------------------
  |  Branch (965:5): [True: 0, False: 0]
  ------------------
  966|      0|      type = zfp_type_double;
  967|      0|      break;
  968|      0|    default:
  ------------------
  |  Branch (968:5): [True: 0, False: 0]
  ------------------
  969|      0|      free(shape);
  970|      0|      free(chunkshape);
  971|      0|      free(blockshape);
  972|      0|      BLOSC_TRACE_ERROR("ZFP is not available for typesize: %d", typesize);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  973|      0|      return BLOSC2_ERROR_FAILURE;
  974|      0|  }
  975|      0|  double rate =
  976|      0|      ratio * (double) typesize * 8;     // convert from output size / input size to output bits per input value
  977|      0|  zfp = zfp_stream_open(NULL);
  978|      0|  zfp_stream_set_rate(zfp, rate, type, ndim, zfp_false);
  979|       |
  980|      0|  switch (ndim) {
  981|      0|    case 1:
  ------------------
  |  Branch (981:5): [True: 0, False: 0]
  ------------------
  982|      0|      field = zfp_field_1d((void *) output, type, blockshape[0]);
  983|      0|      break;
  984|      0|    case 2:
  ------------------
  |  Branch (984:5): [True: 0, False: 0]
  ------------------
  985|      0|      field = zfp_field_2d((void *) output, type, blockshape[1], blockshape[0]);
  986|      0|      break;
  987|      0|    case 3:
  ------------------
  |  Branch (987:5): [True: 0, False: 0]
  ------------------
  988|      0|      field = zfp_field_3d((void *) output, type, blockshape[2], blockshape[1], blockshape[0]);
  989|      0|      break;
  990|      0|    case 4:
  ------------------
  |  Branch (990:5): [True: 0, False: 0]
  ------------------
  991|      0|      field = zfp_field_4d((void *) output, type, blockshape[3], blockshape[2], blockshape[1], blockshape[0]);
  992|      0|      break;
  993|      0|    default:
  ------------------
  |  Branch (993:5): [True: 0, False: 0]
  ------------------
  994|      0|      free(shape);
  995|      0|      free(chunkshape);
  996|      0|      free(blockshape);
  997|      0|      BLOSC_TRACE_ERROR("ZFP is not available for ndims: %d", ndim);
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  998|      0|      return BLOSC2_ERROR_FAILURE;
  999|      0|  }
 1000|       |
 1001|      0|  size_t blocks = zfp_field_blocks(field);
 1002|      0|  uint n = 1u << (2 * ndim);
 1003|      0|  uint bits = (uint) floor(n * rate + 0.5);
 1004|      0|  switch (type) {
 1005|      0|    case zfp_type_float:
  ------------------
  |  Branch (1005:5): [True: 0, False: 0]
  ------------------
 1006|      0|      if (bits < 1 + 8u) {
  ------------------
  |  Branch (1006:11): [True: 0, False: 0]
  ------------------
 1007|      0|        bits = 1 + 8u;
 1008|      0|      }
 1009|      0|      break;
 1010|      0|    case zfp_type_double:
  ------------------
  |  Branch (1010:5): [True: 0, False: 0]
  ------------------
 1011|      0|      if (bits < 1 + 11u) {
  ------------------
  |  Branch (1011:11): [True: 0, False: 0]
  ------------------
 1012|      0|        bits = 1 + 11u;
 1013|      0|      }
 1014|      0|      break;
 1015|      0|    default:
  ------------------
  |  Branch (1015:5): [True: 0, False: 0]
  ------------------
 1016|      0|      break;
 1017|      0|  }
 1018|      0|  if (bits > 0 && blocks > SIZE_MAX / bits) {
  ------------------
  |  Branch (1018:7): [True: 0, False: 0]
  |  Branch (1018:19): [True: 0, False: 0]
  ------------------
 1019|      0|    BLOSC_TRACE_ERROR("ZFP rate: required bits overflow size_t");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1020|      0|    zfp_field_free(field);
 1021|      0|    zfp_stream_close(zfp);
 1022|      0|    free(shape);
 1023|      0|    free(chunkshape);
 1024|      0|    free(blockshape);
 1025|      0|    return BLOSC2_ERROR_FAILURE;
 1026|      0|  }
 1027|      0|  size_t required_bits = blocks * (size_t) bits;
 1028|      0|  size_t required_bytes = (required_bits + CHAR_BIT - 1) / CHAR_BIT;
 1029|      0|  if (required_bytes < 1) {
  ------------------
  |  Branch (1029:7): [True: 0, False: 0]
  ------------------
 1030|      0|    required_bytes = 1;
 1031|      0|  }
 1032|      0|  if (input_len < 0 || (size_t) input_len < required_bytes) {
  ------------------
  |  Branch (1032:7): [True: 0, False: 0]
  |  Branch (1032:24): [True: 0, False: 0]
  ------------------
 1033|      0|    BLOSC_TRACE_ERROR("ZFP rate: input too small (%d bytes) for the required "
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1034|      0|                      "bitstream size (%zu bytes)", input_len, required_bytes);
 1035|      0|    zfp_field_free(field);
 1036|      0|    zfp_stream_close(zfp);
 1037|      0|    free(shape);
 1038|      0|    free(chunkshape);
 1039|      0|    free(blockshape);
 1040|      0|    return BLOSC2_ERROR_FAILURE;
 1041|      0|  }
 1042|       |
 1043|      0|  if (zfp_open_padded_stream(input, input_len, zfp, field, &stream, &padded_input) != BLOSC2_ERROR_SUCCESS) {
  ------------------
  |  Branch (1043:7): [True: 0, False: 0]
  ------------------
 1044|      0|    zfp_field_free(field);
 1045|      0|    zfp_stream_close(zfp);
 1046|      0|    free(shape);
 1047|      0|    free(chunkshape);
 1048|      0|    free(blockshape);
 1049|      0|    return BLOSC2_ERROR_FAILURE;
 1050|      0|  }
 1051|       |
 1052|      0|  zfpsize = zfp_decompress(zfp, field);
 1053|       |
 1054|       |  /* clean up */
 1055|      0|  zfp_field_free(field);
 1056|      0|  zfp_stream_close(zfp);
 1057|      0|  zfp_close_padded_stream(stream, padded_input);
 1058|      0|  free(shape);
 1059|      0|  free(chunkshape);
 1060|      0|  free(blockshape);
 1061|       |
 1062|      0|  if (zfpsize == 0) {
  ------------------
  |  Branch (1062:7): [True: 0, False: 0]
  ------------------
 1063|      0|    BLOSC_TRACE_ERROR("\n ZFP: Decompression failed\n");
  ------------------
  |  |   93|      0|#define BLOSC_TRACE_ERROR(msg, ...) BLOSC_TRACE(error, msg, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |   97|      0|    do {                                            \
  |  |  |  |   98|      0|        const char *__e = getenv("BLOSC_TRACE");    \
  |  |  |  |   99|      0|        if (!__e) { break; }                        \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (99:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  100|      0|        fprintf(stderr, "[%s] - " msg " (%s:%d)\n", #cat, ##__VA_ARGS__, __FILE__, __LINE__); \
  |  |  |  |  101|      0|    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (101:13): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1064|      0|    return (int) zfpsize;
 1065|      0|  }
 1066|       |
 1067|      0|  return (int) output_len;
 1068|      0|}

simd_load:
   34|   730M|bytes16 simd_load(const void* ptr) { return _mm_loadu_si128((const __m128i*)ptr); }
simd_store:
   35|   730M|void simd_store(void* ptr, bytes16 x) { _mm_storeu_si128((__m128i*)ptr, x); }
simd_add:
   38|   730M|bytes16 simd_add(bytes16 a, bytes16 b) { return _mm_add_epi8(a, b); }
simd_duplane15:
   40|   730M|bytes16 simd_duplane15(bytes16 x) { return _mm_shuffle_epi8(x, _mm_set1_epi8(15)); }
simd_prefix_sum:
   43|   730M|{
   44|       |  // Sklansky-style sum from https://gist.github.com/rygorous/4212be0cd009584e4184e641ca210528
   45|   730M|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 8));
   46|   730M|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 16));
   47|   730M|  x = _mm_add_epi8(x, _mm_slli_epi64(x, 32));
   48|   730M|  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|   730M|  return x;
   50|   730M|}
simd_get_last:
   52|   357k|uint8_t simd_get_last(bytes16 x) { return (_mm_extract_epi16(x, 7) >> 8) & 0xFF; }
bytedelta_backward:
  515|  47.1k|                       blosc2_dparams *dparams, uint8_t id) {
  516|  47.1k|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|  47.1k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  517|       |
  518|  47.1k|  int typesize = meta;
  519|  47.1k|  if (typesize == 0) {
  ------------------
  |  Branch (519:7): [True: 41, False: 47.0k]
  ------------------
  520|     41|    if (dparams->schunk == NULL) {
  ------------------
  |  Branch (520:9): [True: 2, False: 39]
  ------------------
  521|      2|      BLOSC_TRACE_ERROR("When meta is 0, you need to be on a schunk!");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  522|      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]
  |  |  ------------------
  ------------------
  523|      2|    }
  524|     39|    blosc2_schunk* schunk = (blosc2_schunk*)(dparams->schunk);
  525|     39|    typesize = schunk->typesize;
  526|     39|  }
  527|       |
  528|  47.1k|  const int stream_len = length / typesize;
  529|  12.0M|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (529:21): [True: 12.0M, False: 47.1k]
  ------------------
  530|  12.0M|    int ip = 0;
  531|  12.0M|    uint8_t _v2 = 0;
  532|       |    // SIMD fetch 16 bytes from each channel, prefix-sum un-delta
  533|  12.0M|#if defined(CPU_HAS_SIMD)
  534|  12.0M|    bytes16 v2 = {0};
  535|   677M|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (535:12): [True: 665M, False: 12.0M]
  ------------------
  536|   665M|      bytes16 v = simd_load(input);
  537|   665M|      input += 16;
  538|       |      // un-delta via prefix sum
  539|   665M|      v2 = simd_add(simd_prefix_sum(v), simd_duplane15(v2));
  540|   665M|      simd_store(output, v2);
  541|   665M|      output += 16;
  542|   665M|    }
  543|  12.0M|    if (stream_len > 15) {
  ------------------
  |  Branch (543:9): [True: 357k, False: 11.6M]
  ------------------
  544|   357k|      _v2 = simd_get_last(v2);
  545|   357k|    }
  546|  12.0M|#endif // #if defined(CPU_HAS_SIMD)
  547|       |    // scalar leftover
  548|  41.9M|    for (; ip < stream_len; ip++) {
  ------------------
  |  Branch (548:12): [True: 29.9M, False: 12.0M]
  ------------------
  549|  29.9M|      uint8_t v = *input + _v2;
  550|  29.9M|      input++;
  551|  29.9M|      *output = v;
  552|  29.9M|      output++;
  553|  29.9M|      _v2 = v;
  554|  29.9M|    }
  555|  12.0M|  }
  556|       |
  557|       |  // Mirror of the forward pass: restore the trailing bytes verbatim.
  558|  47.1k|  memcpy(output, input, (size_t)(length - stream_len * typesize));
  559|       |
  560|  47.1k|  return BLOSC2_ERROR_SUCCESS;
  561|  47.1k|}
bytedelta_backward_buggy:
  611|  31.8k|                             uint8_t meta, blosc2_dparams *dparams, uint8_t id) {
  612|  31.8k|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|  31.8k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  613|       |
  614|  31.8k|  int typesize = meta;
  615|  31.8k|  if (typesize == 0) {
  ------------------
  |  Branch (615:7): [True: 34, False: 31.8k]
  ------------------
  616|     34|    if (dparams->schunk == NULL) {
  ------------------
  |  Branch (616:9): [True: 1, False: 33]
  ------------------
  617|      1|      BLOSC_TRACE_ERROR("When meta is 0, you need to be on a schunk!");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  618|      1|      BLOSC_ERROR(BLOSC2_ERROR_FAILURE);
  ------------------
  |  |  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]
  |  |  ------------------
  ------------------
  619|      1|    }
  620|     33|    blosc2_schunk* schunk = (blosc2_schunk*)(dparams->schunk);
  621|     33|    typesize = schunk->typesize;
  622|     33|  }
  623|       |
  624|  31.8k|  const int stream_len = length / typesize;
  625|  13.2G|  for (int ich = 0; ich < typesize; ++ich) {
  ------------------
  |  Branch (625:21): [True: 13.2G, False: 31.8k]
  ------------------
  626|  13.2G|    int ip = 0;
  627|       |    // SIMD fetch 16 bytes from each channel, prefix-sum un-delta
  628|  13.2G|#if defined(CPU_HAS_SIMD)
  629|  13.2G|    bytes16 v2 = {0};
  630|  13.2G|    for (; ip < stream_len - 15; ip += 16) {
  ------------------
  |  Branch (630:12): [True: 65.2M, False: 13.2G]
  ------------------
  631|  65.2M|      bytes16 v = simd_load(input);
  632|  65.2M|      input += 16;
  633|       |      // un-delta via prefix sum
  634|  65.2M|      v2 = simd_add(simd_prefix_sum(v), simd_duplane15(v2));
  635|  65.2M|      simd_store(output, v2);
  636|  65.2M|      output += 16;
  637|  65.2M|    }
  638|  13.2G|#endif // #if defined(CPU_HAS_SIMD)
  639|       |    // scalar leftover
  640|  13.2G|    uint8_t _v2 = 0;
  641|  13.2G|    for (; ip < stream_len; ip++) {
  ------------------
  |  Branch (641:12): [True: 25.1M, False: 13.2G]
  ------------------
  642|  25.1M|      uint8_t v = *input + _v2;
  643|  25.1M|      input++;
  644|  25.1M|      *output = v;
  645|  25.1M|      output++;
  646|  25.1M|      _v2 = v;
  647|  25.1M|    }
  648|  13.2G|  }
  649|       |
  650|  31.8k|  return BLOSC2_ERROR_SUCCESS;
  651|  31.8k|}

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

int_trunc_backward:
  117|  4.39k|                       blosc2_dparams *dparams, uint8_t id) {
  118|  4.39k|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|  4.39k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  119|  4.39k|  BLOSC_UNUSED_PARAM(dparams);
  ------------------
  |  |   28|  4.39k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  120|  4.39k|  BLOSC_UNUSED_PARAM(meta);
  ------------------
  |  |   28|  4.39k|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  121|       |
  122|       |  // Do a copy of the input buffer (truncation is lossy and cannot be reversed)
  123|  4.39k|  memcpy(output, input, length);
  124|  4.39k|  return BLOSC2_ERROR_SUCCESS;
  125|  4.39k|}

ndcell_backward:
  205|      1|                   uint8_t id) {
  206|      1|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|      1|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  207|      1|  blosc2_schunk *schunk = dparams->schunk;
  208|      1|  int8_t ndim;
  209|      1|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      1|#define B2ND_MAX_DIM 16
  ------------------
  210|      1|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      1|#define B2ND_MAX_DIM 16
  ------------------
  211|      1|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      1|#define B2ND_MAX_DIM 16
  ------------------
  212|      1|  uint8_t *smeta;
  213|      1|  int32_t smeta_len;
  214|      1|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (214:7): [True: 1, False: 0]
  ------------------
  215|      1|    free(shape);
  216|      1|    free(chunkshape);
  217|      1|    free(blockshape);
  218|      1|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  219|      1|    return BLOSC2_ERROR_FAILURE;
  220|      1|  }
  221|      0|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (221:7): [True: 0, False: 0]
  ------------------
  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|      0|  free(smeta);
  229|      0|  if (ndim <= 0 || ndim > NDCELL_MAX_DIM) {
  ------------------
  |  |   16|      0|#define NDCELL_MAX_DIM 8
  ------------------
  |  Branch (229:7): [True: 0, False: 0]
  |  Branch (229:20): [True: 0, False: 0]
  ------------------
  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|      0|  int cell_shape = (int) meta;
  241|      0|  if (cell_shape <= 0) {
  ------------------
  |  Branch (241:7): [True: 0, False: 0]
  ------------------
  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|      0|  int64_t cell_size = 1;
  252|      0|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (252:19): [True: 0, False: 0]
  ------------------
  253|      0|    if (cell_size > INT64_MAX / cell_shape) {
  ------------------
  |  Branch (253:9): [True: 0, False: 0]
  ------------------
  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|      0|    cell_size *= cell_shape;
  261|      0|  }
  262|      0|  int32_t typesize = schunk->typesize;
  263|      0|  uint8_t *ip = (uint8_t *) input;
  264|      0|  uint8_t *ip_limit = ip + length;
  265|      0|  uint8_t *op = (uint8_t *) output;
  266|      0|  if (typesize <= 0) {
  ------------------
  |  Branch (266:7): [True: 0, False: 0]
  ------------------
  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|      0|  int64_t blocksize = (int64_t) typesize;
  283|      0|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (283:19): [True: 0, False: 0]
  ------------------
  284|      0|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (284:9): [True: 0, False: 0]
  ------------------
  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|      0|    blocksize *= blockshape[i];
  292|      0|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (292:9): [True: 0, False: 0]
  ------------------
  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|      0|  }
  300|       |
  301|      0|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (301:7): [True: 0, False: 0]
  ------------------
  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|      0|  if (cell_size > (int64_t) length / typesize) {
  ------------------
  |  Branch (312:7): [True: 0, False: 0]
  ------------------
  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|      0|  int64_t i_shape[NDCELL_MAX_DIM];
  321|      0|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (321:19): [True: 0, False: 0]
  ------------------
  322|      0|    i_shape[i] = (blockshape[i] + cell_shape - 1) / cell_shape;
  323|      0|  }
  324|       |
  325|      0|  int64_t ncells = 1;
  326|      0|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (326:19): [True: 0, False: 0]
  ------------------
  327|      0|    ncells *= i_shape[i];
  328|      0|  }
  329|       |
  330|       |  /* main loop */
  331|      0|  int64_t pad_shape[NDCELL_MAX_DIM] = {0};
  332|      0|  int64_t ii[NDCELL_MAX_DIM];
  333|      0|  int32_t ind = 0;
  334|      0|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (334:26): [True: 0, False: 0]
  ------------------
  335|       |
  336|      0|    if (ip > ip_limit) {
  ------------------
  |  Branch (336:9): [True: 0, False: 0]
  ------------------
  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|      0|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  344|      0|    uint32_t orig = 0;
  345|      0|    int64_t nd_aux = (int64_t) cell_shape;
  346|      0|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (346:28): [True: 0, False: 0]
  ------------------
  347|      0|      orig += ii[i] * nd_aux;
  348|      0|      nd_aux *= blockshape[i];
  349|      0|    }
  350|       |
  351|      0|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (351:27): [True: 0, False: 0]
  ------------------
  352|      0|      if ((blockshape[dim_ind] % cell_shape != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (352:11): [True: 0, False: 0]
  |  Branch (352:54): [True: 0, False: 0]
  ------------------
  353|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cell_shape;
  354|      0|      } else {
  355|      0|        pad_shape[dim_ind] = (int64_t) cell_shape;
  356|      0|      }
  357|      0|    }
  358|       |
  359|      0|    int64_t ncopies = 1;
  360|      0|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (360:21): [True: 0, False: 0]
  ------------------
  361|      0|      ncopies *= pad_shape[i];
  362|      0|    }
  363|      0|    int64_t kk[NDCELL_MAX_DIM];
  364|      0|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (364:28): [True: 0, False: 0]
  ------------------
  365|      0|      blosc2_unidim_to_multidim(ndim - 1, pad_shape, copy_ind, kk);
  366|      0|      nd_aux = blockshape[ndim - 1];
  367|      0|      ind = (int32_t) orig;
  368|      0|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (368:30): [True: 0, False: 0]
  ------------------
  369|      0|        ind += (int32_t) (kk[i] * nd_aux);
  370|      0|        nd_aux *= blockshape[i];
  371|      0|      }
  372|      0|      memcpy(&op[ind * typesize], ip, pad_shape[ndim - 1] * typesize);
  373|      0|      ip += pad_shape[ndim - 1] * typesize;
  374|      0|    }
  375|      0|  }
  376|      0|  ind += (int32_t) pad_shape[ndim - 1];
  377|       |
  378|       |
  379|      0|  if (ind != (int32_t) (blocksize / typesize)) {
  ------------------
  |  Branch (379:7): [True: 0, False: 0]
  ------------------
  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|      0|  free(shape);
  389|      0|  free(chunkshape);
  390|      0|  free(blockshape);
  391|       |
  392|      0|  return BLOSC2_ERROR_SUCCESS;
  393|      0|}

ndmean_backward:
  243|      1|                   uint8_t id) {
  244|      1|  BLOSC_UNUSED_PARAM(id);
  ------------------
  |  |   28|      1|#define BLOSC_UNUSED_PARAM(x) ((void)(x))
  ------------------
  245|      1|  blosc2_schunk *schunk = dparams->schunk;
  246|      1|  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|      1|  int64_t *shape = malloc(B2ND_MAX_DIM * sizeof(int64_t));
  ------------------
  |  |   50|      1|#define B2ND_MAX_DIM 16
  ------------------
  252|      1|  int32_t *chunkshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      1|#define B2ND_MAX_DIM 16
  ------------------
  253|      1|  int32_t *blockshape = malloc(B2ND_MAX_DIM * sizeof(int32_t));
  ------------------
  |  |   50|      1|#define B2ND_MAX_DIM 16
  ------------------
  254|      1|  uint8_t *smeta;
  255|      1|  int32_t smeta_len;
  256|      1|  if (blosc2_meta_get(schunk, "b2nd", &smeta, &smeta_len) < 0) {
  ------------------
  |  Branch (256:7): [True: 1, False: 0]
  ------------------
  257|      1|    free(shape);
  258|      1|    free(chunkshape);
  259|      1|    free(blockshape);
  260|      1|    BLOSC_TRACE_ERROR("b2nd layer not found!");
  ------------------
  |  |   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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  261|      1|    return BLOSC2_ERROR_FAILURE;
  262|      1|  }
  263|      0|  if (b2nd_deserialize_meta(smeta, smeta_len, &ndim, shape, chunkshape, blockshape, NULL, NULL) < 0) {
  ------------------
  |  Branch (263:7): [True: 0, False: 0]
  ------------------
  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|      0|  free(smeta);
  272|       |  // Guard the fixed-size (NDMEAN_MAX_DIM) stack arrays used below.
  273|      0|  if (ndim <= 0 || ndim > NDMEAN_MAX_DIM) {
  ------------------
  |  |   16|      0|#define NDMEAN_MAX_DIM 8
  ------------------
  |  Branch (273:7): [True: 0, False: 0]
  |  Branch (273:20): [True: 0, False: 0]
  ------------------
  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|      0|  if ((int8_t) meta <= 0) {
  ------------------
  |  Branch (287:7): [True: 0, False: 0]
  ------------------
  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|      0|  int8_t cellshape[8];
  296|      0|  int64_t cell_size = 1;  // 64-bit: prod(cellshape) can reach 127^ndim, which overflows int
  297|      0|  for (int i = 0; i < 8; ++i) {
  ------------------
  |  Branch (297:19): [True: 0, False: 0]
  ------------------
  298|      0|    if (i < ndim) {
  ------------------
  |  Branch (298:9): [True: 0, False: 0]
  ------------------
  299|      0|      cellshape[i] = (int8_t) meta;
  300|      0|      if (cellshape[i] > blockshape[i]) {
  ------------------
  |  Branch (300:11): [True: 0, False: 0]
  ------------------
  301|      0|        cellshape[i] = (int8_t) blockshape[i];
  302|      0|      }
  303|      0|      cell_size *= cellshape[i];
  304|      0|    } else {
  305|      0|      cellshape[i] = 1;
  306|      0|    }
  307|      0|  }
  308|       |
  309|      0|  int8_t typesize = (int8_t) schunk->typesize;
  310|      0|  uint8_t *ip = (uint8_t *) input;
  311|      0|  uint8_t *ip_limit = ip + length;
  312|      0|  uint8_t *op = (uint8_t *) output;
  313|      0|  if (typesize <= 0) {
  ------------------
  |  Branch (313:7): [True: 0, False: 0]
  ------------------
  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|      0|  int64_t blocksize = (int64_t) typesize;
  329|      0|  for (int i = 0; i < ndim; i++) {
  ------------------
  |  Branch (329:19): [True: 0, False: 0]
  ------------------
  330|      0|    if (blockshape[i] <= 0) {
  ------------------
  |  Branch (330:9): [True: 0, False: 0]
  ------------------
  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|      0|    blocksize *= blockshape[i];
  338|      0|    if (blocksize > (int64_t) length) {
  ------------------
  |  Branch (338:9): [True: 0, False: 0]
  ------------------
  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|      0|  }
  346|       |
  347|      0|  if ((int64_t) length != blocksize) {
  ------------------
  |  Branch (347:7): [True: 0, False: 0]
  ------------------
  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|      0|  if (length < cell_size * typesize) {
  ------------------
  |  Branch (355:7): [True: 0, False: 0]
  ------------------
  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|      0|  int64_t i_shape[NDMEAN_MAX_DIM];
  364|      0|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (364:19): [True: 0, False: 0]
  ------------------
  365|      0|    i_shape[i] = (blockshape[i] + cellshape[i] - 1) / cellshape[i];
  366|      0|  }
  367|       |
  368|      0|  int64_t ncells = 1;
  369|      0|  for (int i = 0; i < ndim; ++i) {
  ------------------
  |  Branch (369:19): [True: 0, False: 0]
  ------------------
  370|      0|    ncells *= i_shape[i];
  371|      0|  }
  372|       |
  373|       |  /* main loop */
  374|      0|  int64_t pad_shape[NDMEAN_MAX_DIM] = {0};
  375|      0|  int64_t ii[NDMEAN_MAX_DIM];
  376|      0|  int32_t ind = 0;
  377|      0|  for (int cell_ind = 0; cell_ind < ncells; cell_ind++) {      // for each cell
  ------------------
  |  Branch (377:26): [True: 0, False: 0]
  ------------------
  378|       |
  379|      0|    if (ip > ip_limit) {
  ------------------
  |  Branch (379:9): [True: 0, False: 0]
  ------------------
  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|      0|    blosc2_unidim_to_multidim(ndim, i_shape, cell_ind, ii);
  387|      0|    uint32_t orig = 0;
  388|      0|    int64_t nd_aux = (int64_t) (cellshape[0]);
  389|      0|    for (int i = ndim - 1; i >= 0; i--) {
  ------------------
  |  Branch (389:28): [True: 0, False: 0]
  ------------------
  390|      0|      orig += ii[i] * nd_aux;
  391|      0|      nd_aux *= blockshape[i];
  392|      0|    }
  393|       |
  394|      0|    for (int dim_ind = 0; dim_ind < ndim; dim_ind++) {
  ------------------
  |  Branch (394:27): [True: 0, False: 0]
  ------------------
  395|      0|      if ((blockshape[dim_ind] % cellshape[dim_ind] != 0) && (ii[dim_ind] == i_shape[dim_ind] - 1)) {
  ------------------
  |  Branch (395:11): [True: 0, False: 0]
  |  Branch (395:62): [True: 0, False: 0]
  ------------------
  396|      0|        pad_shape[dim_ind] = blockshape[dim_ind] % cellshape[dim_ind];
  397|      0|      } else {
  398|      0|        pad_shape[dim_ind] = (int64_t) cellshape[dim_ind];
  399|      0|      }
  400|      0|    }
  401|       |
  402|      0|    int64_t ncopies = 1;
  403|      0|    for (int i = 0; i < ndim - 1; ++i) {
  ------------------
  |  Branch (403:21): [True: 0, False: 0]
  ------------------
  404|      0|      ncopies *= pad_shape[i];
  405|      0|    }
  406|      0|    int64_t kk[NDMEAN_MAX_DIM];
  407|      0|    for (int copy_ind = 0; copy_ind < ncopies; ++copy_ind) {
  ------------------
  |  Branch (407:28): [True: 0, False: 0]
  ------------------
  408|      0|      blosc2_unidim_to_multidim((int8_t) (ndim - 1), pad_shape, copy_ind, kk);
  409|      0|      nd_aux = blockshape[ndim - 1];
  410|      0|      ind = (int32_t) orig;
  411|      0|      for (int i = ndim - 2; i >= 0; i--) {
  ------------------
  |  Branch (411:30): [True: 0, False: 0]
  ------------------
  412|      0|        ind += (int32_t) (kk[i] * nd_aux);
  413|      0|        nd_aux *= blockshape[i];
  414|      0|      }
  415|      0|      memcpy(&op[ind * typesize], ip, pad_shape[ndim - 1] * typesize);
  416|      0|      ip += pad_shape[ndim - 1] * typesize;
  417|      0|    }
  418|      0|  }
  419|      0|  ind += (int32_t) pad_shape[ndim - 1];
  420|       |
  421|      0|  free(shape);
  422|      0|  free(chunkshape);
  423|      0|  free(blockshape);
  424|       |
  425|      0|  if (ind != (int32_t) (blocksize / typesize)) {
  ------------------
  |  Branch (425:7): [True: 0, False: 0]
  ------------------
  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|      0|  return BLOSC2_ERROR_SUCCESS;
  432|      0|}

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

LLVMFuzzerTestOneInput:
   11|  7.08k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   12|  7.08k|  int32_t i = 0, dsize = 0;
   13|  7.08k|  int32_t nchunk = 0;
   14|       |
   15|  7.08k|  blosc2_init();
   16|  7.08k|  blosc2_set_nthreads(1);
   17|       |
   18|       |  /* Create a super-chunk backed by an in-memory frame */
   19|  7.08k|  blosc2_schunk* schunk = blosc2_schunk_from_buffer((uint8_t *) data, (int64_t)size, false);
   20|  7.08k|  if (schunk == NULL) {
  ------------------
  |  Branch (20:7): [True: 6.21k, False: 872]
  ------------------
   21|  6.21k|    blosc2_destroy();
   22|  6.21k|    return 0;
   23|  6.21k|  }
   24|       |  /* Don't allow address sanitizer to allocate more than INT32_MAX */
   25|    872|  if (schunk->nbytes >= INT32_MAX) {
  ------------------
  |  Branch (25:7): [True: 3, False: 869]
  ------------------
   26|      3|    blosc2_schunk_free(schunk);
   27|      3|    blosc2_destroy();
   28|      3|    return 0;
   29|      3|  }
   30|       |  /* Decompress data */
   31|    869|  uint8_t *uncompressed_data = (uint8_t *)malloc((size_t)schunk->nbytes+1);
   32|    869|  if (uncompressed_data != NULL) {
  ------------------
  |  Branch (32:7): [True: 869, False: 0]
  ------------------
   33|  76.6k|    for (i = 0, nchunk = 0; nchunk < schunk->nchunks-1; nchunk++) {
  ------------------
  |  Branch (33:29): [True: 76.4k, False: 147]
  ------------------
   34|  76.4k|      dsize = blosc2_schunk_decompress_chunk(schunk, nchunk, uncompressed_data + i, schunk->chunksize);
   35|  76.4k|      if (dsize < 0) {
  ------------------
  |  Branch (35:11): [True: 722, False: 75.7k]
  ------------------
   36|    722|        printf("Decompression error.  Error code: %d\n", dsize);
   37|    722|        break;
   38|    722|      }
   39|  75.7k|      i += dsize;
   40|  75.7k|    }
   41|       |
   42|    869|    free(uncompressed_data);
   43|    869|  }
   44|       |
   45|    869|  blosc2_schunk_free(schunk);
   46|    869|  blosc2_destroy();
   47|    869|  return 0;
   48|    872|}

